Difference between revisions of "Setting up a native-compilation toolchain"


From SamyGO
Jump to: navigation, search
(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…')
 
 
Line 4: Line 4:
  
 
Before start ing, please check this packages are installed on your system:
 
Before start ing, please check this packages are installed on your system:
apt-get install deboostrap nfs-kernel-server nfs-common portmap
+
    apt-get install deboostrap nfs-kernel-server nfs-common portmap
  
At on a non-debian system download and install the debootstrap package manually
+
On a non-debian system download and install the '''debootstrap''' package manually
 
http://ftp.de.debian.org/debian/pool/main/d/debootstrap/
 
http://ftp.de.debian.org/debian/pool/main/d/debootstrap/
  
Line 20: Line 20:
 
/armel-chroot <server-domain, like 192.168.1.0>/255.255.255.0(rw,sync,insecure,no_subtree_check,no_root_squash)
 
/armel-chroot <server-domain, like 192.168.1.0>/255.255.255.0(rw,sync,insecure,no_subtree_check,no_root_squash)
  
Than execute
+
Than execute command of
 
     exportfs -a
 
     exportfs -a
command. This will apply changes to system.
+
This will apply changes to system.
You might need restart nfs and portmap services...
+
You ''might'' need restart nfs and portmap services after change too.
  
 
==Mount the NFS chroot share on the TV==
 
==Mount the NFS chroot share on the TV==
 
+
At this stage, you needed to mount NFS directory to TV for continue debootstrap's second stage.
 
     export chroot_share=<server>:/path/to/armel-chroot
 
     export chroot_share=<server>:/path/to/armel-chroot
 
     export armel_chroot=/dtv/usb/sda2/armel-chroot
 
     export armel_chroot=/dtv/usb/sda2/armel-chroot
Line 35: Line 35:
  
 
==Second Stage debootstrap==
 
==Second Stage debootstrap==
this one takes a while
+
This step takes longer time mainly because of TV's processing speed.
  
 
     export busybox=/dtv/usb/sda2/busybox
 
     export busybox=/dtv/usb/sda2/busybox
Line 94: Line 94:
 
     deb-src 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
 
     deb http://security.debian.org/ lenny/updates main contrib non-free
Ttan you can install anything you like, e.g.
+
Than you can install anything you like, e.g.
 
     apt-get update
 
     apt-get update
 
     apt-get install strace
 
     apt-get install strace

Latest revision as of 00:06, 1 November 2009

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

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 command of

   exportfs -a

This will apply changes to system. You might need restart nfs and portmap services after change too.

Mount the NFS chroot share on the TV

At this stage, you needed to mount NFS directory to TV for continue debootstrap's second stage.

   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 step takes longer time mainly because of TV's processing speed.

   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

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

   apt-get update
   apt-get install strace