Chip9$ How to install a chroot Debian tree

Da raspibo.

On your Debian running computer type: (It should also work on Debian derivatives like Ubuntu)

debootstrap --arch armhf --foreign --variant=minbase jessie jessie-minbase-arm

this command creates a armhf debian tree in the subdir named "jessie-minbase-arm"

Then tar and send the dir on the chip9$:

tar cvf jessie-minbase-arm.tar jessie-minbase-arm
scp jessie-min-arm.tar

( is the IP address of my chip9$ wifi interface, put the proper value for your installation).

Now login to Chip9$ (e.g. using "ssh root@"). and de-tar the tree.

cd /home
tar xf jessie-minbase-arm.tar

now create some files:

echo nameserver > /home/jessie-minbase-arm/etc/resolv.conf
echo deb jessie main > /home/jessie-minbase-arm/etc/apt/sources.list
cat > /usr/local/bin/startchroot << ENDTAG
mount --bind /proc /home/jessie-minbase-arm/proc
mount --bind /dev /home/jessie-minbase-arm/dev
mount --bind /dev/pts /home/jessie-minbase-arm/dev/pts/
chroot /home/jessie-minbase-arm /bin/bash
umount /home/jessie-minbase-arm/dev/pts
umount /home/jessie-minbase-arm/dev
umount /home/jessie-minbase-arm/proc
chmod +x /usr/local/bin/startchroot

Now everything is ready to enter the chroot environment:


The prompt may appear something like:

I have no name!@chip:/#

Now the installation must be finalized inside the chroot tree:

DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C /debootstrap/debootstrap --second-stage

Now Debian is ready. It is possible to update the list of available packets and install all what you need.

apt-get update
apt-get install aptitude
aptitude install vim build-essential
aptitude install python python3

It is possible to add a user:

adduser user

To "become" the user type:

su user

It is possible now to run the well-known "hello world" test (cat is to try the test using cut&paste, use vim if you like:

cat >hello_world.c <<ENDTAG
#include <stdio.h>
int main(int argc, char *argv[]) {
        printf("hello world from CHIP!\n");
gcc hello_world.c

The answer is:

hello world from CHIP!

If you exit from the chroot shell, you'll return in the standard busybox-based image environment currently available for flashing Chip9$.

Next time you boot chip9$, type:


to enter the Debian chroot.

Strumenti personali