changeset 473:eac92c5b7424

Distinguish console setup (qemu vs chroot) based on whether we're running as pid 1, and grep for console= from kernel command line arguments in dmesg, so we don't have to pass CONSOLE= a second time on kernel command line.
author Rob Landley <rob@landley.net>
date Wed, 12 Nov 2008 13:23:37 -0600
parents 726224afbcc9
children ea25a378cde3
files package-mini-native.sh sources/native/bin/qemu-setup.sh
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/package-mini-native.sh	Wed Nov 12 13:18:15 2008 -0600
+++ b/package-mini-native.sh	Wed Nov 12 13:23:37 2008 -0600
@@ -127,7 +127,7 @@
 {
   echo "-nographic -no-reboot \$WITH_HDB" \
        "-hda \"$1\" -kernel \"$2\"" \
-       "-append \"root=/dev/$ROOT console=$CONSOLE CONSOLE=$CONSOLE" \
+       "-append \"root=/dev/$ROOT console=$CONSOLE" \
        "rw init=/tools/bin/qemu-setup.sh panic=1" \
        'PATH=$DISTCC_PATH_PREFIX/tools/bin $KERNEL_EXTRA"' \
 
--- a/sources/native/bin/qemu-setup.sh	Wed Nov 12 13:18:15 2008 -0600
+++ b/sources/native/bin/qemu-setup.sh	Wed Nov 12 13:23:37 2008 -0600
@@ -59,7 +59,7 @@
 echo Type exit when done.
 
 # Switch to a shell with command history.
-if [ -z "$CONSOLE" ]
+if [ $$ -ne 1 ]
 then
   /tools/bin/ash
   cd /
@@ -69,5 +69,5 @@
   umount ./proc
   sync
 else
-  exec /tools/bin/oneit -c /dev/$CONSOLE /tools/bin/ash
+  exec /tools/bin/oneit -c /dev/"$(dmesg | sed -n '/^Kernel command line:/s@.* console=\(/dev/\)*\([^ ]*\).*@\2@p')" /tools/bin/ash
 fi