Skip to content

Commit

Permalink
[build] Use configured architecture in the GRUB config. (#18093)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
oleksandrivantsiv authored Feb 22, 2024
1 parent 8a7e38b commit cf99295
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions installer/default_platform.conf
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,13 @@ menuentry '$demo_grub_entry' {
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
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 \
loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \
systemd.unified_cgroup_hierarchy=0 \
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 ...'
$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
Expand Down
2 changes: 2 additions & 0 deletions installer/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ if [ "$install_env" = "onie" ]; then
onie_initrd_tmp=/
fi

arch="%%ARCH%%"

# The build system prepares this script by replacing %%DEMO-TYPE%%
# with "OS" or "DIAG".
demo_type="%%DEMO_TYPE%%"
Expand Down
1 change: 1 addition & 0 deletions onie-mk-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ output_raw_image=$(eval echo $output_raw_image)

# Tailor the demo installer for OS mode or DIAG mode
sed -i -e "s/%%DEMO_TYPE%%/$demo_type/g" \
-e "s/%%ARCH%%/$arch/g" \
-e "s/%%IMAGE_VERSION%%/$image_version/g" \
-e "s/%%ONIE_IMAGE_PART_SIZE%%/$onie_image_part_size/" \
-e "s/%%EXTRA_CMDLINE_LINUX%%/$EXTRA_CMDLINE_LINUX/" \
Expand Down

0 comments on commit cf99295

Please sign in to comment.