[build] Use configured architecture in the GRUB config. (#18093)

- Why I did it
The existing grub configuration has a hardcoded "amd64" architecture in the kernel and initramfs names. This causes an error in the attempt to load the image compiled for a different architecture.

- How I did it
Use configured architecture in the GRUB config.

- How to verify it
Compile the image for Arm64 architecture and install it on the device.
This commit is contained in:
Oleksandr Ivantsiv 2024-02-22 08:04:52 -08:00 committed by GitHub
parent 8a7e38b3a3
commit cf9929546d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 2 deletions

View File

@ -588,13 +588,13 @@ menuentry '$demo_grub_entry' {
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos insmod part_msdos
insmod ext2 insmod ext2
$GRUB_CFG_LINUX_CMD /$image_dir/boot/vmlinuz-6.1.0-11-2-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ $GRUB_CFG_LINUX_CMD /$image_dir/boot/vmlinuz-6.1.0-11-2-${arch} root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \
net.ifnames=0 biosdevname=0 \ net.ifnames=0 biosdevname=0 \
loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \
systemd.unified_cgroup_hierarchy=0 \ systemd.unified_cgroup_hierarchy=0 \
apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX
echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' echo 'Loading $demo_volume_label $demo_type initial ramdisk ...'
$GRUB_CFG_INITRD_CMD /$image_dir/boot/initrd.img-6.1.0-11-2-amd64 $GRUB_CFG_INITRD_CMD /$image_dir/boot/initrd.img-6.1.0-11-2-${arch}
} }
EOF EOF

View File

@ -141,6 +141,8 @@ if [ "$install_env" = "onie" ]; then
onie_initrd_tmp=/ onie_initrd_tmp=/
fi fi
arch="%%ARCH%%"
# The build system prepares this script by replacing %%DEMO-TYPE%% # The build system prepares this script by replacing %%DEMO-TYPE%%
# with "OS" or "DIAG". # with "OS" or "DIAG".
demo_type="%%DEMO_TYPE%%" demo_type="%%DEMO_TYPE%%"

View File

@ -97,6 +97,7 @@ output_raw_image=$(eval echo $output_raw_image)
# Tailor the demo installer for OS mode or DIAG mode # Tailor the demo installer for OS mode or DIAG mode
sed -i -e "s/%%DEMO_TYPE%%/$demo_type/g" \ sed -i -e "s/%%DEMO_TYPE%%/$demo_type/g" \
-e "s/%%ARCH%%/$arch/g" \
-e "s/%%IMAGE_VERSION%%/$image_version/g" \ -e "s/%%IMAGE_VERSION%%/$image_version/g" \
-e "s/%%ONIE_IMAGE_PART_SIZE%%/$onie_image_part_size/" \ -e "s/%%ONIE_IMAGE_PART_SIZE%%/$onie_image_part_size/" \
-e "s/%%EXTRA_CMDLINE_LINUX%%/$EXTRA_CMDLINE_LINUX/" \ -e "s/%%EXTRA_CMDLINE_LINUX%%/$EXTRA_CMDLINE_LINUX/" \