hello!

soekris boxes don't have a 'console', just a serial port. the console option
in grub/menu.lst has been troubling soekris users since a while.

this patch adds an additional config option for "Grub Console Terminal" and
selects appropriate defaults for soekris boards. it also sets the serial port 
speed for soekris to 19200, which matches the default setting of the bios.

with this patch, i think these tickets can be closed:

https://dev.openwrt.org/ticket/4753
https://dev.openwrt.org/ticket/2421

bruno

diff --git a/target/linux/x86/image/Config.in b/target/linux/x86/image/Config.in
index d52ae0c..0a17a40 100644
--- a/target/linux/x86/image/Config.in
+++ b/target/linux/x86/image/Config.in
@@ -2,14 +2,21 @@ config X86_GRUB_IMAGES
     bool "Build GRUB images (Linux x86 or x86_64 host only)"
     depends TARGET_x86 && !TARGET_x86_olpc
     depends TARGET_ROOTFS_EXT2FS || TARGET_ROOTFS_JFFS2 || 
TARGET_ROOTFS_SQUASHFS || 
TARGET_ROOTFS_ISO
-       select PACKAGE_grub
+    select PACKAGE_grub
     default y
 
 config X86_GRUB_IMAGES_PAD
-       bool "Pad GRUB images to filesystem size (for JFFS2)"
-       depends X86_GRUB_IMAGES
+    bool "Pad GRUB images to filesystem size (for JFFS2)"
+    depends X86_GRUB_IMAGES
 
 config X86_GRUB_CONSOLE
+    bool
+    depends X86_GRUB_IMAGES
+    prompt "Use Console Terminal (in addition to Serial)"
+    default n if TARGET_x86_generic_Soekris48xx || 
TARGET_x86_generic_Soekris45xx
+    default y if ! (TARGET_x86_generic_Soekris48xx || 
TARGET_x86_generic_Soekris45xx)
+
+config X86_GRUB_SERIAL_DEVICE
     string
     prompt "Serial port device"
     depends X86_GRUB_IMAGES
@@ -19,7 +26,8 @@ config X86_GRUB_CONSOLE
 config X86_GRUB_BAUDRATE
     int "Serial port baud rate"
     depends X86_GRUB_IMAGES
-    default 38400
+    default 19200 if TARGET_x86_generic_Soekris48xx || 
TARGET_x86_generic_Soekris45xx
+    default 38400 if ! (TARGET_x86_generic_Soekris48xx || 
TARGET_x86_generic_Soekris45xx)
 
 config X86_GRUB_KERNELPART
     int "Kernel partition size (in MB)"
diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index 13712cf..cf4a78f 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -20,8 +20,13 @@ ROOTPART=$(strip $(subst ",, 
$(CONFIG_OLPC_BOOTSCRIPT_ROOTPART)))
 endif
 #"))")) # fix vim's broken syntax highlighting
 
-CONSOLE=$(strip $(subst ",, $(CONFIG_X86_GRUB_CONSOLE)))
+SERIAL_DEVICE=$(strip $(subst ",, $(CONFIG_X86_GRUB_SERIAL_DEVICE)))
 
+ifeq ($(CONFIG_X86_GRUB_CONSOLE),y)
+GRUB_CONSOLE=console
+else
+GRUB_CONSOLE=
+endif
 
 ifeq ($(CONFIG_X86_GRUB_IMAGES),y)
 ifneq ($(HOST_OS),Darwin)
@@ -50,8 +55,9 @@ ifneq ($(HOST_OS),Darwin)
        $(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
        sed \
                -e 's...@cmdline@#$(strip $(call Image/cmdline/$(1))) 
$(BOOTOPTS)#g' \
-               -e 's...@console@#$(CONSOLE)#g' \
+               -e 's...@serial_device@#$(SERIAL_DEVICE)#g' \
                -e 's...@baudrate@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \
+               -e 's...@grub_console@#$(GRUB_CONSOLE)#g' \
                ./menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
        PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(TARGET_PATH)" 
./gen_image_x86.sh 
$(BIN_DIR)/openwrt-$(BOARD)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) 
$(KDIR)/root.grub 
$(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
        $(call Image/Build/grub/$(1))
diff --git a/target/linux/x86/image/menu.lst b/target/linux/x86/image/menu.lst
index e09177c..c1e836d 100644
--- a/target/linux/x86/image/menu.lst
+++ b/target/linux/x86/image/menu.lst
@@ -1,15 +1,15 @@
 serial --unit=0 --spe...@baudrate@ --word=8 --parity=no --stop=1
-terminal --timeout=2 console serial
+terminal --timeout=2 @GRUB_CONSOLE@ serial
 
 default 0
 timeout 5
 
 title   OpenWrt
 root    (hd0,0)
-kernel  /boot/vmlinuz @CMDLINE@ noinitrd console=tty0 
conso...@console@,@baudr...@n8 
reboot=bios
+kernel  /boot/vmlinuz @CMDLINE@ noinitrd conso...@serial_device@,@baudr...@n8 
reboot=bios
 boot
 
 title  OpenWrt (failsafe)
 root   (hd0,0)
-kernel  /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd console=tty0 
conso...@console@,@baudr...@n8 reboot=bios
+kernel  /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd 
conso...@serial_device@,@baudr...@n8 reboot=bios
 boot
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to