Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 55 additions & 11 deletions board/amd64/grub.cfg
Original file line number Diff line number Diff line change
@@ -1,29 +1,73 @@
set timeout="1"

set default="primary"
set log="loglevel=4"

load_env ORDER DEBUG

if [ -z "$ORDER" ]; then
set ORDER="primary secondary"
fi

set ORDER="$ORDER reboot"

for slot in $ORDER; do
set default="$slot"
break
if [ -z "$default" ]; then
set default="$slot"
else
# Contrary to what the documentation says, GRUB (2.06) does
# not support using titles or IDs in the fallback variable, so
# we translate to indices.
if [ "$slot" = "primary" ]; then
set fallback="$fallback 0"
elif [ "$slot" = "secondary" ]; then
set fallback="$fallback 1"
elif [ "$slot" = "net" ]; then
set fallback="$fallback 2"
elif [ "$slot" = "reboot" ]; then
set fallback="$fallback 3"
fi
fi
done

if [ "$DEBUG" ]; then
set log="debug"
else
set log="loglevel=4"
fi

submenu "primary" "$log" {
set slot="$1"
set append="$2"
set root=(hd0,gpt3)
source /boot/grub/grub.cfg
set slot="$1"
set append="console=ttyS0 root=PARTLABEL=$slot $2"
set root=(hd0,gpt3)
source /boot/grub/grub.cfg
}

submenu "secondary" "$log" {
set slot="$1"
set append="console=ttyS0 root=PARTLABEL=$slot $2"
set root=(hd0,gpt4)
source /boot/grub/grub.cfg
}

submenu "net" "$log" {
net_dhcp

if [ "$net_efinet0_dhcp_next_server" -a "$net_efinet0_dhcp_boot_file" ]; then
set initrd=(tftp,$net_efinet0_dhcp_next_server)/$net_efinet0_dhcp_boot_file
loopback initrd $initrd
set root=(initrd)

set slot="$1"
set append="$2"
set root=(hd0,gpt4)
set append="console=ttyS0 root=/dev/ram ramdisk_size=65536 $2"
source /boot/grub/grub.cfg
else
if [ -z "$net_efinet0_dhcp_next_server" ]; then
echo "No TFTP server supplied in DHCP response"
fi
if [ -z "$net_efinet0_dhcp_boot_file" ]; then
echo "No bootfile supplied in DHCP response"
fi
fi
}

submenu "reboot" {
reboot
}
6 changes: 4 additions & 2 deletions board/amd64/grubenv
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# GRUB Environment Block
# WARNING: Do not edit this file by tools other than grub-editenv!!!
ORDER=primary secondary
ORDER=primary secondary net
primary_OK=1
secondary_OK=1
net_OK=1
primary_TRY=0
secondary_TRY=0
################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
net_TRY=0
#########################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
5 changes: 4 additions & 1 deletion board/amd64/rootfs/boot/grub/grub.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
menuentry "Infix" --id infix {
linux /boot/bzImage root=PARTLABEL=$slot rauc.slot=$slot console=ttyS0 $append nokaslr
linux /boot/bzImage rauc.slot=$slot nokaslr $append
if [ "$initrd" ]; then
initrd $initrd
fi
}
4 changes: 4 additions & 0 deletions board/amd64/rootfs/etc/rauc/system.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ bootname=primary
[slot.rootfs.1]
device=/dev/disk/by-partlabel/secondary
bootname=secondary

[slot.net.0]
device=/dev/ram
bootname=net
2 changes: 1 addition & 1 deletion configs/amd64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ BR2_TARGET_ROOTFS_SQUASHFS=y
BR2_TARGET_EDK2=y
BR2_TARGET_GRUB2=y
BR2_TARGET_GRUB2_X86_64_EFI=y
BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_gpt normal efi_gop configfile loadenv test terminfo terminal echo"
BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 squash4 part_gpt normal efi_gop configfile loadenv test echo reboot net efinet tftp loopback"
BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="${BR2_EXTERNAL_INFIX_PATH}/board/amd64/grub-embed.cfg"
BR2_TARGET_GRUB2_INSTALL_TOOLS=y
BR2_PACKAGE_HOST_DOSFSTOOLS=y
Expand Down