changeset 361:13e35e130783

Let qemu-setup.sh be called under the name chroot-setup.sh, which skips the qemu-specific setup parts.
author Rob Landley <rob@landley.net>
date Wed, 09 Jul 2008 07:39:59 -0500
parents c9a9b8a25455
children 06f29c81ac8e
files sources/native/bin/chroot-setup.sh sources/native/bin/qemu-setup.sh
diffstat 2 files changed, 31 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/native/bin/chroot-setup.sh	Wed Jul 09 07:39:59 2008 -0500
@@ -0,0 +1,1 @@
+qemu-setup.sh
\ No newline at end of file
--- a/sources/native/bin/qemu-setup.sh	Wed Jul 09 07:38:35 2008 -0500
+++ b/sources/native/bin/qemu-setup.sh	Wed Jul 09 07:39:59 2008 -0500
@@ -1,41 +1,51 @@
 #!/tools/bin/bash
 
-# This builds 
+# If you're doing a Linux From Scratch build, the /tools directory is
+# sufficient.  (Start by installing kernel headers and building a C library.)
+
+# Otherwise, building source packages wants things like /bin/bash and
+# running the results wants /lib/ld-uClibc.so.0, so set up some directories
+# and symlinks to let you easily compile source packages.
 
 # Create some temporary directories at the root level
 mkdir -p /{proc,sys,etc,tmp}
 [ ! -e /bin ] && ln -s /tools/bin /bin
 [ ! -e /lib ] && ln -s /tools/lib /lib
-[ ! -e /usr ] && ln -s /tools /usr
 
 # Populate /dev
 mount -t sysfs /sys /sys
 mount -t tmpfs /dev /dev
 mdev -s
 
-# Setup network for QEMU
+# Mount /proc is there
 mount -t proc /proc /proc
-echo "nameserver 10.0.2.3" > /etc/resolv.conf
-ifconfig eth0 10.0.2.15
-route add default gw 10.0.2.2
+
+# If we're running under qemu, do some more setup
+if [ `echo $0 | sed 's@.*/@@'` == "qemu-setup.sh" ]
+then
 
-# If we have no local clock, you can do this instead:
-#rdate time-b.nist.gov
+  # Note that 10.0.2.2 forwards to 127.0.0.1 on the host.
+
+  # Setup networking for QEMU (needs /proc)
+  echo "nameserver 10.0.2.3" > /etc/resolv.conf
+  ifconfig eth0 10.0.2.15
+  route add default gw 10.0.2.2
 
-# If there's a /dev/hdb or /dev/sdb, mount it on home
+  # If we have no RTC, try rdate instead:
+  [[ `date +%s` < 1000 ]] && rdate 10.0.2.2 # or time-b.nist.gov
+
+  # If there's a /dev/hdb or /dev/sdb, mount it on home
 
-[ -b /dev/hdb ] && HOMEDEV=/dev/hdb
-[ -b /dev/sdb ] && HOMEDEV=/dev/sdb
-if [ ! -z "$HOMEDEV" ]
-then
-  mkdir -p /home
-  mount $HOMEDEV /home
-  export HOME=/home
+  [ -b /dev/hdb ] && HOMEDEV=/dev/hdb
+  [ -b /dev/sdb ] && HOMEDEV=/dev/sdb
+  if [ ! -z "$HOMEDEV" ]
+  then
+    mkdir -p /home
+    mount $HOMEDEV /home
+    export HOME=/home
+  fi
 fi
 
+# Switch to a shell with command history.
 exec /tools/bin/busybox ash
 
-#wget http://landley.net/hg/firmware/archive/tip.tar.gz
-#tar xvzf tip.tar.gz
-#cd firmware-*
-#./build.sh $ARCH