* Do not bind aufs by default
authorpancake
Sun Dec 06 20:23:25 2009 +0100 (2009-12-06)
changeset 2fa8a66a19266
parent 1 620643678e07
child 3 9fba4bff4298
* Do not bind aufs by default
* Added some basic FAQ in README
* Do not mount or register qemu-arm twice
Makefile
README
TODO
maemo/shell/run
     1.1 --- a/Makefile	Sun Dec 06 19:19:21 2009 +0100
     1.2 +++ b/Makefile	Sun Dec 06 20:23:25 2009 +0100
     1.3 @@ -1,8 +1,11 @@
     1.4  REPO=http://repository.maemo.org/unstable/5.0prealpha2/armel/
     1.5  ROOT=maemo-sdk-rootstrap_5.0_armel.tgz
     1.6 +# bind system directories with aufs2?
     1.7 +# this is experimental, not enabled by default
     1.8 +AUFS?=0
     1.9  
    1.10  all: maemo/bin
    1.11 -	cd maemo && sudo shell/run
    1.12 +	cd maemo && sudo shell/run ${AUFS}
    1.13  
    1.14  maemo/bin:
    1.15  	wget -c ${REPO}/${ROOT}
     2.1 --- a/README	Sun Dec 06 19:19:21 2009 +0100
     2.2 +++ b/README	Sun Dec 06 20:23:25 2009 +0100
     2.3 @@ -6,3 +6,15 @@
     2.4  
     2.5  ---------- the minimal maemo sdk
     2.6  
     2.7 +
     2.8 +FAQ:
     2.9 +
    2.10 +  apt-get update
    2.11 +  cp maemo/bin/true maemo/usr/sbin/dpkg-preconfigure
    2.12 +  apt-get install vim libgtk2.0-dev libhildon1-dev libxml2-dev libsoup2.4-dev
    2.13 +
    2.14 +Problem with pango? maybe you have no 
    2.15 +  cp -rf /usr/share/fonts maemo/usr/share/fonts
    2.16 +
    2.17 +Wanna full SDK
    2.18 +  apt-get install maemo-sdk-dev
     3.1 --- a/TODO	Sun Dec 06 19:19:21 2009 +0100
     3.2 +++ b/TODO	Sun Dec 06 20:23:25 2009 +0100
     3.3 @@ -1,4 +1,3 @@
     3.4  * Add support for other SDKs (maemo<5)
     3.5  * add binaries for x86-64
     3.6  * missing /usr/lib/apt/methods/http
     3.7 -* allow to bind external apps
     4.1 --- a/maemo/shell/run	Sun Dec 06 19:19:21 2009 +0100
     4.2 +++ b/maemo/shell/run	Sun Dec 06 20:23:25 2009 +0100
     4.3 @@ -15,49 +15,72 @@
     4.4  ARCH=$(uname -m)
     4.5  CHROOT=$PWD
     4.6  BINDIRS="usr lib bin tmp bin var home"
     4.7 -[ -z "$AUFS" ] && AUFS=0
     4.8 +if [ "$1" = 1 ]; then
     4.9 +  AUFS=1
    4.10 +else
    4.11 +  AUFS=0
    4.12 +fi
    4.13 +if [ -z "`mount | grep maemo`" ]; then
    4.14 +  DOMOUNT=1
    4.15 +else
    4.16 +  DOMOUNT=0
    4.17 +fi
    4.18  
    4.19  if [ $AUFS = 1 ]; then
    4.20    if [ -z "`lsmod | grep aufs`" ]; then
    4.21 -    echo "=> Cannot bind root system because of the lack of aufs kernel module"
    4.22 +    echo "=> No aufs kernel module. Cannot bind rootfs into chroot"
    4.23      AUFS=0
    4.24    fi
    4.25  fi
    4.26  
    4.27 +echo "=> Copying resolv.conf..."
    4.28 +cp -f /etc/resolv.conf etc/
    4.29 +
    4.30  # enter environment
    4.31  echo "=> Rootfs at ${CHROOT} and arch is ${ARCH}"
    4.32 -cd $CHROOT
    4.33 -mkdir -p dev proc dev/pts sys
    4.34 -mount -o bind /dev dev
    4.35 -mount -o bind /dev/pts dev/pts
    4.36 -mount -o bind /proc proc
    4.37 -mount -o bind /proc/sys/fs/binfmt_misc proc/sys/fs/binfmt_misc
    4.38 -mount -o bind /sys sys
    4.39 +cd "${CHROOT}"
    4.40 +if [ 1 = "${DOMOUNT}" ]; then
    4.41 +  mkdir -p dev proc dev/pts sys
    4.42 +  mount -o bind /dev dev
    4.43 +  mount -o bind /dev/pts dev/pts
    4.44 +  mount -o bind /proc proc
    4.45 +  mount -o bind /proc/sys/fs/binfmt_misc proc/sys/fs/binfmt_misc
    4.46 +  mount -o bind /sys sys
    4.47  
    4.48 -# Bind rootfs with aufs
    4.49 -if [ "$AUFS" = 1 ]; then
    4.50 -  (
    4.51 -    for a in ${BINDIRS} ; do
    4.52 -      mount -t aufs -o br=$a=rw:/$a=ro none $a
    4.53 -    done
    4.54 -  )
    4.55 +  # Bind rootfs with aufs
    4.56 +  if [ "$AUFS" = 1 ]; then
    4.57 +    echo "=> Binding system directories"
    4.58 +    (
    4.59 +      for a in ${BINDIRS} ; do
    4.60 +        mount -t aufs -o br=$a=rw:/$a=ro none $a
    4.61 +      done
    4.62 +    )
    4.63 +  else
    4.64 +    echo "=> Not binding system directories"
    4.65 +  fi
    4.66 +
    4.67 +  echo "=> Registering ELF-ARM binaries to be handled by qemu-arm..."
    4.68 +  mount binfmt_misc -t binfmt_misc proc/sys/fs/binfmt_misc
    4.69 +  echo ":qemu-arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff\xff:/shell/${ARCH}/qemu-arm:" 2>/dev/null > proc/sys/fs/binfmt_misc/register
    4.70 +else
    4.71 +  echo "==> Not mounting anything. They are already mounted :)"
    4.72  fi
    4.73  
    4.74 -echo "=> Registering ELF-ARM binaries to be handled by qemu-arm..."
    4.75 -mount binfmt_misc -t binfmt_misc proc/sys/fs/binfmt_misc
    4.76 -echo ":qemu-arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff\xff:/shell/${ARCH}/qemu-arm:" 2>/dev/null > proc/sys/fs/binfmt_misc/register
    4.77 -
    4.78  echo "=> Welcome to the arm chroot environment"
    4.79  chroot . /shell/${ARCH}/dash /shell/start ${ARCH}
    4.80  
    4.81  echo "=> Bye bye! hope to see you soon"
    4.82  # quit environment
    4.83 -umount -f proc/sys/fs/binfmt_misc
    4.84 -umount -f sys
    4.85 -umount -f proc/sys/fs/binfmt_misc
    4.86 -umount -f dev/pts
    4.87 -umount -f dev
    4.88 -umount -f proc
    4.89 -for a in ${BINDIRS} ; do
    4.90 -  umount $a
    4.91 -done
    4.92 +if [ 1 = "${DOMOUNT}" ]; then
    4.93 +  umount -f proc/sys/fs/binfmt_misc
    4.94 +  umount -f sys
    4.95 +  umount -f proc/sys/fs/binfmt_misc
    4.96 +  umount -f dev/pts
    4.97 +  umount -f dev
    4.98 +  umount -f proc
    4.99 +  if [ "$AUFS" = 1 ]; then
   4.100 +    for a in ${BINDIRS} ; do
   4.101 +      umount $a
   4.102 +    done
   4.103 +  fi
   4.104 +fi