changeset 1728:b89324905ca2

Giant redo to put simple-root-filesystem in initmpfs. NO_NATIVE_COMPILER and NO_ROOTDIRS went away, kernel built moved back into system-image.sh, old root-filesystem.sh and root-image.sh are no longer used, I need to fix up several things (chroot-splice.sh, the lfs-bootstrap build is breaking in mpfr, haven't tested this on all targets yet... but the basics are in.
author Rob Landley <rob@landley.net>
date Fri, 06 Feb 2015 01:51:54 -0600
parents 45c936d93711
children 7c89513343ea
files build.sh config host-tools.sh linux-kernel.sh more/native-build-from-build.sh native-compiler.sh root-image.sh sources/baseconfig-linux sources/functions.sh sources/root-filesystem/init sources/root-filesystem/sbin/init.sh sources/targets/armv4eb sources/targets/armv4l sources/targets/armv4tl sources/targets/armv5l sources/targets/armv6l sources/targets/hw-tct-hammer/miniconfig-linux sources/targets/hw-tct-hammer/settings sources/targets/hw-wrt610n/miniconfig-linux sources/targets/hw-wrt610n/settings sources/targets/i486 sources/targets/i586 sources/targets/i686 sources/targets/i686-virtio/settings sources/targets/m68k sources/targets/mips sources/targets/mips64 sources/targets/mipsel sources/targets/powerpc sources/targets/powerpc-virtio/settings sources/targets/sh2eb sources/targets/sh4 sources/targets/sparc sources/targets/x86_64 sources/toys/dev-environment.sh sources/toys/native-build.sh system-image.sh
diffstat 37 files changed, 82 insertions(+), 437 deletions(-) [+]
line wrap: on
line diff
--- a/build.sh	Sun Jan 11 12:01:30 2015 -0600
+++ b/build.sh	Fri Feb 06 01:51:54 2015 -0600
@@ -4,22 +4,13 @@
 
 # The default set of stages run by this script is (in order):
 #   download, host-tools, simple-cross-compiler, simple-root-filesystem,
-#   native-compiler, root-filesystem, system-image.
+#   native-compiler, system-image.
 
 # That sanitizes the host build environment and builds a cross compiler,
 # cross compiles a root filesystem and a native toolchain for the target,
 # and finally packages the root filesystem up into a system image bootable
 # by qemu.
 
-# The simplest set of stages is:
-#   download, simple-cross-compiler, simple-root-filesystem, system-image.
-#
-# That skips sanitizing the host environment, and skips building the native
-# compiler.  It builds a system image containing just enough code to boot to
-# a command prompt.  To invoke that, do:
-#
-#   NO_HOST_TOOLS=1 NO_NATIVE_COMPILER=1 ./build.sh $TARGET
-
 # The optional cross-compiler stage (after simple-cross-compiler but before
 # simple-root-filesystem) creates a more powerful and portable cross compiler
 # that can be used to cross compile more stuff (if you're into that sort of
@@ -29,6 +20,9 @@
 
 # Where "i686" is whichever target you want the new cross compiler to run on.
 
+# The simplest set of stages (if you run them yourself) is:
+#   download, simple-cross-compiler, simple-root-filesystem, system-image.
+
 # If this script was run with no arguments, list available architectures
 
 [ ! -z "$2" ] && REBUILD="$2"
@@ -134,10 +128,8 @@
 
 if not_already simple-root-filesystem
 then
-  # If we need to build root filesystem, assume root-filesystem and
-  # root-image are stale.
-
-  zap root-filesystem root-image
+  zap system-image
+  [ "$SYSIMAGE_TYPE" == rootfs ] && zap linux-kernel
 
   time ./simple-root-filesystem.sh "$ARCH" || exit 1
 fi
@@ -145,39 +137,11 @@
 # Build a native compiler.  It's statically linked by default so it can
 # run on an arbitrary host system.
 
-if not_already native-compiler && [ -z "$NO_NATIVE_COMPILER" ]
-then
-  zap root-filesystem root-image
-
-  time ./native-compiler.sh "$ARCH" || exit 1
-fi
-
-# Install the native compiler into the root filesystem, if necessary.
-
-if not_already root-filesystem && [ -z "$NO_NATIVE_COMPILER" ]
-then
-  zap root-image
-
-  time ./root-filesystem.sh "$ARCH" || exit 1
-fi
-
-# Create filesystem image from [simple-]root-filesystem directory
-
-if not_already root-image
-then
-  zap system-image
-  [ "$SYSIMAGE_TYPE" == initramfs ] && zap linux-kernel
-
-  time ./root-image.sh "$ARCH" || exit 1
-fi
-
-# Build a kernel.  (Possibly includes cpio file for initramfs image type.)
-
-if not_already linux-kernel
+if not_already native-compiler
 then
   zap system-image
 
-  time ./linux-kernel.sh "$ARCH" || exit 1
+  time ./native-compiler.sh "$ARCH" || exit 1
 fi
 
 # Package it all up into something qemu can boot.
--- a/config	Sun Jan 11 12:01:30 2015 -0600
+++ b/config	Fri Feb 06 01:51:54 2015 -0600
@@ -18,11 +18,6 @@
 
 # export NO_SANITIZE_ENVIRONMENT=1
 
-# Setting this tells build.sh not to build a native toolchain. (This yields
-# a much smaller root-filesystem tarball.)
-
-# export NO_NATIVE_COMPILER=1
-
 # Setting this tells build.sh to use the existing $PATH commands to build
 # everything, which probably won't work out of the box. Cross compiling is
 # an insanely delicate process which requires a carefully configured host
@@ -52,10 +47,10 @@
 
 # export NO_CPLUSPLUS=1
 
-# What kind of root filesystem to create: ext2, initramfs, or squashfs.
-# It defaults to squashfs if blank.
+# What kind of root filesystem to create: ext2, rootfs (combined initramfs),
+# cpio (separate initramfs), or squashfs. It defaults to cpio if blank.
 
-# export SYSIMAGE_TYPE=squashfs
+# export SYSIMAGE_TYPE=cpio
 
 # Size of writeable (ext2) HDA image. Does not apply to squashfs or initramfs
 
--- a/host-tools.sh	Sun Jan 11 12:01:30 2015 -0600
+++ b/host-tools.sh	Fri Feb 06 01:51:54 2015 -0600
@@ -196,8 +196,7 @@
 
 # Squashfs is the default packaging option.
 
-if [ ! -f "${STAGE_DIR}"/mksquashfs ] &&
-  ([ -z "$SYSIMAGE_TYPE" ] || [ "$SYSIMAGE_TYPE" == squashfs ])
+if [ ! -f "${STAGE_DIR}"/mksquashfs ]
 then
   setupfor zlib &&
   ./configure &&
--- a/linux-kernel.sh	Sun Jan 11 12:01:30 2015 -0600
+++ b/linux-kernel.sh	Fri Feb 06 01:51:54 2015 -0600
@@ -10,19 +10,15 @@
 
 setupfor linux
 
-# Get miniconfig. If we have an initramfs, incorporate it into the kernel image.
+# Build linux kernel for the target
 
 getconfig linux > mini.conf
-CPIO="$BUILD/root-image-$ARCH/hda.cpio"
-[ -e "$CPIO" ] &&
-  echo -e "CONFIG_BLK_DEV_INITRD=y\nCONFIG_INITRAMFS_SOURCE=\"$CPIO\"\nCONFIG_INITRAMFS_COMPRESSION_GZIP=y" >> mini.conf
-
-# Build linux kernel for the target
-
-[ -z "$BOOT_KARCH" ] && BOOT_KARCH=$KARCH
-make ARCH=$BOOT_KARCH $LINUX_FLAGS KCONFIG_ALLCONFIG=mini.conf allnoconfig \
-  >/dev/null &&
-make -j $CPUS ARCH=$BOOT_KARCH $DO_CROSS $LINUX_FLAGS $VERBOSITY &&
+[ "$SYSIMAGE_TYPE" == rootfs ] &&
+  echo -e "CONFIG_INITRAMFS_SOURCE=\"$BUILD/rootfs-$ARCH.cpio\"\n" \
+    >> mini.conf
+make ARCH=${BOOT_KARCH:-$KARCH} $LINUX_FLAGS KCONFIG_ALLCONFIG=mini.conf \
+  allnoconfig >/dev/null &&
+make -j $CPUS ARCH=${BOOT_KARCH:-$KARCH} $DO_CROSS $LINUX_FLAGS $VERBOSITY &&
 cp "$KERNEL_PATH" "$STAGE_DIR"
 
 cleanup
--- a/more/native-build-from-build.sh	Sun Jan 11 12:01:30 2015 -0600
+++ b/more/native-build-from-build.sh	Fri Feb 06 01:51:54 2015 -0600
@@ -3,7 +3,15 @@
 # Run native build out of build directory, using host-tools.sh if
 # available.
 
-PATH="$(pwd)/build/host:$PATH"
+SYSIMG="build/system-image-$1"
+
+if [ ! -e "$SYSIMG" ]
+then
+  echo "no $SYSIMG" >&2
+  exit 1
+fi
+
+PATH="$PWD/build/host:$PWD/build/native-compiler-$1:$PATH"
 
 X=$(readlink -f "$2" 2>/dev/null)
 if [ -z "$X" ]
@@ -12,4 +20,4 @@
   exit 1
 fi
 
-cd build/system-image-"$1" && ./native-build.sh "$X"
+cd "$SYSIMG" && ./native-build.sh "$X"
--- a/native-compiler.sh	Sun Jan 11 12:01:30 2015 -0600
+++ b/native-compiler.sh	Fri Feb 06 01:51:54 2015 -0600
@@ -12,6 +12,8 @@
 source sources/include.sh && load_target "$1" || exit 1
 check_for_base_arch || exit 0
 
+STAGE_DIR="$STAGE_DIR/usr"
+
 check_prerequisite "${ARCH}-cc"
 
 [ -z "$HOST_ARCH" ] && HOST_ARCH="$ARCH" || check_prerequisite "${HOST_ARCH}-cc"
@@ -53,9 +55,14 @@
   build_section distcc
 fi
 
-# Delete some unneeded files
+# Delete some unneeded files and strip everything else
 
-[ -z "$SKIP_STRIP" ] &&
+if [ -z "$SKIP_STRIP" ]
+then
   rm -rf "$STAGE_DIR"/{info,man,libexec/gcc/*/*/install-tools}
+  "${ARCH}-strip" --strip-unneeded "$STAGE_DIR"/lib/*.so
+  "${ARCH}-strip" "$STAGE_DIR"/{bin/*,sbin/*}
+fi
+
 
 create_stage_tarball
--- a/root-image.sh	Sun Jan 11 12:01:30 2015 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#!/bin/bash
-
-# Package a root filesystem directory into a filesystem image file
-
-source sources/include.sh || exit 1
-
-# Parse sources/targets/$1
-
-load_target "$1"
-
-check_for_base_arch || exit 0
-
-# Which directory do we package up?
-
-if [ -z "$NATIVE_ROOT" ]
-then
-  [ -z "$NO_NATIVE_COMPILER" ] &&
-    NATIVE_ROOT="$BUILD/root-filesystem-$ARCH"
-
-  [ -e "$NATIVE_ROOT" ] ||
-    NATIVE_ROOT="$BUILD/simple-root-filesystem-$ARCH"
-fi
-
-if [ ! -d "$NATIVE_ROOT" ]
-then
-  [ -z "$FAIL_QUIET" ] && echo No "$NATIVE_ROOT" >&2
-  exit 1
-fi
-
-[ -z "$SYSIMAGE_TYPE" ] && SYSIMAGE_TYPE=squashfs
-
-echo "Generating $SYSIMAGE_TYPE root filesystem from $NATIVE_ROOT."
-
-SYSIMAGE_TYPE="$SYSIMAGE_TYPE" image_filesystem "$NATIVE_ROOT" "$STAGE_DIR/hda"
-
-create_stage_tarball
-
-echo Image generation complete.
--- a/sources/baseconfig-linux	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/baseconfig-linux	Fri Feb 06 01:51:54 2015 -0600
@@ -45,6 +45,8 @@
 CONFIG_SQUASHFS_ZLIB=y
 CONFIG_SQUASHFS_FILE_DIRECT=y
 CONFIG_DEVTMPFS=y
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_COMPRESSION_GZIP=y
 
 CONFIG_VIRTUALIZATION=y
 CONFIG_VIRTIO_PCI=y
--- a/sources/functions.sh	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/functions.sh	Fri Feb 06 01:51:54 2015 -0600
@@ -378,7 +378,7 @@
 {
   # Embed an initramfs cpio
 
-  if [ "$SYSIMAGE_TYPE" == "cpio" ] || [ "$SYSIMAGE_TYPE" == "initramfs" ]
+  if [ "$SYSIMAGE_TYPE" == "cpio" ] || [ "$SYSIMAGE_TYPE" == "rootfs" ]
   then
     # Borrow gen_init_cpio.c out of package cache copy of Linux source
     extract_package linux &&
@@ -390,7 +390,7 @@
           echo "slink /init /sbin/init.sh 755 0 0"
         [ ! -d "$1"/dev ] && echo "dir /dev 755 0 0"
         echo "nod /dev/console 660 0 0 c 5 1"
-      ) > "$2.cpio" || dienow
+      ) | gzip -9 > "$2.cpio.gz" || dienow
     echo Initramfs generated.
 
   elif [ "$SYSIMAGE_TYPE" == "ext2" ] || [ "$SYSIMAGE_TYPE" == "ext3" ]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/root-filesystem/init	Fri Feb 06 01:51:54 2015 -0600
@@ -0,0 +1,1 @@
+sbin/init.sh
\ No newline at end of file
--- a/sources/root-filesystem/sbin/init.sh	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/root-filesystem/sbin/init.sh	Fri Feb 06 01:51:54 2015 -0600
@@ -1,6 +1,7 @@
 #!/bin/ash
 
 export HOME=/home
+export PATH=/bin:/sbin
 
 # Populate /dev
 mountpoint -q proc || mount -t proc proc proc
@@ -17,10 +18,6 @@
 fi
 export PS1='($HOST:$CPUS) \w \$ '
 
-# Make sure $PATH is exported, even if not set on kernel command line.
-# (The shell gives us a default, but it's local, not exported.)
-export PATH
-
 # If we're running under qemu, do some more setup
 if [ $$ -eq 1 ]
 then
@@ -36,6 +33,13 @@
 
   mount -t tmpfs /tmp /tmp
 
+  if [ -b /dev/[hsv]da ]
+  then
+    mkdir -p /usr/hda
+    mount /dev/[hsv]da /usr/hda
+    cp -rs /usr/hda/. /
+  fi
+
   # If there's a /dev/hdb or /dev/sdb, mount it on home, else tmpfs
 
   [ -b /dev/[hsv]db ] && HOMEDEV=/dev/[hsv]db
--- a/sources/targets/armv4eb	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/armv4eb	Fri Feb 06 01:51:54 2015 -0600
@@ -12,7 +12,6 @@
 BINUTILS_FLAGS=
 QEMU_TEST=$KARCH
 
-ROOT=sda
 CONSOLE=ttyAMA0
 
 UCLIBC_CONFIG="TARGET_arm=y"
--- a/sources/targets/armv4l	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/armv4l	Fri Feb 06 01:51:54 2015 -0600
@@ -17,7 +17,6 @@
 BINUTILS_FLAGS=
 QEMU_TEST=$KARCH
 
-ROOT=sda
 CONSOLE=ttyAMA0
 
 UCLIBC_CONFIG="
--- a/sources/targets/armv4tl	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/armv4tl	Fri Feb 06 01:51:54 2015 -0600
@@ -18,7 +18,6 @@
 
 CROSS_TARGET=armv4tl-unknown-linux-gnueabi
 
-ROOT=sda
 CONSOLE=ttyAMA0
 
 # This is every bit as ugly as it looks, because it's for gcc.
--- a/sources/targets/armv5l	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/armv5l	Fri Feb 06 01:51:54 2015 -0600
@@ -14,7 +14,6 @@
 
 CROSS_TARGET=armv5l-unknown-linux-gnueabi
 
-ROOT=sda
 CONSOLE=ttyAMA0
 
 UCLIBC_CONFIG="
--- a/sources/targets/armv6l	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/armv6l	Fri Feb 06 01:51:54 2015 -0600
@@ -15,7 +15,6 @@
 
 CROSS_TARGET="armv6l-unknown-linux-gnueabi"
 
-ROOT=sda
 CONSOLE=ttyAMA0
 
 UCLIBC_CONFIG="
--- a/sources/targets/hw-tct-hammer/miniconfig-linux	Sun Jan 11 12:01:30 2015 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-CONFIG_EXPERIMENTAL=y
-CONFIG_SYSVIPC=y
-CONFIG_GROUP_SCHED=y
-CONFIG_FAIR_GROUP_SCHED=y
-CONFIG_SYSFS_DEPRECATED_V2=y
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_EMBEDDED=y
-CONFIG_UID16=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_HOTPLUG=y
-CONFIG_PRINTK=y
-CONFIG_COMPAT_BRK=y
-CONFIG_BASE_FULL=y
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-CONFIG_SIGNALFD=y
-CONFIG_TIMERFD=y
-CONFIG_EVENTFD=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_SLOB=y
-CONFIG_PROC_PAGE_MONITOR=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_BLOCK=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
-CONFIG_ARCH_S3C2410=y
-CONFIG_MACH_TCT_HAMMER=y
-CONFIG_CPU_ARM920T=y
-CONFIG_ARM_THUMB=y
-CONFIG_CMDLINE="mem=64M root=/dev/ram0 init=/linuxrc rw"
-CONFIG_FPE_NWFPE=y
-CONFIG_BINFMT_ELF=y
-CONFIG_NET=y
-CONFIG_PACKET=y
-CONFIG_UNIX=y
-CONFIG_STANDALONE=y
-CONFIG_FW_LOADER=y
-CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLOCK=y
-CONFIG_MTD_CFI=y
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-CONFIG_MTD_CFI_GEOMETRY=y
-CONFIG_MTD_MAP_BANK_WIDTH_1=y
-CONFIG_MTD_MAP_BANK_WIDTH_2=y
-CONFIG_MTD_MAP_BANK_WIDTH_4=y
-CONFIG_MTD_CFI_I1=y
-CONFIG_MTD_CFI_I2=y
-CONFIG_MTD_CFI_INTELEXT=y
-CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_PHYSMAP_START=0x00000000
-CONFIG_BLK_DEV=y
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=10240
-CONFIG_VT=y
-CONFIG_SERIAL_S3C2410=y
-CONFIG_SERIAL_S3C2410_CONSOLE=y
-CONFIG_UNIX98_PTYS=y
-CONFIG_LEGACY_PTYS=y
-CONFIG_USB_SUPPORT=y
-CONFIG_USB=y
-CONFIG_USB_DEBUG=y
-CONFIG_USB_OHCI_HCD=y
-CONFIG_USB_MON=y
-CONFIG_USB_GADGET=y
-CONFIG_USB_GADGET_S3C2410=y
-CONFIG_USB_ETH=y
-CONFIG_USB_ETH_RNDIS=y
-CONFIG_EXT2_FS=y
-CONFIG_MSDOS_FS=y
-CONFIG_VFAT_FS=y
-CONFIG_PROC_FS=y
-CONFIG_SYSFS=y
-CONFIG_JFFS2_FS=y
-CONFIG_JFFS2_FS_WRITEBUFFER=y
-CONFIG_NETWORK_FILESYSTEMS=y
-CONFIG_NLS_CODEPAGE_437=y
-CONFIG_NLS_ISO8859_1=y
-CONFIG_ENABLE_WARN_DEPRECATED=y
-CONFIG_DEBUG_KERNEL=y
-CONFIG_SCHED_DEBUG=y
-CONFIG_DEBUG_ERRORS=y
-CONFIG_DEBUG_LL=y
-CONFIG_CRC_CCITT=y
--- a/sources/targets/hw-tct-hammer/settings	Sun Jan 11 12:01:30 2015 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-DESCRIPTION="
-The Tin Can Tools hammer board is an ARM920T system on a chip, with 32 megs
-DRAM and 16 megs flash, and several integrated peripherals.
-
-See http://www.tincantools.com/product.php?productid=16133 for the hammer
-board and http://www.tincantools.com/product.php?productid=16143 for the
-\"nail board\" (a USB-powered mounting kit for the hammer).
-"
-
-base_architecture armv4tl
--- a/sources/targets/hw-wrt610n/miniconfig-linux	Sun Jan 11 12:01:30 2015 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-CONFIG_BCM47XX=y
-CONFIG_UNEVICTABLE_LRU=y
-CONFIG_NO_HZ=y
-CONFIG_HIGH_RES_TIMERS=y
-CONFIG_HZ_100=y
-CONFIG_SECCOMP=y
-CONFIG_EXPERIMENTAL=y
-CONFIG_SWAP=y
-CONFIG_SYSVIPC=y
-CONFIG_GROUP_SCHED=y
-CONFIG_FAIR_GROUP_SCHED=y
-CONFIG_SYSFS_DEPRECATED_V2=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=y
-CONFIG_HOTPLUG=y
-CONFIG_PRINTK=y
-CONFIG_BUG=y
-CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
-CONFIG_BASE_FULL=y
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-CONFIG_SIGNALFD=y
-CONFIG_TIMERFD=y
-CONFIG_EVENTFD=y
-CONFIG_SHMEM=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_BLOCK=y
-CONFIG_PCI=y
-CONFIG_PCI_LEGACY=y
-CONFIG_BINFMT_ELF=y
-CONFIG_PM=y
-CONFIG_NET=y
-CONFIG_PACKET=y
-CONFIG_PACKET_MMAP=y
-CONFIG_UNIX=y
-CONFIG_INET=y
-CONFIG_INET_XFRM_MODE_TRANSPORT=y
-CONFIG_INET_XFRM_MODE_TUNNEL=y
-CONFIG_INET_XFRM_MODE_BEET=y
-CONFIG_INET_DIAG=y
-CONFIG_IPV6=y
-CONFIG_INET6_XFRM_MODE_TRANSPORT=y
-CONFIG_INET6_XFRM_MODE_TUNNEL=y
-CONFIG_INET6_XFRM_MODE_BEET=y
-CONFIG_IPV6_SIT=y
-CONFIG_STANDALONE=y
-CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_CONNECTOR=y
-CONFIG_PROC_EVENTS=y
-CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
-CONFIG_MTD_CFI=y
-CONFIG_MTD_JEDECPROBE=y
-CONFIG_BLK_DEV=y
-CONFIG_BLK_DEV_LOOP=y
-CONFIG_NETDEVICES=y
-CONFIG_NET_ETHERNET=y
-CONFIG_NET_PCI=y
-CONFIG_PCNET32=y
-CONFIG_INPUT=y
-CONFIG_SERIO=y
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_PCI=y
-CONFIG_UNIX98_PTYS=y
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=8
-CONFIG_HW_RANDOM=y
-CONFIG_SSB_PCIHOST=y
-CONFIG_SSB_DRIVER_PCICORE=y
-CONFIG_HID_SUPPORT=y
-CONFIG_HID=y
-CONFIG_USB_SUPPORT=y
-CONFIG_DNOTIFY=y
-CONFIG_INOTIFY=y
-CONFIG_INOTIFY_USER=y
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_PROC_SYSCTL=y
-CONFIG_PROC_PAGE_MONITOR=y
-CONFIG_SYSFS=y
-CONFIG_TMPFS=y
-CONFIG_CRYPTO_HW=y
-CONFIG_FILE_LOCKING=y
-CONFIG_MISC_FILESYSTEMS=y
-CONFIG_SQUASHFS=y
--- a/sources/targets/hw-wrt610n/settings	Sun Jan 11 12:01:30 2015 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-DESCRIPTION="
-Linksys WRT610n.
-
-A small blue mips-based router.
-
-This doesn't actually work yet, because the kernel doesn't fully support this
-hardware without more patches, and trx image packaging needs an additional
-32 byte header before the router's installer and bootloader will accept it.
-
-TODO
-
-See http://www.linksysbycisco.com/US/en/products/WRT610N
-"
-
-base_architecture mipsel
-
-KERNEL_PATH=arch/mips/boot/vmlinux.bin
-LINUX_FLAGS=vmlinux.bin
--- a/sources/targets/i486	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/i486	Fri Feb 06 01:51:54 2015 -0600
@@ -15,7 +15,6 @@
 GCC_FLAGS=
 QEMU_TEST=$KARCH
 
-ROOT=hda
 CONSOLE=ttyS0
 
 UCLIBC_CONFIG="
--- a/sources/targets/i586	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/i586	Fri Feb 06 01:51:54 2015 -0600
@@ -13,7 +13,6 @@
 GCC_FLAGS=
 QEMU_TEST=$KARCH
 
-ROOT=hda
 CONSOLE=ttyS0
 
 UCLIBC_CONFIG="
--- a/sources/targets/i686	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/i686	Fri Feb 06 01:51:54 2015 -0600
@@ -7,7 +7,6 @@
 QEMU_TEST=$KARCH
 
 CONSOLE=ttyS0
-ROOT=hda
 
 UCLIBC_CONFIG="
 ARCH_HAS_MMU=y
--- a/sources/targets/i686-virtio/settings	Sun Jan 11 12:01:30 2015 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-DESCRIPTION="
-Variant of i686 target using virtio and (if possible) kvm (different kernel/emulator config).
-"
-
-# Use the i686 base architecture
-
-base_architecture i686
-
-ROOT=vda
-CONSOLE=ttyS0
-
-LINUX_CONFIG="
-CONFIG_MPENTIUMII=y
-CONFIG_ACPI=y
-
-# VIRTIO_CONSOLE not used yet
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_VIRTIO_CONSOLE=y
-
-CONFIG_HW_RANDOM_VIRTIO=y
-CONFIG_PARAVIRT_GUEST=y
-CONFIG_VIRTIO_BLK=y
-CONFIG_KVM_CLOCK=y
-CONFIG_KVM_GUEST=y
-"
-
-emulator_command()
-{
-  echo "[ ! -z \"\$HDC\" ] && QEMU_EXTRA=\" -drive file=\$HDC,if=virtio,index=2 \$QEMU_EXTRA\""
-  echo "[ ! -z \"\$HDB\" ] && QEMU_EXTRA=\" -drive file=\$HDB,if=virtio,index=1 \$QEMU_EXTRA\""
-  echo -n "qemu-system-i386 -nographic -no-reboot -kernel $KERNEL"
-  [ "$SYSIMAGE_TYPE" != "initramfs" ] && echo -n " -drive file=$IMAGE,if=virtio,index=0"
-  echo -n " -append \"$(kernel_cmdline)\" \$QEMU_EXTRA -net nic,model=virtio -net user"
-}
--- a/sources/targets/m68k	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/m68k	Fri Feb 06 01:51:54 2015 -0600
@@ -18,7 +18,6 @@
 BINUTILS_FLAGS=
 QEMU_TEST= #$KARCH
 
-ROOT=sda
 CONSOLE=ttyS0
 
 UCLIBC_CONFIG="
--- a/sources/targets/mips	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/mips	Fri Feb 06 01:51:54 2015 -0600
@@ -6,7 +6,6 @@
 GCC_FLAGS=
 QEMU_TEST=mips
 
-ROOT=hda
 CONSOLE=ttyS0
 
 UCLIBC_CONFIG="
--- a/sources/targets/mips64	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/mips64	Fri Feb 06 01:51:54 2015 -0600
@@ -6,7 +6,6 @@
 GCC_FLAGS=
 QEMU_TEST=mips64
 
-ROOT=hda
 CONSOLE=ttyS0
 
 UCLIBC_CONFIG="
--- a/sources/targets/mipsel	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/mipsel	Fri Feb 06 01:51:54 2015 -0600
@@ -6,7 +6,6 @@
 GCC_FLAGS=
 QEMU_TEST=mipsel
 
-ROOT=hda
 CONSOLE=ttyS0
 
 UCLIBC_CONFIG="
--- a/sources/targets/powerpc	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/powerpc	Fri Feb 06 01:51:54 2015 -0600
@@ -18,7 +18,6 @@
 BINUTILS_FLAGS=
 QEMU_TEST=ppc
 
-ROOT=hda
 CONSOLE=ttyS0
 
 UCLIBC_CONFIG="
--- a/sources/targets/powerpc-virtio/settings	Sun Jan 11 12:01:30 2015 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-DESCRIPTION="
-Variant of powerpc target using virtio and (if possible) kvm (different kernel/emulator config).
-"
-
-base_architecture powerpc
-
-ROOT=vda
-CONSOLE=ttyS0
-
-LINUX_CONFIG="
-CONFIG_ALTIVEC=y
-CONFIG_PPC_PMAC=y
-CONFIG_PPC_OF_BOOT_TRAMPOLINE=y
-CONFIG_PPC601_SYNC_FIX=y
-CONFIG_PROC_DEVICETREE=y
-CONFIG_MACINTOSH_DRIVERS=y
-CONFIG_ADB=y
-CONFIG_ADB_CUDA=y
-CONFIG_SERIO=y
-CONFIG_SERIAL_PMACZILOG=y
-CONFIG_SERIAL_PMACZILOG_TTYS=y
-CONFIG_SERIAL_PMACZILOG_CONSOLE=y
-CONFIG_BOOTX_TEXT=y
-CONFIG_VIRTIO_CONSOLE=y
-CONFIG_HW_RANDOM_VIRTIO=y
-CONFIG_PARAVIRT_GUEST=y
-CONFIG_VIRTIO_BLK=y
-CONFIG_KVM_CLOCK=y
-CONFIG_KVM_GUEST=y
-"
-
-emulator_command()
-{
-  echo "[ ! -z \"\$HDC\" ] && QEMU_EXTRA=\" -drive file=\$HDC,if=virtio,index=2 \$QEMU_EXTRA\""
-  echo "[ ! -z \"\$HDB\" ] && QEMU_EXTRA=\" -drive file=\$HDB,if=virtio,index=1 \$QEMU_EXTRA\""
-  echo -n "qemu-system-ppc -M g3beige -nographic -no-reboot -kernel $KERNEL"
-  [ "$SYSIMAGE_TYPE" != "initramfs" ] && echo -n " -drive file=$IMAGE,if=virtio,index=0"
-  echo -n " -append \"$(kernel_cmdline)\" \$QEMU_EXTRA -net nic,model=virtio -net user"
-}
--- a/sources/targets/sh2eb	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/sh2eb	Fri Feb 06 01:51:54 2015 -0600
@@ -10,7 +10,6 @@
 QEMU_TEST=$KARCH
 #CROSS_TARGET=sh2-unknown-linux
 
-ROOT=sda
 CONSOLE="ttySC1 noiotrap"
 
 UCLIBC_CONFIG="
--- a/sources/targets/sh4	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/sh4	Fri Feb 06 01:51:54 2015 -0600
@@ -13,7 +13,6 @@
 QEMU_TEST=$KARCH
 CROSS_TARGET=sh-superh-linux
 
-ROOT=sda
 CONSOLE="ttySC1 noiotrap"
 
 UCLIBC_CONFIG="
--- a/sources/targets/sparc	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/sparc	Fri Feb 06 01:51:54 2015 -0600
@@ -18,7 +18,6 @@
 
 #BUILD_STATIC=all
 
-ROOT=sda
 CONSOLE=ttyS0
 
 UCLIBC_CONFIG="
--- a/sources/targets/x86_64	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/targets/x86_64	Fri Feb 06 01:51:54 2015 -0600
@@ -10,7 +10,6 @@
 BINUTILS_FLAGS="--enable-64-bit-bfd"
 QEMU_TEST=
 
-ROOT=hda
 CONSOLE=ttyS0
 
 UCLIBC_CONFIG="
--- a/sources/toys/dev-environment.sh	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/toys/dev-environment.sh	Fri Feb 06 01:51:54 2015 -0600
@@ -10,6 +10,7 @@
 
 # The following environment variables affect the behavior of this script:
 
+# HDA - Image file to use for -hda on /usr/hda (spliced into / with cp -s)
 # HDB - Image file to use for -hdb on /home (creates a new hdb.img if blank)
 # HDBMEGS - Size (in decimal megabytes) when creating hdb.img
 # HDC - Image file to use for -hdc on /mnt (none of blank)
@@ -23,6 +24,8 @@
 [ -z "$QEMU_MEMORY" ] && QEMU_MEMORY=256
 QEMU_EXTRA="-m $QEMU_MEMORY $QEMU_EXTRA"
 
+[ -z "$HDA" ] && HDA=toolchain.sqf
+
 # Should we set up an ext3 image as a second virtual hard drive for /home?
 
 if [ "$HDBMEGS" != "0" ]
@@ -127,5 +130,6 @@
 
 [ ! -z "$HDC" ] && QEMU_EXTRA="-hdc $HDC $QEMU_EXTRA"
 [ ! -z "$HDB" ] && QEMU_EXTRA="-hdb $HDB $QEMU_EXTRA"
+[ ! -z "$HDA" ] && QEMU_EXTRA="-hda $HDA $QEMU_EXTRA"
 
 run_emulator
--- a/sources/toys/native-build.sh	Sun Jan 11 12:01:30 2015 -0600
+++ b/sources/toys/native-build.sh	Fri Feb 06 01:51:54 2015 -0600
@@ -21,14 +21,6 @@
 fi
 HDCFILE="$(readlink -f $1)"
 
-TOP="$(pwd)"
-
-# If we're running from the build directory, add build/host and cross compiler
-# to the path.
-
-[ -d ../host ] &&
-  PATH="$TOP/../host:$TOP/../cross-compiler-$1/bin:$TOP/../simple-cross-compiler-$1/bin:$PATH"
-
 INCLUDE unique-port.sh
 
 # Do we already have an FTP daemon?
--- a/system-image.sh	Sun Jan 11 12:01:30 2015 -0600
+++ b/system-image.sh	Fri Feb 06 01:51:54 2015 -0600
@@ -2,35 +2,22 @@
 
 # Combine a filesystem image and kernel with emulator launch scripts.
 
+# Package a root filesystem directory into a filesystem image file
+
 source sources/include.sh || exit 1
 
 # Parse sources/targets/$1
 
 load_target "$1"
 
-cd "$BUILD/linux-kernel-$ARCH_NAME" &&
-KERNEL="$(ls)" &&
-ln "$KERNEL" "$STAGE_DIR" &&
-cd "$BUILD/root-image-$ARCH" &&
-IMAGE="$(ls)" &&
-ln "$IMAGE" "$STAGE_DIR" || dienow
-
 # Provide qemu's common command line options between architectures.
 
-kernel_cmdline()
-{
-  [ "$SYSIMAGE_TYPE" != "initramfs" ] &&
-    echo -n "root=/dev/$ROOT rw init=/sbin/init.sh "
-
-  echo -n "panic=1 PATH=\$DISTCC_PATH_PREFIX/bin:/sbin console=$CONSOLE"
-  echo -n " HOST=$ARCH ${KERNEL_EXTRA}\$KERNEL_EXTRA"
-}
-
 qemu_defaults()
 {
-  echo -n "-nographic -no-reboot -kernel $KERNEL"
-  [ "$SYSIMAGE_TYPE" != "initramfs" ] && echo -n " -hda $IMAGE"
-  echo -n " -append \"$(kernel_cmdline)\" \$QEMU_EXTRA"
+  echo -n "-nographic -no-reboot -kernel linux"
+  [ "$SYSIMAGE_TYPE" != "rootfs" ] && echo -n " -initrd rootfs.cpio.gz"
+  echo -n " -append \"panic=1 console=$CONSOLE HOST=$ARCH $KERNEL_EXTRA\""
+  echo -n " \$QEMU_EXTRA"
 }
 
 # Write out a script to call the appropriate emulator.  We split out the
@@ -58,7 +45,7 @@
 
 # Write out development wrapper scripts, substituting INCLUDE lines.
 
-[ -z "$NO_NATIVE_COMPILER" ] && for FILE in dev-environment.sh native-build.sh
+for FILE in dev-environment.sh native-build.sh
 do
   (export IFS="$(echo -e "\n")"
    cat "$SOURCES/toys/$FILE" | while read -r i
@@ -76,6 +63,26 @@
   chmod +x "$STAGE_DIR/$FILE" || dienow
 done
 
+# Package simple-root-filesystem into cpio file for initramfs
+
+SYSIMAGE_TYPE=cpio image_filesystem "$BUILD/simple-root-filesystem-$ARCH" \
+  "$STAGE_DIR/rootfs" &&
+SYSIMAGE_TYPE=squashfs image_filesystem "$BUILD/native-compiler-$ARCH" \
+  "$STAGE_DIR/toolchain" || dienow
+
+# Build linux kernel for the target
+
+setupfor linux
+getconfig linux > mini.conf
+[ "$SYSIMAGE_TYPE" == rootfs ] &&
+  echo -e "CONFIG_INITRAMFS_SOURCE=\"$BUILD/simple-root-filesystem-$ARCH/rootfs.cpio.gz\"\n" \
+    >> mini.conf
+make ARCH=${BOOT_KARCH:-$KARCH} $LINUX_FLAGS KCONFIG_ALLCONFIG=mini.conf \
+  allnoconfig >/dev/null &&
+make -j $CPUS ARCH=${BOOT_KARCH:-$KARCH} $DO_CROSS $LINUX_FLAGS $VERBOSITY &&
+cp "$KERNEL_PATH" "$STAGE_DIR/linux"
+cleanup
+
 # Tar it up.
 
 ARCH="$ARCH_NAME" create_stage_tarball