Skip to content

Commit 5e04777

Browse files
oleksandrivantsivsonic-otn
authored andcommitted
[build] Use configured architecture in the GRUB config. (sonic-net#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.
1 parent 3579059 commit 5e04777

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

installer/default_platform.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -588,13 +588,13 @@ menuentry '$demo_grub_entry' {
588588
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
589589
insmod part_msdos
590590
insmod ext2
591-
$GRUB_CFG_LINUX_CMD /$image_dir/boot/vmlinuz-6.1.0-11-2-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \
591+
$GRUB_CFG_LINUX_CMD /$image_dir/boot/vmlinuz-6.1.0-11-2-${arch} root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \
592592
net.ifnames=0 biosdevname=0 \
593593
loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \
594594
systemd.unified_cgroup_hierarchy=0 \
595595
apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX
596596
echo 'Loading $demo_volume_label $demo_type initial ramdisk ...'
597-
$GRUB_CFG_INITRD_CMD /$image_dir/boot/initrd.img-6.1.0-11-2-amd64
597+
$GRUB_CFG_INITRD_CMD /$image_dir/boot/initrd.img-6.1.0-11-2-${arch}
598598
}
599599
EOF
600600

installer/install.sh

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ if [ "$install_env" = "onie" ]; then
141141
onie_initrd_tmp=/
142142
fi
143143

144+
arch="%%ARCH%%"
145+
144146
# The build system prepares this script by replacing %%DEMO-TYPE%%
145147
# with "OS" or "DIAG".
146148
demo_type="%%DEMO_TYPE%%"

onie-mk-demo.sh

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ output_raw_image=$(eval echo $output_raw_image)
9797

9898
# Tailor the demo installer for OS mode or DIAG mode
9999
sed -i -e "s/%%DEMO_TYPE%%/$demo_type/g" \
100+
-e "s/%%ARCH%%/$arch/g" \
100101
-e "s/%%IMAGE_VERSION%%/$image_version/g" \
101102
-e "s/%%ONIE_IMAGE_PART_SIZE%%/$onie_image_part_size/" \
102103
-e "s/%%EXTRA_CMDLINE_LINUX%%/$EXTRA_CMDLINE_LINUX/" \

0 commit comments

Comments
 (0)