From df77154683987eb0068ccfee0e7cefd9bdbc89fd Mon Sep 17 00:00:00 2001 From: josch Date: Sat, 21 Jun 2014 16:43:30 +0200 Subject: [PATCH] initial commit --- device-table.txt | 22 +++++ mirror.txt | 5 ++ multistrap.conf | 30 +++++++ rootstock.sh | 207 +++++++++++++++++++++++++++++++++++++++++++++ rootstock2.sh | 76 +++++++++++++++++ rootstock_armhf.sh | 189 +++++++++++++++++++++++++++++++++++++++++ test.sh | 54 ++++++++++++ 7 files changed, 583 insertions(+) create mode 100644 device-table.txt create mode 100644 mirror.txt create mode 100644 multistrap.conf create mode 100755 rootstock.sh create mode 100755 rootstock2.sh create mode 100755 rootstock_armhf.sh create mode 100755 test.sh diff --git a/device-table.txt b/device-table.txt new file mode 100644 index 0000000..37c1a64 --- /dev/null +++ b/device-table.txt @@ -0,0 +1,22 @@ +# +/dev d 755 0 0 - - - - - +/dev/console c 0600 0 5 5 1 0 0 - +/proc/kcore s /dev/core - - - - - - - +/proc/self/fd s /dev/fd - - - - - - - +/dev/full c 0666 0 0 1 7 0 0 - +/dev/kmem c 0640 0 15 1 2 0 0 - +/dev/loop b 0660 0 6 7 0 0 1 8 +/dev/mem c 0640 0 15 1 1 0 0 - +/dev/null c 0666 0 0 1 3 0 0 - +/dev/port c 0640 0 15 1 4 0 0 - +/dev/ptmx c 0666 0 5 5 2 0 0 - +/dev/ram b 0660 0 6 1 0 0 1 16 +/dev/ram1 s /dev/ram - - - - - - - +/dev/random c 0666 0 0 1 8 0 0 - +/proc/self/fd/2 s /dev/stderr - - - - - - - +/proc/self/fd/0 s /dev/stdin - - - - - - - +/proc/self/fd/1 s /dev/stdout - - - - - - - +/dev/tty c 0666 0 5 5 0 0 0 - +/dev/tty0 c 0600 0 5 4 0 0 0 - +/dev/urandom c 0666 0 0 1 9 0 0 - +/dev/zero c 0666 0 0 1 5 0 0 - diff --git a/mirror.txt b/mirror.txt new file mode 100644 index 0000000..7f08dff --- /dev/null +++ b/mirror.txt @@ -0,0 +1,5 @@ +ai-os-dev.squashfs 1 http://alwaysinnovating.s3.amazonaws.com/release/2010-12.a/ai-os-dev.squashfs +ubuntu.squashfs 1 http://alwaysinnovating.s3.amazonaws.com/release/2010-12.a/ubuntu.squashfs +android.squashfs 1 http://alwaysinnovating.s3.amazonaws.com/release/2010-12.a/android.squashfs +sd-card.gz 1 http://alwaysinnovating.s3.amazonaws.com/release/2010-12.a/sd-card.gz +ai-all.zip 1 http://alwaysinnovating.s3.amazonaws.com/release/2010-12.a/ai-all.zip diff --git a/multistrap.conf b/multistrap.conf new file mode 100644 index 0000000..36666a9 --- /dev/null +++ b/multistrap.conf @@ -0,0 +1,30 @@ +[General] +#arch=armhf +arch=armel +directory=debian-sid-multistrap +cleanup=true +unpack=true +noauth=true +#bootstrap=Debian_bootstrap Debian_unreleased +bootstrap=Debian_bootstrap +aptsources=Debian +allowrecommends=false +addimportant=false + +[Debian_bootstrap] +packages=apt locales less vim wget module-init-tools procps screen man-db iputils-ping iproute curl vpnc rsync openssh-server alsa-utils nodm xserver-xorg-input-evdev xterm xserver-xorg xserver-xorg-video-fbdev awesome ifupdown net-tools wireless-tools wpasupplicant dhcp3-client navit +source=http://127.0.0.1:3142/ftp.de.debian.org/debian +suite=sid +omitdebsrc=true + +#[Debian_unreleased] +#packages=apt locales less vim wget module-init-tools procps screen man-db iputils-ping iproute curl vpnc rsync openssh-server alsa-utils nodm xserver-xorg-input-evdev xterm xserver-xorg xserver-xorg-video-fbdev awesome ifupdown net-tools wireless-tools wpasupplicant dhcp3-client navit +#source=http://127.0.0.1:3142/ftp.de.debian.org/debian +#suite=unreleased +#omitdebsrc=true + +[Debian] +source=http://ftp.de.debian.org/debian +keyring=debian-archive-keyring +suite=sid +omitdebsrc=true diff --git a/rootstock.sh b/rootstock.sh new file mode 100755 index 0000000..9bc4dd7 --- /dev/null +++ b/rootstock.sh @@ -0,0 +1,207 @@ +#!/bin/sh -ex + +if [ "$LOGNAME" = "root" ] \ +|| [ "$USER" = "root" ] \ +|| [ "$USERNAME" = "root" ] \ +|| [ "$SUDO_COMMAND" != "" ] \ +|| [ "$SUDO_USER" != "" ] \ +|| [ "$SUDO_UID" != "" ] \ +|| [ "$SUDO_GID" != "" ]; then + echo "don't run this script as root - there is no need to" + exit +fi + +if [ "$FAKEROOTKEY" = "" ]; then + echo "re-executing script inside fakeroot" + fakeroot $0; + exit +fi + +DIST="sid" +ROOTDIR="debian-$DIST-multistrap" +MIRROR="http://127.0.0.1:3142/ftp.de.debian.org/debian" +MIRROR_REAL="http://ftp.de.debian.org/debian" +#MIRROR="http://127.0.0.1:3142/ftp.debian-ports.org/debian" +#MIRROR_REAL="http://ftp.debian-ports.org/debian" + +export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C + +rm -rf $ROOTDIR $ROOTDIR.tar + +PACKAGES="apt locales less vim wget module-init-tools procps screen man-db" +PACKAGES=$PACKAGES" iputils-ping iproute curl vpnc rsync openssh-server alsa-utils" +PACKAGES=$PACKAGES" nodm xserver-xorg-input-evdev xterm xserver-xorg xserver-xorg-video-fbdev awesome" +#PACKAGES=$PACKAGES" numptyphysics hex-a-hop wesnoth wesnoth-music libpython2.6" +PACKAGES=$PACKAGES" ifupdown net-tools wireless-tools wpasupplicant dhcp3-client navit" + +cat > multistrap.conf << __END__ +[General] +#arch=armhf +arch=armel +directory=$ROOTDIR +cleanup=true +unpack=true +noauth=true +#bootstrap=Debian_bootstrap Debian_unreleased +bootstrap=Debian_bootstrap +aptsources=Debian +allowrecommends=false +addimportant=false + +[Debian_bootstrap] +packages=$PACKAGES +source=$MIRROR +suite=$DIST +omitdebsrc=true + +#[Debian_unreleased] +#packages=$PACKAGES +#source=$MIRROR +#suite=unreleased +#omitdebsrc=true + +[Debian] +source=$MIRROR_REAL +keyring=debian-archive-keyring +suite=$DIST +omitdebsrc=true +__END__ + +multistrap -f multistrap.conf + +cp /usr/bin/qemu-arm-static $ROOTDIR/usr/bin + +# stop invoke-rc.d from starting services +cat > $ROOTDIR/usr/sbin/policy-rc.d << __END__ +#!/bin/sh +echo "sysvinit: All runlevel operations denied by policy" >&2 +exit 101 +__END__ +chmod +x $ROOTDIR/usr/sbin/policy-rc.d + +# fix for ldconfig inside fakechroot +mv $ROOTDIR/sbin/ldconfig $ROOTDIR/sbin/ldconfig.REAL +mv $ROOTDIR/usr/bin/ldd $ROOTDIR/usr/bin/ldd.REAL +ln -s ../bin/true $ROOTDIR/sbin/ldconfig + +# get fake ldd (needs objdump from binutils) for mkinitramfs +# https://github.com/fakechroot/fakechroot/raw/master/scripts/ldd.pl +curl http://mister-muffin.de/p/a3Dt > $ROOTDIR/usr/bin/ldd +chmod +x $ROOTDIR/usr/bin/ldd + +# supply ld.so.conf for fake ldd (running libc6 postinst script will fail) +echo "include /etc/ld.so.conf.d/*.conf" > $ROOTDIR/etc/ld.so.conf + +# do not generate ssh host keys +mkdir -p $ROOTDIR/etc/ssh/ +touch "$ROOTDIR/etc/ssh/ssh_host_rsa_key" +touch "$ROOTDIR/etc/ssh/ssh_host_dsa_key" +touch "$ROOTDIR/etc/ssh/ssh_host_ecdsa_key" + +cat > $ROOTDIR/tmp/debconfseed.txt << __END__ +# put debconf options here +__END__ +fakechroot chroot $ROOTDIR debconf-set-selections /tmp/debconfseed.txt +rm $ROOTDIR/tmp/debconfseed.txt + +# run preinst scripts +for script in $ROOTDIR/var/lib/dpkg/info/*.preinst; do + [ "$script" = "$ROOTDIR/var/lib/dpkg/info/bash.preinst" ] && continue + fakechroot chroot $ROOTDIR ${script##$ROOTDIR} install +done + +# run dpkg --configure -a twice because of errors during the first run +fakechroot chroot $ROOTDIR /usr/bin/dpkg --configure -a || fakechroot chroot $ROOTDIR /usr/bin/dpkg --configure -a + +fakechroot chroot $ROOTDIR update-locale LANG=en_US.UTF-8 LANGUAGE=en_US:en +echo en_US.UTF-8 UTF-8 > $ROOTDIR/etc/locale.gen +fakechroot chroot $ROOTDIR locale-gen + +if [ ! -f modules-omap3-touchbook.tgz ]; then + curl --silent http://www.alwaysinnovating.com/download/modules-omap3-touchbook.tgz > modules-omap3-touchbook.tgz +fi +tar xzf modules-omap3-touchbook.tgz -C $ROOTDIR + +if [ ! -f rt3070_2.1.2.0-r78.5_omap3-touchbook.ipk ]; then + curl --silent http://www.alwaysinnovating.com/download/rt3070_2.1.2.0-r78.5_omap3-touchbook.ipk > rt3070_2.1.2.0-r78.5_omap3-touchbook.ipk +fi +dpkg-deb --fsys-tarfile rt3070_2.1.2.0-r78.5_omap3-touchbook.ipk | tar xf - -C $ROOTDIR + +depmod -a -b $ROOTDIR 2.6.32 + +if [ ! -f asound.state ]; then + curl --silent http://mister-muffin.de/touchbook/asound.state > asound.state +fi +cp asound.state $ROOTDIR/var/lib/alsa/ + +mkdir $ROOTDIR/mnt/mmcblk0p1 +mkdir $ROOTDIR/mnt/mmcblk0p2 + +cat > $ROOTDIR/etc/fstab << __END__ +# +rootfs / auto defaults,errors=remount-ro,noatime 0 1 +/dev/mmcblk0p1 /mnt/mmcblk0p1 auto defaults,errors=remount-ro,noatime 0 2 +/dev/mmcblk0p2 /mnt/mmcblk0p2 auto defaults,errors=remount-ro,noatime 0 2 +proc /proc proc defaults 0 0 +tmpfs /tmp tmpfs defaults,noatime 0 0 +tmpfs /var/lock tmpfs defaults,noatime 0 0 +tmpfs /var/run tmpfs defaults,noatime 0 0 +tmpfs /var/log tmpfs defaults,noatime 0 0 +tmpfs /etc/network/run tmpfs defaults,noatime 0 0 +/dev/mmcblk0p3 swap swap defaults 0 0 +__END__ + +echo touchbook > $ROOTDIR/etc/hostname + +cat > $ROOTDIR/etc/hosts << __END__ +127.0.0.1 localhost +127.0.0.1 touchbook +__END__ + +cat > $ROOTDIR/etc/default/nodm << __END__ +NODM_ENABLED=true +NODM_USER=user +NODM_XINIT=/usr/bin/xinit +NODM_FIRST_VT=7 +NODM_XSESSION=/etc/X11/Xsession +NODM_X_OPTIONS='-nolisten tcp' +NODM_MIN_SESSION_TIME=60 +__END__ + +cat > $ROOTDIR/etc/udev/rules.d/ai.rules << __END__ +# Symlink for the accelerometer +SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{name}=="MMA7455L", SYMLINK+="input/accel0", MODE="0666" + +# Symlink for the gpio keys +SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{name}=="gpio-keys", SYMLINK+="input/gpio0", MODE="0666" + +# Symlink for the touchscreen +SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0" +SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="ads7846", SYMLINK+="input/touchscreen0" +__END__ + +# activate a tty on serial +echo "T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100" >> $ROOTDIR/etc/inittab + +fakechroot chroot $ROOTDIR useradd user -p `openssl passwd -crypt -salt // ""` -s /bin/bash --create-home +fakechroot chroot $ROOTDIR usermod -a -G audio,dialout user + +sed -i 's/\(root:\)[^:]*\(:\)/\1'`openssl passwd -crypt -salt // "" | sed 's/\(\/\|\\\|&\)/\\&/g'`'\2/' $ROOTDIR/etc/shadow +sed -i 's/\(PermitEmptyPasswords\) no/\1 yes/' $ROOTDIR/etc/ssh/sshd_config +echo 'APT::Install-Recommends "0";' > $ROOTDIR/etc/apt/apt.conf.d/99no-install-recommends +echo 'Acquire::PDiffs "0";' > $ROOTDIR/etc/apt/apt.conf.d/99no-pdiffs + +#cleanup +rm $ROOTDIR/sbin/ldconfig $ROOTDIR/usr/bin/ldd +mv $ROOTDIR/sbin/ldconfig.REAL $ROOTDIR/sbin/ldconfig +mv $ROOTDIR/usr/bin/ldd.REAL $ROOTDIR/usr/bin/ldd +rm $ROOTDIR/usr/sbin/policy-rc.d +rm $ROOTDIR/etc/ssh/ssh_host_* +cp /etc/resolv.conf $ROOTDIR/etc/resolv.conf + +# need to generate tar inside fakechroot so that absolute symlinks are correct +fakechroot chroot $ROOTDIR tar -cf $ROOTDIR.tar -C / . +mv $ROOTDIR/$ROOTDIR.tar . + +tar --delete -f $ROOTDIR.tar ./usr/bin/qemu-arm-static +rm $ROOTDIR/usr/bin/qemu-arm-static diff --git a/rootstock2.sh b/rootstock2.sh new file mode 100755 index 0000000..282f0a7 --- /dev/null +++ b/rootstock2.sh @@ -0,0 +1,76 @@ +#!/bin/sh -e + +DIST="sid" +ROOTDIR="debian-$DIST-cdebootstrap" +MIRROR="http://localhost:3142/ftp.de.debian.org/debian" + +rm -rf $ROOTDIR $ROOTDIR.tar $ROOTDIR.squashfs + +cdebootstrap --flavour=minimal --foreign --arch=armel $DIST $ROOTDIR $MIRROR + +cp /usr/bin/qemu-arm-static $ROOTDIR/usr/bin + +#chroot $ROOTDIR /debootstrap/debootstrap --second-stage +chroot $ROOTDIR /sbin/cdebootstrap-foreign + +chroot $ROOTDIR apt-get update +chroot $ROOTDIR apt-get install locales udev module-init-tools sysklogd klogd procps mtd-utils ntpdate debconf-english \ + screen less vim-tiny console-tools conspy console-setup-mini man-db fbset input-utils \ + iputils-ping iproute dnsutils curl wget openssh-server vpnc rsync wireless-tools \ + wpasupplicant xserver-xorg-video-omapfb xserver-xorg-video-fbdev xserver-xorg-input-evdev \ + xserver-xorg -qq +chroot $ROOTDIR apt-get remove cdebootstrap-helper-rc.d -qq + +curl http://www.alwaysinnovating.com/download/modules-omap3-touchbook.tgz | tar xzf - -C $ROOTDIR +wget http://www.alwaysinnovating.com/download/rt3070_2.1.2.0-r78.5_omap3-touchbook.ipk +ar x rt3070_2.1.2.0-r78.5_omap3-touchbook.ipk +tar xzf data.tar.gz -C $ROOTDIR +rm rt3070_2.1.2.0-r78.5_omap3-touchbook.ipk data.tar.gz control.tar.gz debian-binary + +chroot $ROOTDIR depmod -a 2.6.32 + +rm $ROOTDIR/usr/bin/qemu-arm-static + +sed -i 's/\(root:\)[^:]*\(:\)/\1\/\/plGAV7Hp3Zo\2/' $ROOTDIR/etc/shadow + +sed -i 's/\(PermitEmptyPasswords\) no/\1 yes/' $ROOTDIR/etc/ssh/sshd_config + +echo 'APT::Install-Recommends "0";' > $ROOTDIR/etc/apt/apt.conf.d/99no-install-recommends + +mv $ROOTDIR/sbin/init.REAL $ROOTDIR/sbin/init + +mkdir $ROOTDIR/mnt/mmcblk0p1 +mkdir $ROOTDIR/mnt/mmcblk0p2 + +cat > $ROOTDIR/etc/fstab << __END__ +# +rootfs / auto defaults,errors=remount-ro,noatime 0 1 +/dev/mmcblk0p1 /mnt/mmcblk0p1 auto defaults,errors=remount-ro,noatime 0 2 +/dev/mmcblk0p2 /mnt/mmcblk0p2 auto defaults,errors=remount-ro,noatime 0 2 +proc /proc proc defaults 0 0 +tmpfs /tmp tmpfs defaults,noatime 0 0 +tmpfs /var/lock tmpfs defaults,noatime 0 0 +tmpfs /var/run tmpfs defaults,noatime 0 0 +tmpfs /var/log tmpfs defaults,noatime 0 0 +tmpfs /etc/network/run tmpfs defaults,noatime 0 0 +/dev/mmcblk0p3 swap swap defaults 0 0 +__END__ + +echo touchbook > $ROOTDIR/etc/hostname + +echo deb http://ftp.debian.org $DIST main > $ROOTDIR/etc/apt/sources.list + +cat > $ROOTDIR/etc/hosts << __END__ +127.0.0.1 localhost +127.0.0.1 touchbook +__END__ + +curl http://mister-muffin.de/touchbook/dsp.tar.gz | tar xzf - -C $ROOTDIR + +cat > $ROOTDIR/etc/modules << __END__ +bridgedriver base_img=/lib/dsp/baseimage.dof +dspbridge +__END__ + +tar -cf $ROOTDIR.tar -C $ROOTDIR . +mksquashfs $ROOTDIR $ROOTDIR.squashfs diff --git a/rootstock_armhf.sh b/rootstock_armhf.sh new file mode 100755 index 0000000..f3397be --- /dev/null +++ b/rootstock_armhf.sh @@ -0,0 +1,189 @@ +#!/bin/sh -ex + +if [ "$FAKEROOTKEY" = "" ]; then + echo "re-executing script inside fakeroot" + fakeroot $0; + exit +fi + +DIST="sid" +ROOTDIR="debian-$DIST-multistrap" +#MIRROR="http://127.0.0.1:3142/ftp.de.debian.org/debian" +MIRROR="http://127.0.0.1:3142/ftp.debian-ports.org/debian" +#MIRROR_REAL="http://ftp.de.debian.org/debian" +MIRROR_REAL="http://ftp.debian-ports.org/debian" + +export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C + +rm -rf $ROOTDIR $ROOTDIR.tar + +PACKAGES="apt locales less vim wget module-init-tools sysklogd klogd" +PACKAGES=$PACKAGES" procps screen mtd-utils ntpdate conspy man-db console-tools fbset" +PACKAGES=$PACKAGES" input-utils iputils-ping iproute dnsutils wireless-tools curl" +PACKAGES=$PACKAGES" vpnc rsync openssh-server console-setup-mini" +PACKAGES=$PACKAGES" nodm xserver-xorg-input-evdev xserver-xorg-core xterm" +PACKAGES=$PACKAGES" xserver-xorg-video-fbdev mplayer" + +cat > multistrap.conf << __END__ +[General] +arch=armhf +directory=$ROOTDIR +cleanup=true +unpack=true +noauth=true +bootstrap=Debian_bootstrap Debian_unreleased +aptsources=Debian +allowrecommends=false +addimportant=false + +[Debian_bootstrap] +packages=$PACKAGES +source=$MIRROR +suite=$DIST +omitdebsrc=true + +[Debian_unreleased] +packages=$PACKAGES +source=$MIRROR +suite=unreleased +omitdebsrc=true + +[Debian] +source=$MIRROR_REAL +keyring=debian-archive-keyring +suite=$DIST +omitdebsrc=true +__END__ + +multistrap -f multistrap.conf + +cp /usr/bin/qemu-arm-static $ROOTDIR/usr/bin + +# hack to install dash properly +fakechroot chroot $ROOTDIR /var/lib/dpkg/info/dash.preinst install + +# keyboard-configuration needs this (initscripts configuration happens afterwards) +fakechroot chroot $ROOTDIR /usr/sbin/update-rc.d mountkernfs.sh start 02 S . + +# ifupdown needs this (initscripts configuration happens afterwards) +fakechroot chroot $ROOTDIR /usr/sbin/update-rc.d hostname.sh start 02 S . +fakechroot chroot $ROOTDIR /usr/sbin/update-rc.d mountdevsubfs.sh start 04 S . +fakechroot chroot $ROOTDIR /usr/sbin/update-rc.d checkroot.sh start 10 S . + +rename -v 's/(.*)foreign(.*)$/$1$2/' $ROOTDIR/var/lib/dpkg/info/*foreign* + +# stop invoke-rc.d from starting services +cat > $ROOTDIR/usr/sbin/policy-rc.d << __END__ +#!/bin/sh +echo "sysvinit: All runlevel operations denied by policy" >&2 +exit 101 +__END__ +chmod +x $ROOTDIR/usr/sbin/policy-rc.d + +# fix for ldconfig inside fakechroot +mv $ROOTDIR/sbin/ldconfig $ROOTDIR/sbin/ldconfig.REAL +ln -s ../bin/true $ROOTDIR/sbin/ldconfig + +# hack to not generate ssh host keys as /dev/urandom is missing +#ssh-keygen -q -f "$ROOTDIR/etc/ssh/ssh_host_rsa_key" -N '' -t rsa +#ssh-keygen -q -f "$ROOTDIR/etc/ssh/ssh_host_dsa_key" -N '' -t dsa +mkdir -p $ROOTDIR/etc/ssh/ +touch "$ROOTDIR/etc/ssh/ssh_host_rsa_key" +touch "$ROOTDIR/etc/ssh/ssh_host_dsa_key" +touch "$ROOTDIR/etc/ssh/ssh_host_ecdsa_key" + +fakechroot chroot $ROOTDIR /usr/bin/dpkg --configure -a + +# creating device nodes that debootstrap creates +#cat > device-table.txt << __END__ +## +#/dev d 755 0 0 - - - - - +#/dev/console c 0600 0 5 5 1 0 0 - +#/proc/kcore s /dev/core - - - - - - - +#/proc/self/fd s /dev/fd - - - - - - - +#/dev/full c 0666 0 0 1 7 0 0 - +#/dev/kmem c 0640 0 15 1 2 0 0 - +#/dev/loop b 0660 0 6 7 0 0 1 8 +#/dev/mem c 0640 0 15 1 1 0 0 - +#/dev/null c 0666 0 0 1 3 0 0 - +#/dev/port c 0640 0 15 1 4 0 0 - +#/dev/ptmx c 0666 0 5 5 2 0 0 - +#/dev/ram b 0660 0 6 1 0 0 1 16 +#/dev/ram1 s /dev/ram - - - - - - - +#/dev/random c 0666 0 0 1 8 0 0 - +#/proc/self/fd/2 s /dev/stderr - - - - - - - +#/proc/self/fd/0 s /dev/stdin - - - - - - - +#/proc/self/fd/1 s /dev/stdout - - - - - - - +#/dev/tty c 0666 0 5 5 0 0 0 - +#/dev/tty0 c 0600 0 5 4 0 0 0 - +#/dev/urandom c 0666 0 0 1 9 0 0 - +#/dev/zero c 0666 0 0 1 5 0 0 - +#__END__ +# +#/usr/share/multistrap/device-table.pl -d $ROOTDIR -f device-table.txt + +if [ ! -f modules-omap3-touchbook.tgz ]; then + curl --silent http://www.alwaysinnovating.com/download/modules-omap3-touchbook.tgz > modules-omap3-touchbook.tgz +fi +tar xzf modules-omap3-touchbook.tgz -C $ROOTDIR + +if [ ! -f rt3070_2.1.2.0-r78.5_omap3-touchbook.ipk ]; then + curl --silent http://www.alwaysinnovating.com/download/rt3070_2.1.2.0-r78.5_omap3-touchbook.ipk > rt3070_2.1.2.0-r78.5_omap3-touchbook.ipk +fi +dpkg-deb --fsys-tarfile rt3070_2.1.2.0-r78.5_omap3-touchbook.ipk | tar xf - -C $ROOTDIR + +depmod -a -b $ROOTDIR 2.6.32 + +#if [ ! -f dsp.tar.gz ]; then +# curl --silent http://mister-muffin.de/touchbook/dsp.tar.gz > dsp.tar.gz +#fi +#tar xzf dsp.tar.gz -C $ROOTDIR +# +#cat > $ROOTDIR/etc/modules << __END__ +#bridgedriver base_img=/lib/dsp/baseimage.dof +#dspbridge +#__END__ + +mkdir $ROOTDIR/mnt/mmcblk0p1 +mkdir $ROOTDIR/mnt/mmcblk0p2 + +cat > $ROOTDIR/etc/fstab << __END__ +# +rootfs / auto defaults,errors=remount-ro,noatime 0 1 +/dev/mmcblk0p1 /mnt/mmcblk0p1 auto defaults,errors=remount-ro,noatime 0 2 +/dev/mmcblk0p2 /mnt/mmcblk0p2 auto defaults,errors=remount-ro,noatime 0 2 +proc /proc proc defaults 0 0 +tmpfs /tmp tmpfs defaults,noatime 0 0 +tmpfs /var/lock tmpfs defaults,noatime 0 0 +tmpfs /var/run tmpfs defaults,noatime 0 0 +tmpfs /var/log tmpfs defaults,noatime 0 0 +tmpfs /etc/network/run tmpfs defaults,noatime 0 0 +/dev/mmcblk0p3 swap swap defaults 0 0 +__END__ + +echo touchbook > $ROOTDIR/etc/hostname + +cat > $ROOTDIR/etc/hosts << __END__ +127.0.0.1 localhost +127.0.0.1 touchbook +__END__ + +sed -i 's/\(root:\)[^:]*\(:\)/\1\/\/plGAV7Hp3Zo\2/' $ROOTDIR/etc/shadow +sed -i 's/\(PermitEmptyPasswords\) no/\1 yes/' $ROOTDIR/etc/ssh/sshd_config +echo 'APT::Install-Recommends "0";' > $ROOTDIR/etc/apt/apt.conf.d/99no-install-recommends +echo 'Acquire::PDiffs "0";' > $ROOTDIR/etc/apt/apt.conf.d/99no-pdiffs + +#cleanup +rm $ROOTDIR/sbin/ldconfig +mv $ROOTDIR/sbin/ldconfig.REAL $ROOTDIR/sbin/ldconfig +rm $ROOTDIR/usr/sbin/policy-rc.d +rm $ROOTDIR/etc/ssh/ssh_host_* +cp /etc/resolv.conf $ROOTDIR/etc/resolv.conf + +# need to generate tar inside fakechroot so that absolute symlinks are correct +fakechroot chroot $ROOTDIR tar -cf $ROOTDIR.tar -C / . +mv $ROOTDIR/$ROOTDIR.tar . + +rm $ROOTDIR/usr/bin/qemu-arm-static + +#ls -lha $ROOTDIR/dev diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..ea49204 --- /dev/null +++ b/test.sh @@ -0,0 +1,54 @@ +#!/bin/sh -ex + +DIST="sid" +ROOTDIR="debian-$DIST-multistrap" +MIRROR="http://127.0.0.1:3142/ftp.de.debian.org/debian" + +export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C + +rm -rf $ROOTDIR $ROOTDIR.tar + +PACKAGES="udev" + +cat > multistrap.conf << __END__ +[General] +arch=armel +directory=$ROOTDIR +cleanup=true +unpack=true +noauth=true +bootstrap=Debian +aptsources=Debian +allowrecommends=false +addimportant=false + +[Debian] +packages=$PACKAGES +source=$MIRROR +keyring=debian-archive-keyring +suite=$DIST +omitdebsrc=true +__END__ + +multistrap -f multistrap.conf + +cp /usr/bin/qemu-arm-static $ROOTDIR/usr/bin + +fakechroot chroot $ROOTDIR /var/lib/dpkg/info/dash.preinst install + +cat > $ROOTDIR/usr/sbin/policy-rc.d << __END__ +#!/bin/sh +echo "sysvinit: All runlevel operations denied by policy" >&2 +exit 101 +__END__ +chmod +x $ROOTDIR/usr/sbin/policy-rc.d + +mv $ROOTDIR/sbin/ldconfig $ROOTDIR/sbin/ldconfig.REAL +ln -s ../bin/true $ROOTDIR/sbin/ldconfig + +fakechroot chroot $ROOTDIR /usr/bin/dpkg --configure -a + +rm $ROOTDIR/sbin/ldconfig +mv $ROOTDIR/sbin/ldconfig.REAL $ROOTDIR/sbin/ldconfig +rm $ROOTDIR/usr/sbin/policy-rc.d +rm $ROOTDIR/usr/bin/qemu-arm-static