UDOO Installing Debian With Debootstrap

From eLinux.org
Revision as of 14:00, 23 October 2013 by Ags131 (Talk | contribs) (Added a guide on installing Debian to UDOO)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Prerequisites

Required software

(Available through apt-get)
  • binfmt-support
  • qemu-user-static
  • debootstrap

I'm going to use /dev/sdb to represent the SD card and ~/deb as the directory I'm building Debian in. Substitute these with your own paths as needed.

First, you need to partition the SD card. Leave room before the primary partition to place uboot. Uboot needs to start at offset 1024B.

Here is an example SD card layout, as displayed by fdisk:

   Device Boot       Start         End      Blocks   Id  System
   /dev/sdb1    16065    13414274     6699105   83  Linux

(units: 512B sectors)

You can format and mount the Linux partition with:

 # mkfs.ext3 /dev/sdb1
 # mount /dev/sdb1 /mnt
 

Flash uboot by running the following command:

   (Replace u-boot-q.bin with the name of the uboot file you downloaded)
   dd if=u-boot-q.bin of=/dev/sdb skip=1024 
   NOTE: We are using /dev/sdb here, NOT sdb1, Also, be sure sdb is the sd card

Bootstrapping Debian

First Stage

First, lets create our working directory

 # mkdir ~/dev

Then we can run the first stage of installing Debian

 # debootstrap --foreign --arch=armhf wheezy ~/deb

Once that completes we are almost ready for the second stage, but before we do that, we must copy qemu's arm binary to the new distro. This will allow us to chroot into the new system.

 # cp /usr/bin/qemu-arm-static ~/dev/usr/bin/

Second Stage

Now, we install the second stage

 # chroot ~/dev /debootstrap/debootstrap --second-stage

This will chroot into the new system and complete the install. You can optionally remove qemu-arm-static from the new install at this point.

Now its time to install the kernel

 # cp path/to/uImage ~/dev/boot
 # cd ~/dev
 # tar xzf path/to/modules.tar.gz

Note: replace path/to with the path where you placed the kernel and modules.

Post install changes

We now have a working Debian system that will boot, however, we will not have networking.

chroot into the system

 # chroot ~/deb

edit etc/network/interfaces to add the eth0 interface

 # nano /etc/network/interfaces
 
 auto eth0
 iface eth0 inet dhcp

also, edit the bottom of /etc/inittab if you want a serial terminal

 T1:23:respawn:/sbin/getty -L ttymxc1 115200 vt100

You may also apt-get any additional packages, once on an SD card, write performance is usually slower.

Packages you may want

 firmware-ralink  for the wifi
 wpasupplicant for wifi connections
 lxde or xfce for a desktop enviroment
 tightvncserver for remote desktop
 git because who DOESN'T download from git?
 bluetooth for bluetooth support

Once done, exit the chroot and we can copy the new system to your sd card.

 # cd ~/dev/
 # cp -rp * /mnt/

Once complete its now time to boot!

Boot!

Now the system is ready for booting! You should already have all the drivers you need for the hardware, some like bluetooth, may require additional software.


This guide has been adapted from the guide over at the Freescale community.