[ELDK] RE : RE : RE : How can I build agin the toolchain ? (ELDK)

Marie Reine SARAZIN mr.sarazin at actiasodielec.fr
Fri Aug 20 11:23:13 CEST 2010


Dear Wolfgang,

I managed to ping the host from the VBH (the same in the inverse way) and log in on the VBH in ssh using the solution described on the link http://www.denx.de/wiki/DULG/AN2009_02_EldkReleaseBuildEnvironment
In fact I forgot to make the ifup-build script executable... When I did it, everything worked well.
As I did it on an other distribution : Ubuntu 9.4, here are the steps:

----------------------------------------------------------------------------------------------------------
//HOST : UBUNTU 9.4 

//log in root
$ sudo -s

//Download:
http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
//install the packages:
# get-apt alien
# alien -k rpmfusion-free-release-stable.noarch.rpm 
# alien -k rpmfusion-nonfree-release-stable.noarch.rpm 
# dpkg -i rpmfusion-free-release_11-2_all.deb 
# dpkg -i rpmfusion-nonfree-release_11-2_all.deb 
# apt-get install qemu
# apt-get install libvirt-bin
# apt-get install virt-manager
# apt-get install virt-viewer
# apt-get install virt-top
# apt-get install uml-utilities
# get-apt install lvm2

//Download the disk image for the root file system:
wget ftp://ftp.denx.de/pub/eldk/build-env/root-rh-7.3.img.gz

-----------------------------------------------------------------------
//Create a new 100G-partition with gparted and then the logical volume eldk_build thanks these steps:
# pvcreate /dev/sda8
# vgcreate vg0 /dev/sda8
# lvcreate -L 96G -n eldk_build vg0

//We can check:
# lvscan
  ACTIVE            '/dev/vg0/eldk_build' [96,00 GB] inherit
----------------------------------------------------------------------
# gedit /etc/modules.conf
//Ajouter : alias char-major-10-200 tun

----------------------------------------------------------------------
//Create this network script /etc/ifup-build :
#!/bin/sh
#
# script to bring up the tun device in QEMU in bridged mode
# first parameter is name of tap device (e.g. tap0)
#
#adresse du bridge:
ETH0IP=10.100.0.1

#adresse de la VBH:
GATEWAY=10.100.0.2 

BROADCAST=10.100.0.3 

# First take eth0 down, Add bridge, then bring it up with IP 0.0.0.0
ifconfig eth0 down
brctl addbr br0
ifconfig eth0 0.0.0.0 up

# Configure  the bridge, create bridge between eth0 and br0
# and add the default route
ifconfig br0 $ETH0IP netmask 255.255.255.0 broadcast $BROADCAST
brctl addif br0 eth0
route add default gw $GATEWAY

# Bring the TAP bridge network up, and intereface with br0
ifconfig $1 up
brctl addif br0 $1

# Enable packet forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

# Now we get funky - we do proxy arp for the virtual machine so it can be
# seen transparently on all of the network
echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
echo 1 > /proc/sys/net/ipv4/conf/$1/proxy_arp

--------------------------------------------------------------------
//Make it executable:
# chmod +x /etc/ifup-build
# chmod 0755 /etc/ifup-build
--------------------------------------------------------------------

//Create this network script /etc/ifdown-build :
#!/bin/sh
#
# Script to bring down and delete bridge br0 when QEMU exits
# Bring down eth0 and br0
ifconfig eth0 down
ifconfig br0 down

# Delete the bridge
brctl delbr br0

# bring up eth0 in "normal" mode
ifconfig eth0 0.0.0.0 -promisc up

--------------------------------------------------------------------
//Make it executable:
# chmod +x /etc/ifdown-build
# chmod 0755 /etc/ifdown-build
--------------------------------------------------------------------
//Create this script to lauch the virtual machine : /home/usr/Documents/eldk_build/rh73.sh
#!/bin/sh
# insert the tuntap module
sudo modprobe tun
#
# insert the bridge module
sudo modprobe bridge
#
# insert the kqemu module
sudo modprobe kqemu major=0
#
iface=`sudo tunctl -b`
sudo qemu -m 1024 -net nic,model=rtl8139 -net tap,ifname=$iface,script=/etc/ifup-build,downscript=/etc/ifdown-build -hda /home/usr/Bureau/root-rh-7.3.img -hdc /dev/vg0/eldk_build

sudo tunctl -d $iface &>/dev/null
-------------------------------------------------------------------
//Make it executable:
# chmod +x /home/usr/Documents/eldk_build/rh73.sh
# chmod 0755 /home/usr/Documents/eldk_build/rh73.sh
--------------------------------------------------------------------
//Run the script rh73.sh 
-------------------------------------------------------------------
//From the VBH:

//Log in as root:
login: root
password: Eldk!Root

//Create a file system on the logical volume:
# mke2fs -j /dev/hdc

mke2fs 1.27 (8-Mar-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
12582912 inodes, 25165824 blocks
1258291 blocks (5.00%) reserved for the super user
First data block=0
768 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632,
2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
----------------------------------------------------------------------------
//From the VBH:

//Enable the mounting of "/dev/hdc" in /etc/fstab:
#echo "/dev/hdc /opt ext3 defaults 1 2" >> /etc/fstab 

//Mount the logical volume on top of the "/opt" directory and make sure it gets exported over NFS: 
# mount /opt

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1             4.9G  3.3G  1.4G  70% /
none                  505M     0  504M   0% /dev/shm
/dev/hdc               94G   33M   89G   1% /opt

# exportfs -rav
exporting 10.0.0.0/255.0.0.0:/tftpboot
exporting 10.0.0.0/255.0.0.0:/tmp
exporting 10.0.0.0/255.0.0.0:/opt
exporting 10.0.0.0/255.0.0.0:/

//Create a working directory for the ELDK build steps:
# mkdir /opt/eldk
# chmod 01777 /opt/eldk

//Create a user :
useradd marie
//Check the user has been created
cat /etc/passwd

//Create $HOME directory for "builder" user:
# mkdir -p /opt/eldkbuild/home
# chown builder.builder /opt/eldkbuild/home

--------------------------------------------------------------------------
//=> Ping between bridge<-->eth0_VBH et between eth0_hote<-->eth0_VBH are working
--------------------------------------------------------------------------

//From the host:

//Mount the VBH's file system explicitely over NFS:
# apt-get install autofs
# mount -t nfs 10.100.0.2:/opt/eldk/ /mnt/eldk/
//=> From the host, we can access the directory /opt/eldk of the VBH thanks to the command line:
# cd /mnt/eldk

//=>From the host, we can log in on the target system as user "builder"  (password: Eldk!Builder)
 # ssh builder at 10.100.0.2
 -----------------------------------------------------------------------------

Note : I used scripts from http://technology-shettyprasad.blogspot.com/2009/01/qemu-tap-network-setup.html



Now next step is rebuilding the crosstool package as it contains gcc-4.2.2.
I didn't used the ELDK git repositories as SRPMS does not contains crosstool and gcc so I prefered using sources I had when I got ELDK. But I am not sure about which one I have to use. I have 2 directories : SRPMS wich contains 17 src.rpm, and target wich contains an other directory SRPMS which contains 146 items src.rpm. Each of them contains crosstool-0.43-1 . What is the difference between each one?

To try, I used the package crosstool-0.43-1.src.rpm from the first directory SRPMS.
I copied it in the directory /opt/eldk of the VBH and did:
${CROSS_COMPILE}rpm -i /opt/eldk/crosstool-0.43-1.src.rpm

According to your link : http://www.denx.de/wiki/view/DULG/ELDKRebuildingComponents#Section_3.8.3
I should find in /usr/src/denx spec file and sources. Actually, I found it in /usr/src/redhat. Hope it's normal.
(Or maybe I should I do it from the host but what would be the use of the VBH...?)
Then I started a building without modfying the sources just to see the normal way before beginning for real.

# unset CROSS_COMPILE
# cd /usr/src/redhat/SPECS
# /usr/bin/rpmbuild -ba crosstool.spec
error: parse error in expression
error: /usr/src/redhat/SPECS/crosstool.spec:35: parseExpressionBoolean returns -1
error: Package has no %description: crosstool

Could you help me with it?

Concerning chroot, you are right it works, I didn't used it well ! :)

Regards


More information about the eldk mailing list