Sunday, June 28, 2009

Emdebian rootfs for Emdebian Crush

The root filesystem is a basic set of packages needed to provide a usable login environment around a kernel and kernel modules. The rootfs must be extensible to a full system so normal packaging tools need to be supported. See also Emdebian website.

The main Debian root filesystem is based on 'Essential' - a collection of packages that contain: Essential: yes in debian/control and although small in Debian terms, it is still much too large for Emdebian.

This page concentrates on how to use the emdebian-rootfs package to build an Emdebian root filesystem for your device and describes how to customize your package set for your needs.


Linux Embedded

In order to be able to build an embedded Linux system, obviously you need:

The GNU cross-development tools installed on your host machine (presumably a Linux PC machine).

Your target system will need to have these different pieces of software:

Firmware (or boot loader), such as u-boot, redboot or a BIOS: you can these choose to boot from Flash, network (tftp), or disk;

Kernel (linux): the kernel must be compiled with support for your board (cpu and peripherals);

Root file system (contains the C/C++ libraries, the shell, etc.).

If your board comes with a ‘good’ firmware, you might not need at all a JTAG programmer. Using the firmware, you might be able to program the flash with the kernel and/or the root filesystem. Both u-boot and redboot let you do this, assuming they have the drive for the Flash you are using.

Ubuntu on Beagleboard

(1) Format SD card at Host
Insert SD card to SD slot of the host
$ sudo apt-get install gparted
$ sudo gparted
device /dev/sdc
Partition
/dev/sdc1 : fat32 : /media/disk-1 : 62.72 MB
/dev/sdc2 : ext3 : /media/disk-2 : 1.80 GB

(2) Download prebuilt Linux kernel and install it to the fat32 partition of SD card
Get stable version: 2.6.29-oer34
$ wget http://www.rcn-ee.com/deb/kernel/beagle/lenny/v2.6.29-58cf2f1-oer34/uImage
$ copy uImage /media/disk-1
$ sudo umount /media/disk-1

(3) Make Ubuntu Root File System on the ext3 partition of SD card
$ cd
$ sudo apt-get install qemu
$ wget http://ports.ubuntu.com/pool/main/d/debootstap/debootstrap_1.0.13~jaunty1_all.deb
$ sudo dpkg -i debootstrap_1.0.13~jaunty1_all.deb
$ wget http://people.ubuntu.com/~ogra/arm/build-arm-rootfs
$ sudo chmod +x build-arm-rootfs
$ sudo ./build-arm-rootfs --fqdn beagleboard --login ubuntu --password passwd --imagesize 2G --seed gcc,make,usbutils
...
$ ls
armel-rootfs-.tgz build-arm-rootfs build-aarm-rootfs-.log
$ sudo tar xfp armel-rootfs-.tgz -C /media/disk-2
$ cd /media/disk-2
$ sudo vi etc/event.d/ttyS2
# ttyS2 - getty
start on runlevel 2
start on runlevel 3

stop on runlevel 0
stop on runlevel 1
stop on runlevel 4
stop on runlevel 5
stop on runlevel 6

respawn
exec /sbin/getty -L 115200 ttyS2

$ cd ..
$ sudo umount /media/disk-2

(4) U-Boot setting and boot Linux at Beagle Board console (U-Boot Reference)
Insert SD card to SD slot of Beagle Board
U-Boot 1.3.3 (Jul 10 2008 - 16:33:09)
OMAP3530-GP rev 2, CPU-OPP2 L3-165MHz
DRAM: 128 MB
NAND: 256 MiB
In: serial
Out: serial
Err: serial
Audio Tone on Speakers ... complete
Hit any key to stop autoboot:
OMAP3 beagleboard.org #
setenv bootcmd 'mmcinit; fatload mmc 0:1 0x80300000 uImage; bootm 0x80300000'
OMAP3 beagleboard.org # setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p2 rootwait rootfstype=ext3 rw'

OMAP3 beagleboard.org # saveenv
OMAP3 beagleboard.org # boot
reading uImage ...
...
beagleboard login:

Beagleboard - DSP: Bridge or Link?

What should I choose? Bridge or Link? :-?

HOWTO: Restore GRUB (if your MBR is messed up)

#1 Alternative

1. Pop in the Live CD, boot from it until you reach the desktop.
2. Open a terminal window or switch to a tty.
3. Type "grub"
4. Type "root (hd0,6)", or whatever your harddisk + boot partition numbers are (my /boot is at /dev/sda7, which translates to hd0,6 for grub).
5. Type "setup (hd0)", ot whatever your harddisk nr is.
6. Quit grub by typing "quit".
7. Reboot.

#2 Alternative
1. Boot your computer up with Ubunto CD
2. Go through all the process until you reech "[!!!] Disk Partition"
3. Select Manual Partition
4. Mount your appropriate linux partions

/
/boot
swap
.....

5. DO NOT FORMAT THEM.
6. Finish the manual partition
7. Say "Yes" when it asks you to save the changes
8. It will give you errors saying that "the system couldn't install ....." after that
9. Ignore them, keep select "continue" until you get back to the Ubuntu installation menu
10. Jump to "Install Grub ...."
11. Once it is finished, just restart your computer

Good luck!

Wednesday, March 18, 2009

Beagle-Board

I need to buy a beagleboard!

TODO List :-)

I need to list up my interest

1. AMELiA -- a C++ library -- pattern recognition
2. Boost -- a C++ library -- "meta-programming"
3. POCO -- a cute C++ library -- should learn more
4. Cross-compiling -- ARM9 -- gcc-toolchain
5. Dealing with DSP (OMAP = ARM9+C6x) -- Linux or FreeRTOS or MakingMyOwnOS -- Linux would be my consideration as underlying OS -- possibly could be extended to TheNewOS :-)
6. Wt -- a C++ webinterface

7. Cocoa
8. openFrameworks
9. iPhone development
10. Android