+++ Brendan Simon (eTRIX) [2009-10-30 17:27 +1100]: > I'm looking at using multistrap to create a rootfs that can be passed to > a linux build for an initramfs. > > Is emsecondstage still relevant with multistrap ??
nope. > Is booting into a multistrap rootfs possible. With a bit of tweakery so that enough is set up for booting. We (balloonboard) avoid this by using a buildroot initramfs for first boot and rootfs download/installation/configuration. > The multistrap page on wiki says the rootfs just needs to be mounted (or > chrooted) and configured with "dpkg --configure -a" Correct. > Looks like multistrap does not create: > /dev entries. > /etc/inittab > /etc/fstab > /etc/hosts > /etc/securetty > /etc/modules > /etc/hostname > /etc/network/interfaces Indeed. that is local config often very device specific. We use a script which is run after multistrap creates the base image: #! /bin/sh set -e -x # Emdebian grip compatibility version # intended to allow removal of balloon3-config #pass path to the root. Don't let it run without one as it will break your system if [ "" = "$1" ] ; then echo "You need to specify a path to the target rootfs" else if [ -e "$1" ] ; then ROOTFS="$1" else echo "Root dir $ROOTFS not found" fi fi if [ "/" = "ROOTFS" ] ; then echo "Refusing to change your build system's files" ; fi #Do things that need to be done at 1st stage so that rootfs will boot. #Set securetty #Add modules - e.g. to support USB serial/ethernet console # specify config to use if [ "" = "$2" ] ; then CONFIG="files" fi if [ -d "$2" ] ; then CONFIG="$2" else echo "Config dir $CONFIG not found" fi #read in settings if [ -e config ] ; then . config fi #add serial ports to securetty - now idempotent DONE=grep $CONSOLE $ROOTFS/etc/securetty || true if [ -z "$DONE" ]; then echo "$CONSOLE" >> $ROOTFS/etc/securetty fi #put our standard fstab and network and modules files in if [ ! -d $ROOTFS/etc/network ]; then mkdir -p $ROOTFS/etc/network; fi if [ ! -d $ROOTFS/etc/init.d ]; then mkdir -p $ROOTFS/etc/init.d; fi if [ ! -d $ROOTFS/etc/dhcp3 ]; then mkdir -p $ROOTFS/etc/dhcp3; fi if [ ! -d $ROOTFS/etc/apt/apt.conf.d/ ]; then mkdir -p $ROOTFS/etc/apt/apt.conf.d/ fi cp -v $CONFIG/fstab $ROOTFS/etc/fstab cp -v $CONFIG/interfaces $ROOTFS/etc/network/interfaces cp -v $CONFIG/modules $ROOTFS/etc/modules cp -v $CONFIG/dhclient.conf $ROOTFS/etc/dhcp3/ cp -v $CONFIG/urandom $ROOTFS/etc/init.d/ cp -v $CONFIG/inittab $ROOTFS/etc/ cp -v $CONFIG/10disablerecommends $ROOTFS/etc/apt/apt.conf.d/ # making devices so far missing between old and new multistrap versions preventing # chroot from running into newly untarred rootfs (cd $ROOTFS/dev; /dev/MAKEDEV -v std ) (cd $ROOTFS/dev; /dev/MAKEDEV -v fd ) (cd $ROOTFS/dev; /dev/MAKEDEV -v ptmx ) # creating devices (cd $ROOTFS/dev; /dev/MAKEDEV -v fb ) (cd $ROOTFS/dev; /dev/MAKEDEV -v ttyS1 ttyS2 ) (cd $ROOTFS/dev; /dev/MAKEDEV -v sd ) (cd $ROOTFS/dev; /dev/MAKEDEV -v mtd ) #mutter - it makes mtd but not mtdblock - patch MAKEDEV? # (cd $ROOT/FSdev; /dev//MAKEDEV -v mtdblock{0..7}) (cd $ROOTFS/dev; mkdir -p mtdblock; for DEVICE in 0 1 2 3 4 5 6 7; do mknod mtdblock/$DEVICE b 31 $DEVICE; done) # tidy up after old multistrap code if [ -f $ROOTFS/etc/apt/sources.list.d/sources.list ]; then rm -v $ROOTFS/etc/apt/sources.list.d/sources.list fi # tidy up after balloon3-config if [ -f $ROOTFS/etc/apt/sources.list ]; then rm -v $ROOTFS/etc/apt/sources.list fi # stuff that can be left to 2nd stage: (cd $ROOTFS/dev; ln -sf urandom random) #use bash, not dash - saves 10 seconds # ... but we don't have dash ... #(cd $ROOTFS/bin; ln -sf dash sh) #set hostname echo balloon > $ROOTFS/etc/hostname #be nice to put these in the right places in files (perl -pi?) echo "127.0.0.1 localhost.localdomain localhost" > ${ROOTFS}/etc/hosts echo "127.0.1.1 balloon balloon" >> ${ROOTFS}/etc/hosts This is all extremely low-tech but it does work. Wookey -- Principal hats: iEndian - Balloonboard - Toby Churchill - Emdebian http://wookware.org/ -- To UNSUBSCRIBE, email to debian-embedded-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org