Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
josch committed Jun 21, 2014
0 parents commit df77154
Show file tree
Hide file tree
Showing 7 changed files with 583 additions and 0 deletions.
22 changes: 22 additions & 0 deletions device-table.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#<name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
/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 -
5 changes: 5 additions & 0 deletions mirror.txt
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions multistrap.conf
Original file line number Diff line number Diff line change
@@ -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
207 changes: 207 additions & 0 deletions rootstock.sh
Original file line number Diff line number Diff line change
@@ -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__
# <file system> <mount point> <type> <options> <dump> <pass>
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
76 changes: 76 additions & 0 deletions rootstock2.sh
Original file line number Diff line number Diff line change
@@ -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__
# <file system> <mount point> <type> <options> <dump> <pass>
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
Loading

0 comments on commit df77154

Please sign in to comment.