VIM1S/VIM4: always use symlinks from /boot for booting

This commit is contained in:
Gunjan Gupta
2024-04-27 15:56:43 +05:30
committed by Igor
parent dcde85f9a1
commit c7492bedc1
2 changed files with 41 additions and 7 deletions

View File

@@ -89,13 +89,8 @@ fi
# The symlinks for kernel and initrd.img are at different locations in debian and ubuntu
# Check and load from a location that exists
if test -e ${devtype} ${devnum} /vmlinuz; then
load ${devtype} ${devnum} ${kernel_addr_r} /vmlinuz
load ${devtype} ${devnum} ${ramdisk_addr_r} /initrd.img
else
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}vmlinuz
load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}initrd.img
fi
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}Image
load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}Initrd
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
# Recompile with:

View File

@@ -215,3 +215,42 @@ function post_family_tweaks_bsp__add_postrm_hook() {
display_alert "$BOARD" "Adding postrm hook to restore /etc/initramfs-tools/modules file" "info"
postrm_functions+=(meson_s4t7_board_side_bsp_cli_postrm)
}
function post_family_tweaks_bsp__meson_s4t7_set_initrd_symlink_location() {
# We already create /boot/Image symlink ourselves. Lets also create a symlink for initrd so that
# we can have a consistent way for booting.
run_host_command_logged cat <<- 'zzz-update-initramfs' > "${destination}"/etc/initramfs/post-update.d/zzz-update-initramfs
#!/bin/bash -e
# Play nice when run under debconf.
exec </dev/null >&2
abi=$1
initrd_file=$2
target=/boot/
function is_boot_dev_vfat() {
if ! mountpoint -q /boot; then
return 1
fi
local boot_partition bootfstype
boot_partition=$(findmnt --nofsroot -n -o SOURCE /boot)
bootfstype=$(blkid -s TYPE -o value $boot_partition)
if [[ "$bootfstype" == "vfat" ]]; then
return 0
fi
return 1
}
if is_boot_dev_vfat; then
cp ${initrd_file} ${target}/Initrd
sync -f ${target}/Initrd || true
else
ln -sf ${initrd_file} ${target}/Initrd
fi
exit 0
zzz-update-initramfs
chmod a+x "${destination}"/etc/initramfs/post-update.d/zzz-update-initramfs
}