Thursday, June 04, 2009

N810-Debian Chroot

"Easy chroot" is too large, and includes many unneeded things so I prefer to create my own chroot instead.

#In your PC:
#Download a fresh debian arm distribution :

mkdir chroot_armel
sudo debootstrap --arch=armel lenny chroot_armel

#Create a large file ~600MB, and format it with ext2 fs

dd if=/dev/zero of=chroot_armel.img.ext2 bs=1024 count=600k
mkfs.ext2 chroot_armel.img.ext2

#Mount the image and copy the bootstrap folders inside the image
mkdir tst
sudo mount -t ext2 -o loop,noatime chroot_armel.img.ext2 tst
sudo cp -a chroot_armel/* tst/

#Umount the image and copy it to your N810 using ssh (You can also do it
#with the usb cable instead of using ssh)
sudo umount tst
scp chroot_armel.img.ext2 root@THEIPOFYOURN810:/media/mmc2
#if you don't know the IP and you can't get a root terminal in your N810,
#you can just scan the network and see

#Now ssh your N810
ssh root@THEIPOFYOURN810
cd /mnt/initfs/lib/modules/2.6.21-omap1
insmod mbcache.ko
insmod ext2.ko
mount -o loop,noatime /media/mmc2/chroot_armel.img.ext2 /debian
cd /
mount -t proc proc debian/proc
mount -o bind /dev debian/dev
mount -o bind /mnt/initrd/lib/modules debian/lib/modules
mount -o bind /sys debian/sys
cp /etc/resolv.conf debian/resolv.conf
cp /etc/hosts deban/hosts

chroot /debian

#Now install the deb packages in /var/cache/apt/archives using dpkg
#(At least aptitude with its dependencies)

#Update your apt sources.list:

echo "deb http://ftp.de.debian.org/debian lenny main
deb http://ftp.de.debian.org/debian unstable main" > /etc/apt/sources.list

#Upgrade using aptitude
aptitude update
aptitude safe-upgrade

#Have fun

3 Comments:

Anonymous Anonymous said...

Running debootstrap on Debian Squeeze amd64 system, after packages are extracted I get:
W: Failure trying to run: chroot /home/user/chroot_armel mount -t proc proc /proc

I tried a manual attempt (as root):
# chroot root/ mount -t proc proc /proc
chroot: cannot run command `mount': Exec format error

8:08 AM  
Anonymous Anonymous said...

Running debootstrap on Debian Squeeze amd64 system, after packages are extracted I get:
W: Failure trying to run: chroot /home/user/chroot_armel mount -t proc proc /proc

I tried a manual attempt (as root):
# chroot root/ mount -t proc proc /proc
chroot: cannot run command `mount': Exec format error

8:09 AM  
Anonymous Anonymous said...

Instead of:
sudo debootstrap --arch=armel lenny chroot_armel

I used:
sudo debootstrap --arch=armel --foreign squeeze chroot_armel

Because armel does not match the host arch (amd64), also squeeze has been released.

10:50 AM  

Post a Comment

<< Home