view package-mini-native.sh @ 275:29372ecebca8

Added tag 0.3.1 for changeset 3ca6f52688ac
author Rob Landley <rob@landley.net>
date Tue, 29 Jan 2008 08:21:54 -0600
parents 3ca6f52688ac
children 86455766b85d
line wrap: on
line source

#!/bin/bash

# Create an ext2 root filesystem image

source include.sh

#echo -n "Creating tools.sqf"
#("${WORK}/mksquashfs" "${NATIVE}/tools" "${WORK}/tools.sqf" \
#  -noappend -all-root -info || dienow) | dotprogress

# A 256 meg sparse image
rm -f "$IMAGE"
dd if=/dev/zero of="$IMAGE" bs=1024 seek=$[256*1024-1] count=1 &&
/sbin/mke2fs -b 1024 -F "$IMAGE" &&

# User User Mode Linux to package this, until toybox mke2fs is ready.

# Write out a script to control user mode linux
cat > "${WORK}/uml-package.sh" << EOF &&
#!/bin/sh
mount -n -t ramfs /dev /dev
mknod /dev/loop0 b 7 1
# Jump to build dir
echo copying files...
cd "$BUILD"
/sbin/losetup /dev/loop0 "$IMAGE"
mount -n -t ext2 /dev/loop0 "$WORK"
tar cC "$NATIVE" tools | tar xC "$WORK"
mkdir "$WORK"/dev
mknod "$WORK"/dev/console c 5 1
umount "$WORK"
/sbin/losetup -d /dev/loop0
umount /dev
sync
EOF
chmod +x ${WORK}/uml-package.sh &&
linux rootfstype=hostfs rw quiet ARCH=${ARCH} PATH=/bin:/usr/bin:/sbin:/usr/sbin init="${HOSTTOOLS}/oneit -p ${WORK}/uml-package.sh"

function shipit()
{
  cd "$WORK" &&
  mkdir qemu-image-$ARCH &&
  ln "$BUILD"/{image-$ARCH.ext2,zImage-$ARCH,run-$ARCH.sh} qemu-image-$ARCH

  [ $? -ne 0 ] && dienow

  [ "$ARCH" == powerpc ] && ln "$SOURCES"/toys/ppc_rom.bin qemu-image-$ARCH
  tar cvjf "$BUILD"/qemu-image-$ARCH.tar.bz2 qemu-image-$ARCH &&
  rm -rf qemu-image-$ARCH
}

shipit