Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- config/flash-images/grub/11_linux_scon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/flash-images/grub/11_linux_scon b/config/flash-images/grub/11_linux_scon index df623f470..68f554386 100755 --- a/config/flash-images/grub/11_linux_scon +++ b/config/flash-images/grub/11_linux_scon @@ -227,7 +227,7 @@ while [ "x$list" != "x" ] ; do fi
if [ "x$is_first_entry" = xtrue ]; then - linux_entry "Serial Console: ${OS}" "${version}" simple \ + linux_entry "Serial Console: ${OS}" "${version}" serial \ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} console=ttyS0,115200n8"
submenu_indentation="\t"
This file will detect whether to do certain actions depending on the environment it is running on.
Currently this detects whether IPFire is booting up on AWS EC2 and selects the serial console boot entry.
Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- config/grub2/00_cloud | 26 ++++++++++++++++++++++++++ config/rootfiles/common/aarch64/grub | 1 + config/rootfiles/common/i586/grub | 1 + config/rootfiles/common/x86_64/grub | 1 + lfs/grub | 4 ++++ 5 files changed, 33 insertions(+) create mode 100644 config/grub2/00_cloud
diff --git a/config/grub2/00_cloud b/config/grub2/00_cloud new file mode 100644 index 000000000..3f9c5a185 --- /dev/null +++ b/config/grub2/00_cloud @@ -0,0 +1,26 @@ +#!/bin/sh +# This is an IPFire helper script for GRUB to enable the serial console +# on AWS instances at the time of the first boost + +set -e + +# Do nothing if first boot isn't enabled +if [ "${GRUB_FIRST_BOOT}" != "true" ]; then + exit 0 +fi + +. "${pkgdatadir}/grub-mkconfig_lib" + +if [ -z "${boot_device_id}" ]; then + boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" +fi + +cat <<EOF +# Read the system manufacturer string from the BIOS +smbios --type 1 --get-string 4 --set system_manufacturer + +# Are we on Amazon EC2? +if [ "$system_manufacturer" = "Amazon EC2" ]; then + next_entry=gnulinux-serial-${boot_device_id} +fi +EOF diff --git a/config/rootfiles/common/aarch64/grub b/config/rootfiles/common/aarch64/grub index 2c8951249..ae6bdfec3 100644 --- a/config/rootfiles/common/aarch64/grub +++ b/config/rootfiles/common/aarch64/grub @@ -4,6 +4,7 @@ boot/grub/splash.png #etc/bash_completion.d/grub etc/default/grub #etc/grub.d +etc/grub.d/00_cloud etc/grub.d/00_header etc/grub.d/10_linux etc/grub.d/20_linux_xen diff --git a/config/rootfiles/common/i586/grub b/config/rootfiles/common/i586/grub index 72884a234..74e646150 100644 --- a/config/rootfiles/common/i586/grub +++ b/config/rootfiles/common/i586/grub @@ -5,6 +5,7 @@ boot/grub/splash.png #etc/bash_completion.d/grub etc/default/grub #etc/grub.d +etc/grub.d/00_cloud etc/grub.d/00_header etc/grub.d/10_linux etc/grub.d/20_linux_xen diff --git a/config/rootfiles/common/x86_64/grub b/config/rootfiles/common/x86_64/grub index 8cddfcff9..5450499e3 100644 --- a/config/rootfiles/common/x86_64/grub +++ b/config/rootfiles/common/x86_64/grub @@ -5,6 +5,7 @@ boot/grub/splash.png #etc/bash_completion.d/grub etc/default/grub #etc/grub.d +etc/grub.d/00_cloud etc/grub.d/00_header etc/grub.d/10_linux etc/grub.d/20_linux_xen diff --git a/lfs/grub b/lfs/grub index cc1581306..aed9e6ad8 100644 --- a/lfs/grub +++ b/lfs/grub @@ -125,6 +125,10 @@ ifeq "$(BUILD_PC)" "1" touch /boot/grub/grub.cfg endif
+ # Install our own helpers + install -v -m 644 $(DIR_SRC)/config/grub2/00_cloud \ + /etc/grub.cfg + # Install background image -mkdir -pv /boot/grub install -m 644 $(DIR_SRC)/config/grub2/splash.png /boot/grub/splash.png
Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- lfs/flash-images | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lfs/flash-images b/lfs/flash-images index 72e635073..ca1ffa5e0 100644 --- a/lfs/flash-images +++ b/lfs/flash-images @@ -188,7 +188,8 @@ ifeq "$(BOOTLOADER)" "grub"
# Create configuration mkdir -pv $(MNThdd)/boot/grub - chroot $(MNThdd) grub-mkconfig -o /boot/grub/grub.cfg + GRUB_FIRST_BOOT=true chroot $(MNThdd) \ + grub-mkconfig -o /boot/grub/grub.cfg
# Boot the first kernel by default chroot $(MNThdd) grub-set-default 0
Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- config/grub2/00_cloud | 6 +++++- lfs/flash-images | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/config/grub2/00_cloud b/config/grub2/00_cloud index 3f9c5a185..121cb2fbd 100644 --- a/config/grub2/00_cloud +++ b/config/grub2/00_cloud @@ -11,6 +11,10 @@ fi
. "${pkgdatadir}/grub-mkconfig_lib"
+if [ -z "${KERNEL_RELEASE}" ]; then + KERNEL_RELEASE="$(uname -r)" +fi + if [ -z "${boot_device_id}" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi @@ -21,6 +25,6 @@ smbios --type 1 --get-string 4 --set system_manufacturer
# Are we on Amazon EC2? if [ "$system_manufacturer" = "Amazon EC2" ]; then - next_entry=gnulinux-serial-${boot_device_id} + next_entry=gnulinux-${KERNEL_RELEASE}-serial-${boot_device_id} fi EOF diff --git a/lfs/flash-images b/lfs/flash-images index ca1ffa5e0..cdd0fbf7e 100644 --- a/lfs/flash-images +++ b/lfs/flash-images @@ -188,7 +188,7 @@ ifeq "$(BOOTLOADER)" "grub"
# Create configuration mkdir -pv $(MNThdd)/boot/grub - GRUB_FIRST_BOOT=true chroot $(MNThdd) \ + GRUB_FIRST_BOOT=true KERNEL_RELEASE="$(KVER)-ipfire" chroot $(MNThdd) \ grub-mkconfig -o /boot/grub/grub.cfg
# Boot the first kernel by default