stage2: add copy devicetree in 95-copy-kernel, if $GLOBAL_COPY_DTB is set

dtb on an ESP partition can be loaded by u-boot.
devicetree directory contain symlinks to enable booting on systems,
where use path of directory by vendor (modern u-boot) and flat path
(older u-boot). In the case of iso, there is no need to support old
u-boot given the price of 15 MB image increase on aarch64.
This commit is contained in:
Anton Midyukov 2022-06-23 19:25:15 +07:00
parent 8dec2e9bdc
commit a9ded39b26

View File

@ -33,3 +33,20 @@ case "$GLOBAL_EFI_BOOTLOADER" in
cp -lpLf boot/initrd.img EFI/BOOT/full.cz
;;
esac
# copy dtb for default kernel
if [ -n "$GLOBAL_COPY_DTB" ]; then
dtb_dir=
[ -d /boot/devicetree/$kverdef ] && dtb_dir=/boot/devicetree/$kverdef
[ -z "$dtb_dir" ] && [ -d /lib/devicetree/$kverdef ] &&
dtb_dir=/lib/devicetree/$kverdef
if [ -n "$dtb_dir" ]; then
cp -r "$dtb_dir/" dtb
# cleanup symlinks which are duplicated for compatibility
find dtb/ -type l -delete
# fix permissions for copy-tree
chmod -R 755 dtb
else
echo "dtb directory for $kverdef not found"
fi
fi