[Rock-dev] Debian armel chroot: ruby segfault in /base/orogen/std

Martin Zenzes martin.zenzes at dfki.de
Thu Jan 23 17:41:25 CET 2014


On 01/23/2014 04:08 PM, Janosch Machowinski wrote:
> Uhm
> chrooting in an ARM debian should not work at all.
> I am confused that it actually does not instantaneously
> crash. As you are giving ARM instructions to an X64
> CPU...
> Greetings
>     Janosch
Well, modern software is a miracale, indeed. This works using "qemu user 
emulation" and "binfmt-support", where the system detects non-native 
bytecode and executes it using qemu-handlers. Not fast, but flexible. I 
basically bootstrap into a dir [1] as usual and provide the qemu-handler 
inside the chroot. Then I can chroot-into like it is a native bootstrap. 
Works, kind of ;-) One has to keep the limitations of chroot and qemu in 
mind, though. For the curious, I attached my work-in-progress notes...

[1] https://wiki.debian.org/EmDebian/CrossDebootstrap
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.dfki.de/pipermail/rock-dev/attachments/20140123/12e4ca45/attachment.htm 
-------------- next part --------------
# based on https://wiki.debian.org/EmDebian/CrossDebootstrap
# slow, expect extraordinarily low performance... (120minutes+ for rock bootstrap alone)

#--- updating ubuntu qemu
wget  http://archive.ubuntu.com/ubuntu/pool/universe/q/qemu-linaro/qemu-linaro_1.2.0-2012.09-0ubuntu1.dsc
wget http://archive.ubuntu.com/ubuntu/pool/universe/q/qemu-linaro/qemu-linaro_1.2.0-2012.09.orig.tar.gz
wget http://archive.ubuntu.com/ubuntu/pool/universe/q/qemu-linaro/qemu-linaro_1.2.0-2012.09-0ubuntu1.debian.tar.gz
tar xzf qemu-linaro_1.2.0-2012.09.orig.tar.gz
tar xzf qemu-linaro_1.2.0-2012.09-0ubuntu1.debian.tar.gz -C qemu-linaro_1.2.0-2012.09
cd qemu-linaro_1.2.0-2012.09
fakeroot debian/rules binary
cd ..

#--- inside host, as root:
mkdir debian_armel_wheezy
apt-get install binfmt-support qemu qemu-user-static debootstrap

debootstrap --foreign --arch armel wheezy debian_armel_wheezy http://ftp.debian.org/debian/

# copy the freshly built qemu-binary into chroot
find qemu-linaro_1.2.0-2012.09 -name qemu-arm-static -exec cp debian_armel_wheezy/usr/bin

# second stage
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
 LC_ALL=C LANGUAGE=C LANG=C chroot debian_armel_wheezy /debootstrap/debootstrap --second-stage

DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
 LC_ALL=C LANGUAGE=C LANG=C chroot debian_armel_wheezy dpkg --configure -a

# further setup for a functional system:
# apt
echo "deb http://http.debian.net/debian wheezy main
deb-src http://http.debian.net/debian wheezy main

deb http://http.debian.net/debian wheezy-updates main
deb-src http://http.debian.net/debian wheezy-updates main

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main" >> debian_armel_wheezy/etc/apt/sources.list

# network
echo "auto eth0
iface eth0 inet dhcp" >> debian_armel_wheezy/etc/network/interfaces
echo "nameserver 8.8.8.8 >> debian_armel_wheezy/etc/resolv.conf

# fstab?
echo "proc            /proc           proc    defaults        0       0" >> debian_armel_wheezy/etc/fstab

# serial
echo " T0:2345:respawn:/sbin/getty -L 115200 ttyS2 vt102" >> debian_armel_wheezy/etc/inittab

#--- prepare rock-bootstrap
cp /home/mzenzes/TransTerrA/TransTerrA.git/software/bootstrap.sh debian_armel_wheezy/home/rock

# schroot.conf, does not seem to work that well
#echo "[debian_armel]
#description=Debian armel cross chroot
#directory=/home/$USER/arm_chroot/debian_armel_wheezy
#users=$USER
#root-groups=root" >> /etc/schroot/schroot.conf

#--- manually chrooting
mount -t proc proc debian_armel_wheezy/proc
mount --bind /dev debian_armel_wheezy/dev
mount --bind /dev/pts debian_armel_wheezy/dev/pts
mount --bind /tmp debian_armel_wheezy/tmp

SHELL=/bin/bash LC_ALL=C LANGUAGE=C LANG=C chroot debian_armel_wheezy adduser rock
SHELL=/bin/bash LC_ALL=C LANGUAGE=C LANG=C chroot debian_armel_wheezy /bin/bash

#--- inside chroot some janitorial stuff:

# local user wants to get root
echo "rock      ALL=(ALL) ALL" >> /etc/sudoers
# some package needed for rock-bootstrap
apt-get install sudo git ruby build-essential autoconf automake1.9 cmake subversion unzip
su rock

#--- inside chroot, as user, bootstrapping rock:
cd $HOME
sh bootstrap.sh

# (cross-)compile custom kernel?
git clone git://spacegit.dfki.uni-bremen.de/istruct/linux-omap3-istruct.git /usr/src/linux-omap3-istruct
ln -s /usr/src/linux-omap3-istruct /usr/src/linux
cd /usr/src/linux && make defconfig && make prepare && make deb-pkg

# (cross-)compile fpga_gpmc module?
#svn export https://svn.hb.dfki.de/iStruct/software/trunk/gumstix/software/modules/fpga_gpmc/fpga_gpmc.c
#...
# creating debian package from source-dir:
# DEBFULLNAME="Martin Zenzes" dh_make --email martin.zenzes at dfki.de --kmod --copyright gpl2 --createorig --

# (cross-)compile u-boot...?

# somehow write SD-card-image of bootstrap-dir
#http://paul-strefling.blogspot.de/2011/06/installing-debian-on-gumstix-overo.html

#--- on host, after finished:
sudo umount /home/mzenzes/arm_chroot/debian_armel_wheezy/proc
sudo umount /home/mzenzes/arm_chroot/debian_armel_wheezy/dev
sudo umount /home/mzenzes/arm_chroot/debian_armel_wheezy/dev/pts
sudo umount /home/mzenzes/arm_chroot/debian_armel_wheezy/tmp

#--- notes

# creating fpga-debian package
# FIXME: does the module really need a full kernel build?

# FIXME: in ubuntu12.04 the qemu-package has the following error
#    qemu: Unsupported syscall: 336
#    see https://bugs.launchpad.net/ubuntu/+source/qemu-linaro/+bug/956799
#    the version in 12.04 comes as "1.0.50-2012.03-0ubuntu2.1" and does not
#    seems to include the patch. have to rebuilt qemu.
# TODO: add "sudo" as osdep of autoproj (autoproj/removes/rock.base/base.osdeps)
#
# vim: set nowrap:


More information about the Rock-dev mailing list