Generating Debian FS directly into iMXT


Generating Debian FS directly into iMXT

This how to will show you how to build a Debian FS into iMXT SDCARD.

Requirements:

- iMXT running android from NAND with rooting capabilities
- Busybox
- Internet connection
- 2GB SDcard

Steps:

* Resize you SDcard, leave at least the first 8 cylinders free to host uboot and kernel
* Format the the SDcard as ext3 ie: mkfs.ext3 /dev/sdd1
* Download Debian bootstrap

sudo apt-get install debootstrap

mkdir $HOME/debootstrap

sudo debootstrap --arch armel --foreign squeeze $HOME/debootstrap http://ftp.us.debian.org/debian

#This may take a while

I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Found additional required dependencies: insserv libbz2-1.0 libdb4.8 libslang2
I: Found additional base dependencies: libnfnetlink0 libsqlite3-0
I: Checking component main on http://ftp.us.debian.org/debian...
I: Retrieving libacl1
I: Validating libacl1
I: Retrieving adduser
I: Validating adduser
I: Retrieving apt-utils
I: Validating apt-utils
I: Retrieving apt
I: Validating apt
I: Retrieving aptitude
I: Validating aptitude
I: Retrieving libattr1
I: Validating libattr1
I: Retrieving base-files
I: Validating base-files
I: Retrieving base-passwd
I: Validating base-passwd
I: Retrieving bash
I: Validating bash
I: Retrieving libboost-iostreams1.42.0
I: Validating libboost-iostreams1.42.0
I: Retrieving bsdmainutils
I: Validating bsdmainutils
I: Retrieving libbz2-1.0
I: Validating libbz2-1.0
I: Retrieving coreutils
I: Validating coreutils
I: Retrieving cpio
...

*Copy all files from $HOME/debootstrap/ to your SDcard ext3 partition

*Insert the SDcard into your Android device

*Mount the SDcard, example

adb shell
mkdir -p /data/local/mnt
mount -t ext3 /dev/block/mmcblk0p1 /data/local/mnt

*Change root (takes a while)

export PATH=/usr/bin:/usr/sbin:/bin:$PATH

chroot /data/local/mnt/ /debootstrap/debootstrap --second-stage
I: Installing core packages...
I: Unpacking required packages...
I: Unpacking libacl1...
I: Unpacking libattr1...
I: Unpacking base-files...
I: Unpacking base-passwd...
I: Unpacking bash...
I: Unpacking libbz2-1.0...
I: Unpacking coreutils...
I: Unpacking dash...
I: Unpacking libdb4.8...
I: Unpacking debconf-i18n...
I: Unpacking debconf...
I: Unpacking debianutils...
I: Unpacking diffutils...
I: Unpacking dpkg...
I: Unpacking e2fslibs...
I: Unpacking e2fsprogs...
I: Unpacking libcomerr2...

... It takes a while

*After rooting

echo 'nameserver 8.8.8.8' > /data/local/mnt/etc/resolv.conf
mkdir -p /data/local/mnt/etc/firmware
cp /system/etc/firmware/fw_bcm4329.bin /data/local/mnt/etc/firmware/
cp /system/etc/firmware/nvram.txt /data/local/mnt/etc/firmware/
cp /sbin/adbd /data/local/mnt/sbin/adbd
sysctl -w net.ipv4.ip_forward=1
export PATH=/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root

Setup mount points:

chroot /data/local/mnt /bin/bash
mount -t devpts devpts /dev/pts
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mkdir -p /system/bin/
ln -s /bin/bash /system/bin/sh
echo 'deb http://ftp.us.debian.org/debian squeeze main' >> /etc/apt/sources.list

#U-boot configuration

bootdelay=1
baudrate=115200
netdev=eth0
ethprime=FEC0
fbparts=2m@0(boot)hwecc,4m@2m(kernel)i|hwecc,1m@6m(ramdisk)i|hwecc,170m@7m(system)i|hwecc,196m@177m(userdata)i|hwecc,94m@373m(cache)i|hwecc,45m@467m(recovery)i|hwecc
mtdparts=mtdparts=mxc_nand:2m@0(boot),4m@2m(kernel),1m@6m(ramdisk),170m@7m(system),196m@177m(userdata),94m@373m(cache),45m@467m(recovery)
loadaddr=0x90800000
rd_loadaddr=0x90C00000
loadkernel=nand read ${loadaddr} 0x200000 0x400000
loadrd=nand read ${rd_loadaddr} 0x600000 0x80000
ethact=FEC0
loadaddr=0x90800000
mtdids=nand0=mxc_nand
bootcmd=mmc read 0 0x90800000 0x800 1800 ; bootm
bootargs=console=ttymxc0,115200 root=/dev/mmcblk0p1 rootwait init=/sbin/init di1_primary calibration loglevel=7
kernel_nand_offset=0x200000
kernel_nand_size=0x2f0000
stdin=serial
stdout=serial
stderr=serial
partition=nand0,5
mtddevnum=5
mtddevname=cache

Done

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: