Setting up a native-compilation toolchain


From SamyGO
Revision as of 00:01, 1 November 2009 by Erdem ua (talk | contribs) (Created page with 'This page is a brief summary of the cross-compilation discussion on the SamyGO forum. Main contributors to this information are cowenchicken. The information in this page pertain…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page is a brief summary of the cross-compilation discussion on the SamyGO forum. Main contributors to this information are cowenchicken. The information in this page pertains to the building of a toolchain, based on the source code as stored in the file 32B650.zip, available from Samsung.

-This informations are verified on Debian lenny.-

Before start ing, please check this packages are installed on your system: apt-get install deboostrap nfs-kernel-server nfs-common portmap

At on a non-debian system download and install the debootstrap package manually http://ftp.de.debian.org/debian/pool/main/d/debootstrap/

Installing Debian Lenny in an NFS chroot

First Stage debootstrap

Run the following on your debian based (or debootstrap ready) workstation

   debootstrap --verbose --arch armel --foreign lenny /armel-chroot http://ftp.de.debian.org/debian

This gives you first stage linux image to /armel-chroot directory.

NFS export the chroot directory

I use the following options, not really sure all of them are relevant, but they work. edit "/etc/exports" file as /armel-chroot <server-domain, like 192.168.1.0>/255.255.255.0(rw,sync,insecure,no_subtree_check,no_root_squash)

Than execute

   exportfs -a

command. This will apply changes to system. You might need restart nfs and portmap services...

Mount the NFS chroot share on the TV

   export chroot_share=<server>:/path/to/armel-chroot
   export armel_chroot=/dtv/usb/sda2/armel-chroot
   
   mkdir -p $armel_chroot
   mount -o rw,soft,udp,async,nolock,rsize=32768,wsize=32768 $chroot_share $armel_chroot


Second Stage debootstrap

this one takes a while

   export busybox=/dtv/usb/sda2/busybox
   $busybox chroot $armel_chroot /debootstrap/debootstrap --second-stage

On some Linux distributions like ubuntu, you can get error at:

   I: Configuring mount...
   I: Configuring initscripts...
   I: Configuring sysvinit...
   W: Failure while configuring required packages.

If you have this error, than Edit /var/lib/dpkg/info/sysvinit.postinst

   #you have to comment them using # in front of them
   rm -f $INITCTL
   mkfifo -m 600 $INITCTL

than inside your chroot and run dpkg --configure -a (or something like this), you should get ride of this error and would be able to continue using apt-get/aptitude.

Getting into the chroot

You can use the following script to get into the chroot

   #!/bin/sh
   
   #options
   export chroot_share=<server>:/path/to/armel-chroot
   export armel_chroot=/dtv/usb/sda2/armel-chroot
   export busybox=/dtv/usb/sda2/busybox
   
   #mount the chroot nfs share
   mount -o rw,soft,udp,async,nolock,rsize=32768,wsize=32768 $chroot_share $armel_chroot
   
   #mount some important dirs
   mount -o bind /dev $armel_chroot/dev
   mount -o bind /dev/sam $armel_chroot/dev/sam
   mount -o bind /dev/pts $armel_chroot/dev/pts
   mount -o bind /proc $armel_chroot/proc
   mount -o bind /proc/bus/usb $armel_chroot/proc/bus/usb
   mount -o bind /sys $armel_chroot/sys
   
   #bind resolv.conf
   mount -o bind /etc/resolv.conf $armel_chroot/etc/resolv.conf
   
   #start the chroot
   $busybox chroot $armel_chroot /bin/bash --login
   
   #umount
   umount $armel_chroot/sys
   umount $armel_chroot/proc/bus/usb
   umount $armel_chroot/proc
   umount $armel_chroot/dev/pts
   umount $armel_chroot/dev/sam
   umount $armel_chroot/dev
   umount $armel_chroot/etc/resolv.conf
   
   umount $armel_chroot

Installing additional packages within the chroot

Make sure your /etc/apt/sources.list contains the following lines

   deb http://ftp.de.debian.org/debian lenny main contrib non-free
   deb-src http://ftp.de.debian.org/debian lenny main contrib non-free
   deb http://security.debian.org/ lenny/updates main contrib non-free

Ttan you can install anything you like, e.g.

   apt-get update
   apt-get install strace