You are not logged in.
Hi emgi,
I read that you need to install this toolchain into the chroot environment.
How to build your chroot environment.
Open terminal. Become root:
[c]$ su
password[/c]
Install tazdev package:
[c]# tazpkg -gi tazdev
. . .[/c]
Make folder for your chroot. Let it be /home/slitaz/arm/chroot this time:
[c]# mkdir -p /home/slitaz/arm/chroot[/c]
Generate root filesystem in chroot folder:
[c]# tazdev gen-chroot /home/slitaz/arm/chroot[/c]
Ok, now you have simple filesystem in your chroot. Next, every time you want to work with your chroot, you need to go these steps:
Become root if you not already do it.
To enter to chroot environment:
[c]# tazdev chroot /home/slitaz/arm/chroot[/c]
Now you are in chroot. I think, you need to setup cook utility?
[c]# cook setup
. . .[/c]
Now, after all, you need to build package. You'll find your chrooted wok (place to keep receipts and compilation site) from outside of chroot (from your regular system) here: /home/slitaz/arm/chroot/home/slitaz/wok
I now what to do next with regular 486 system packages, and don't know how to build packages for ARM processors.
Create or copy receipt, let's say for busybox: from chrooted terminal type:
[c]cook new busybox[/c]
You can find new empty receipt in your chrooted wok: /home/slitaz/arm/chroot/home/slitaz/wok/busybox/receipt
Now you can edit this receipt, or copy original SliTaz receipt and put it here. Don't forget about other stuff.
You can install whole wok locally (see cook help: type 'cook' without any options), and you can browse wok using Hg interface and copy only files you need, here you can find busybox receipt with all other stuff: http://hg.slitaz.org/wok/file/tip/busybox
how to convert a package or source(?) from Intel to ARM?
Converting sources to binary programs also called 'compiling' 
Now, if you have busybox receipt with its stuff, you can compile it. From chrooted terminal:
[c]# cook busybox
. . .[/c]
But I skip step that I don't know (how to build packages exclusively for ARM), and you'll get busybox package, but for 486 type processors. You'll find builded package in the folder:
- inside chroot: /home/slitaz/packages/busybox-x.y.z.tazpkg
- outside chroot: /home/slitaz/arm/chroot/home/slitaz/packages/busybox-x.y.z.tazpkg
I think, you need now help of other forum guys. I think I shed a little light to some questions.
Offline
Hi Aleksej,
Thnx for bothering to reply. I already managed setting up a chroot environment but the way you suggest uses yet another slightly different path. I guess the path itself is ambivalent as long as u use it consistently? The one you suggest I like. Besides, you made some good suggestions on how to proceed once the whole thing has been set up. I'll get there!
What I really need more details on for now is how to install the arm-toolchain.
Anybody else perhaps?
/emgi
Offline
Read this info ?
http://hg.slitaz.org/cookutils/file/f3eb8e8e9d2e/README
http://hg.slitaz.org/cookutils/file/f3eb8e8e9d2e/doc/cross.txt
Offline
Aye. Please check my other thread on this. I followed the steps described in cross.txt and ran aground with the command: cook arm-setup. The readme file provides some info but unfortunately not on my level. ;-)
A small excerpt from the README to illustrate my point:
142 Toolchain
143 --------------------------------------------------------------------------------
144 To rebuild the full SliTaz toolchain at once - cook and the Cooker will use the
145 slitaz-toolchain package. No built-in code manages that since it is not a
146 common task. The toolchain package will build all needed packages in the correct
147 order, which is very important.
Great(!) but I have a 52MB arm-toolchain-file which I am supposed to install somewhere.
My problem is that I cannot find how & where this should be done.
/emgi
Offline
Hi emgi,
Great(!) but I have a 52MB arm-toolchain-file which I am supposed to install somewhere.
My problem is that I cannot find how & where this should be done.
1.
root@slitaz:/# tar -jtvf /tmp/slitaz-arm-toolchain-armhf-20120630.tar.bz2 | grep README
-rw-r--r-- root/root 499 2012-07-02 10:25:00 cross/README
-rw-r--r-- root/root 750 2012-07-01 02:44:13 cross/arm/tools/lib/gcc/arm-slitaz-linux-gnueabi/4.6.3/install-tools/include/README
-rw-r--r-- root/root 750 2012-07-01 02:41:43 cross/arm/tools/lib/gcc/arm-slitaz-linux-gnueabi/4.6.3/include-fixed/README
2.
root@slitaz:/# cat /cross/README
SliTaz Prebuilt arm cross toolchain
================================================================================
Move this arm cross compilation toolchain to /cross then add tools
to your PATH environment and test the toolchain:
# mv arm /cross
# export PATH=$PATH:/cross/arm/tools/bin
# echo 'int main() { return 0; }' > test.c
# arm-slitaz-linux-gnueabi-gcc -v -o test.out test.c
# readelf -h test.out
================================================================================
3.
root@slitaz:/# ls /cross/arm/tools/bin
arm-slitaz-linux-gnueabi-addr2line arm-slitaz-linux-gnueabi-gprof
arm-slitaz-linux-gnueabi-ar arm-slitaz-linux-gnueabi-ld
arm-slitaz-linux-gnueabi-as arm-slitaz-linux-gnueabi-ld.bfd
arm-slitaz-linux-gnueabi-c++ arm-slitaz-linux-gnueabi-nm
arm-slitaz-linux-gnueabi-c++filt arm-slitaz-linux-gnueabi-objcopy
arm-slitaz-linux-gnueabi-cpp arm-slitaz-linux-gnueabi-objdump
arm-slitaz-linux-gnueabi-elfedit arm-slitaz-linux-gnueabi-ranlib
arm-slitaz-linux-gnueabi-g++ arm-slitaz-linux-gnueabi-readelf
arm-slitaz-linux-gnueabi-gcc arm-slitaz-linux-gnueabi-size
arm-slitaz-linux-gnueabi-gcc-4.6.3 arm-slitaz-linux-gnueabi-strings
arm-slitaz-linux-gnueabi-gcov arm-slitaz-linux-gnueabi-strip
root@slitaz:/#
Offline
Create a chroot (use last tazdev)
cross.txt
26 Create a chroot (use last tazdev)
27 ---------------------------------
28 # tazdev gen-chroot --arch=arm
29 # tazdev chroot
30
31 Clone cookutils to get last cook and cross
# wget http://mirror.slitaz.org/packages/cooking/tazdev-1.9.tazpkg
# tazpkg -i tazdev-1.9.tazpkg
Offline
qemu-arm-static chroot
1.
root@slitaz:~# uname -a
Linux slitaz 2.6.37-slitaz #1 SMP Fri May 10 17:42:01 CST 2013 i686 GNU/Linux
2.
root@slitaz:~# tazdev -c /opt/rootfs-armhf/
Mounting virtual filesystems... [ Done ]
Chrooting to: /opt/rootfs-armhf/
3.
root@slitaz:/# uname -m
armv6l
4.
root@slitaz:/# readelf -A /lib/libc-2.13.so
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "6"
Tag_CPU_arch: v6
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_FP_arch: VFPv2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_HardFP_use: SP and DP
Tag_ABI_VFP_args: VFP registers
Tag_DIV_use: Not allowed
5.
root@slitaz:/# head -5 /var/lib/tazpkg/installed.md5
bbb30be1a2c704154f58e2df501e35fd busybox-1.20.2-armhf.tazpkg
a82e5ffd86838571addf3eee3f418c7b dropbear-2012.55-armhf.tazpkg
7015c541e061e277c07f023073faad92 gcc-lib-base-4.6.3-armhf.tazpkg
d165510417ebc3d1e6bf37c96b9db8d8 gettext-base-0.18.1.1-armhf.tazpkg
2f4a5d282889c6fbd228a974822bd0d9 glibc-base-2.13-armhf.tazpkg
6.
root@slitaz:/# tazpkg list | tail -2
18 packages installed
7.
root@slitaz:/# du -sh /
13.4M /
root@slitaz:/#
[attachment=26258,1170]
Offline
qemu user mode and binfmt_misc
1.1 Features
http://qemu.weilnetz.de/qemu-doc.html#Introduction
QEMU is a FAST! processor emulator using dynamic translation to achieve good emulation speed.
QEMU has two operating modes:
Full system emulation. In this mode, QEMU emulates a full system (for example a PC), including one or several processors and various peripherals. It can be used to launch different Operating Systems without rebooting the PC or to debug system code.
User mode emulation. In this mode, QEMU can launch processes compiled for one CPU on another CPU. It can be used to launch the Wine Windows API emulator (http://www.winehq.org) or to ease cross-compilation and cross-debugging.
Kernel Support for miscellaneous (your favourite) Binary Formats v1.1
==============================================================
https://www.kernel.org/doc/Documentation/binfmt_misc.txt
This Kernel feature allows you to invoke almost (for restrictions see below)
every program by simply typing its name in the shell.
This includes for example compiled Java(TM), Python or Emacs programs.
To achieve this you must tell binfmt_misc which interpreter has to be invoked
with which binary. Binfmt_misc recognises the binary-type by matching some bytes
at the beginning of the file with a magic byte sequence (masking out specified
bits) you have supplied. Binfmt_misc can also recognise a filename extension
aka '.com' or '.exe'.
First you must mount binfmt_misc:
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
Ref:
https://wiki.edubuntu.org/UbuntuDevelopment/Ports
Offline
rootfs-armhf
1.
# wget http://mirror.slitaz.org/packages/cooking/util-linux-mount-2.21.1.tazpkg
# tazpkg -i util-linux-mount-2.21.1.tazpkg
# wget http://arm.balinor.net/slitaz/armhf/slitaz-armhf-mini-2012-12-14.zip
# unzip slitaz-armhf-mini-2012-12-14.zip
2.
root@slitaz:~# file slitaz-armhf-mini-2012-12-14.img
slitaz-armhf-mini-2012-12-14.img: x86 boot sector; partition 1: ID=0x6, starthead 1, startsector 63, 48132 sectors; partition 2: ID=0x83, starthead 0, startsector 48195, 915705 sectors, code offset 0xb8
root@slitaz:~# fdisk -lu slitaz-armhf-mini-2012-12-14.img
Disk slitaz-armhf-mini-2012-12-14.img: 536 MB, 536870912 bytes
255 heads, 63 sectors/track, 65 cylinders, total 1048576 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
slitaz-armhf-mini-2012-12-14.img1 63 48194 24066 6 FAT16
slitaz-armhf-mini-2012-12-14.img2 48195 963899 457852+ 83 Linux
root@slitaz:~#
3.
root@slitaz:~# mount -o,offset=$((48195*512)) slitaz-armhf-mini-2012-12-14.img /mnt/raspi
4.
root@slitaz:~# cp -a /mnt/raspi /opt/rootfs-armhf
5.
root@slitaz:~# ls -l /opt/rootfs-armhf
total 68
drwxr-xr-x 2 root root 4096 Dec 3 2012 bin
drwxr-xr-x 2 root root 4096 Dec 14 2012 boot
drwxr-xr-x 8 root root 4096 Dec 3 2012 dev
drwxr-xr-x 7 root root 4096 Dec 14 2012 etc
drwxr-xr-x 2 root root 4096 Dec 3 2012 home
lrwxrwxrwx 1 root root 12 Jun 19 20:03 init -> /bin/busybox
drwxr-xr-x 2 root root 4096 Dec 3 2012 lib
drwx------ 2 root root 4096 Dec 3 2012 lost+found
drwxr-xr-x 5 root root 4096 Dec 3 2012 media
drwxr-xr-x 2 root root 4096 Dec 3 2012 mnt
drwxr-xr-x 2 root root 4096 Dec 3 2012 proc
drwxr-x--- 2 root root 4096 Dec 3 2012 root
drwxr-xr-x 2 root root 4096 Dec 3 2012 run
drwxr-xr-x 2 root root 4096 Dec 3 2012 sbin
drwxr-xr-x 2 root root 4096 Dec 3 2012 sys
drwxrwxrwt 2 root root 4096 Dec 3 2012 tmp
drwxr-xr-x 8 root root 4096 Dec 14 2012 usr
drwxr-xr-x 11 root root 4096 Dec 3 2012 var
root@slitaz:~# file /opt/rootfs-armhf/lib/libc-2.13.so
/opt/rootfs-armhf/lib/libc-2.13.so: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, stripped
root@slitaz:~# du -sh /opt/rootfs-armhf
9.2M /opt/rootfs-armhf
root@slitaz:~#
Offline
Chrooting to: /opt/rootfs-armhf/
root@slitaz:~# ls -l /opt/rootfs-armhf
1. download qemu-arm-static-1.1.2.tazpkg
http://tiny.cc/rh7wyw
# tazpkg -i qemu-arm-static-1.1.2.tazpkg
2. copy qemu-arm-static to rootfs-armhf
# cp /usr/bin/qemu-arm-static /opt/rootfs-armhf/usr/bin
3. Mount the binfmt_misc handler
# modprobe binfmt_misc
# mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc
4. register our format with the kernel via the procfs
root@slitaz:~# echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register
5. check register
root@slitaz:~# cat /proc/sys/fs/binfmt_misc/arm
enabled
interpreter /usr/bin/qemu-arm-static
flags:
offset 0
magic 7f454c4601010100000000000000000002002800
mask ffffffffffffff00ffffffffffff00fffeffffff
6. chroot rootfs-armhf
root@slitaz:~# tazdev -c /opt/rootfs-armhf/
Mounting virtual filesystems... [ Done ]
Chrooting to: /opt/rootfs-armhf/
7.
root@slitaz:/# uname -m
armv6l
8.
root@slitaz:/# echo -e 'nameserver 8.8.8.8\n' > /etc/resolv.conf
root@slitaz:/# nslookup 'www.slitaz.org'
Server: 8.8.8.8
Address 1: 8.8.8.8 google-public-dns-a.google.com
Name: 'www.slitaz.org'
Address 1: 94.23.61.29 pangolin.pimentvert.com
Address 2: 91.121.171.224 ks362096.kimsufi.com
root@slitaz:/#
Offline
GNU C Library (EGLIBC) stable release version 2.13,
GNU C Library stable release version 2.13,
root@slitaz:~# file /opt/rootfs-armhf/lib/libc-2.13.so
/opt/rootfs-armhf/lib/libc-2.13.so: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, stripped
1. slitaz-armhf: eglibc-2.13
root@slitaz:/# file /lib/libc-2.13.so
/lib/libc-2.13.so: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, stripped
root@slitaz:/#
root@slitaz:/# /lib/libc-2.13.so
GNU C Library (EGLIBC) stable release version 2.13, by Roland McGrath et al.
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.6.3.
Compiled on a Linux 3.2.14 system on 2012-06-30.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
Support for some architectures added on, not maintained in glibc core.
BIND-8.2.3-T5B
libc ABIs: UNIQUE
For bug reporting instructions, please see:
<http://www.eglibc.org/issues/>.
2.
root@slitaz:/# exit
Unmounting virtual filesystems... [ Done ]
3. slitaz-4.0: glibc-2.13
root@slitaz:~# uname -a
Linux slitaz 2.6.37-slitaz #1 SMP Fri May 10 17:42:01 CST 2013 i686 GNU/Linux
root@slitaz:~# file /lib/libc-2.13.so
/lib/libc-2.13.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.30, stripped
root@slitaz:~# /lib/libc-2.13.so
GNU C Library stable release version 2.13, by Roland McGrath et al.
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.5.2.
Compiled on a Linux 2.6.37 system on 2012-03-13.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.
root@slitaz:~#
Offline
Compiling with qemu-arm-static chroot
Target: arm-slitaz-linux-gnueabi
--build=arm-slitaz-linux-gnueabi --host=arm-slitaz-linux-gnueabi
1.
root@slitaz:~# uname -a
Linux slitaz 2.6.37-slitaz #1 SMP Fri May 10 17:42:01 CST 2013 i686 GNU/Linux
2.
root@slitaz:~# tazdev -c /opt/rootfs-armhf
Mounting virtual filesystems... [ Done ]
Chrooting to: /opt/rootfs-armhf
3.
root@slitaz:/# gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-slitaz-linux-gnueabi/4.6.3/lto-wrapper
Target: arm-slitaz-linux-gnueabi
Configured with: /home/slitaz/wok/gcc/source/gcc-4.6.3/configure --prefix=/usr --libexecdir=/usr/lib --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long --enable-__cxa_atexit --with-system-zlib --enable-plugin --disable-multilib --disable-libssp --disable-checking --disable-werror --disable-bootstrap --enable-clocale=gnu --enable-lto --enable-threads=posix --with-arch=armv6 --with-fpu=vfp --with-float=hard --with-pkgversion=SliTaz --build=arm-slitaz-linux-gnueabi --host=arm-slitaz-linux-gnueabi
Thread model: posix
gcc version 4.6.3 (SliTaz)
4.
root@slitaz:/# echo 'int main() { return 0; }' > test.c
root@slitaz:/# gcc -o test.o test.c
root@slitaz:/# ls -l test*
-rw-r--r-- 1 root root 25 Jun 9 13:59 test.c
-rwxr-xr-x 1 root root 6790 Jun 9 13:59 test.o
5.
root@slitaz:/# file test.o
test.o: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped
root@slitaz:/# readelf -A test.o
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "6"
Tag_CPU_arch: v6
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_FP_arch: VFPv2
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_HardFP_use: SP and DP
Tag_ABI_VFP_args: VFP registers
Tag_DIV_use: Not allowed
root@slitaz:/#
Offline
Guys,
there seems to be this as a bigger problem. Every time someone wants to start out on development, setting up the build system is a very big problem. Can we have something stable iso which has the required setup inbuilt? Whosoever is done with completing the setup can either create an iso out of his system and post it or just make a small script out of the process so that preparing the system is not a pain for everyone.
Offline
Ref:
http://forum.slitaz.org/topic/chroot/page/2#post-23303
Slitaz Cookutils
http://hg.slitaz.org/cookutils/raw-file/tip/doc/cookutils.en.html
Slitaz armhf toolchain
http://arm.balinor.net/slitaz/armhf/slitaz-arm-toolchain-armhf-20120630.tar.bz2
yourself
http://hg.slitaz.org/cookutils/file/3d20efa09240/doc/cross.txt
1. slitaz-arm-toolchain-armhf-20120630.tar.bz2 =
45 # cross download + 46 # cross compile
2. keep it simple
26 Create a chroot (use last tazdev)
39 Setup the build environment, <strike>get source and compile a cross toolchain</strike>
3. cross.txt
http://hg.slitaz.org/cookutils/file/3d2 … /cross.txt
cookutils view doc/cross.txt @ 558:3d20efa09240
[..]
17 HOWTO:
18 When building a cross toolchain it's better to understand what is a
19 linker or C compiler such as GCC. The configure option --target is
20 used by 'cross' to build cross-tools. When the toolchain is built on
21 your machine you can then build packages with cook and the wok. Cross
22 uses by default the same source tarballs as cook but the path can be
23 changed via the config file. Configuration is: cross.conf. Here is a
24 cmdline howto:
25
26 Create a chroot (use last tazdev)
27 ---------------------------------
28 # tazdev gen-chroot --arch=arm
29 # tazdev chroot
30
31 Clone cookutils to get last cook and cross
32 ------------------------------------------
33 # tazpkg -gi mercurial
34 # tazpkg -gi make
35 # cd && hg clone http://hg.slitaz.org/cookutils
36 # cd cookutils
37 # make install-cross
38
39 Setup the build environment, get source and compile a cross toolchain
40 ---------------------------------------------------------------------
41 # cook arm-setup
42 # cook setup
43 (vi/nano /etc/slitaz/cross.conf)
44 # cross check
45 # cross download
46 # cross compile
47
48 Test the cross toolchain
49 ------------------------
50 # cross testsuite
51
52 AUTHORS
53 Written by Christophe Lincoln
Offline
[ Generated in 0.017 seconds, 7 queries executed - Memory usage: 1.59 MiB (Peak: 1.77 MiB) ]