This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
mission:tech:odyssey:sku:software [2012-04-05 23:28] – [Prepare HBT-Environment] chrono | mission:tech:odyssey:sku:software [2013-06-05 14:34] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Off-Board build-environment for ARM ====== | ||
+ | |||
+ | To compile your own image you have to build a toolchain able to produce binary files that can run on the Netus G20. It's powered by a ARM926EJ-S™ ARM® Thumb® Processor, which means that you have to prepare a (cross)compiler for ARMV5TE architecture. Although it's possible to compile a lot of packages on the SKU itself, it's far more convenient and faster to compile the packages on a more powerful system | ||
+ | |||
+ | ===== Prepare HBT-Environment ===== | ||
+ | |||
+ | To improve structure and reduce the risk of of // | ||
+ | |||
+ | * The Host | ||
+ | * The Build container | ||
+ | * The Target container | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | ==== Base Structure ==== | ||
+ | |||
+ | <code bash> | ||
+ | mkdir -p / | ||
+ | </ | ||
+ | |||
+ | It's recommended to use a 64 bit version, when your host is running on 64bit. | ||
+ | |||
+ | <code bash> | ||
+ | cd / | ||
+ | wget http:// | ||
+ | wget http:// | ||
+ | </ | ||
+ | |||
+ | create support scripts: | ||
+ | \\ | ||
+ | |||
+ | The $BEROOT variable: | ||
+ | |||
+ | <code bash> | ||
+ | export BEROOT=/ | ||
+ | </ | ||
+ | |||
+ | ==== Create a new Build-Environment container ==== | ||
+ | |||
+ | From here on you should be able to use copy& | ||
+ | |||
+ | <code bash> | ||
+ | mkdir $BEROOT | ||
+ | cd $BEROOT | ||
+ | cp $BEROOT/ | ||
+ | cp $BEROOT/ | ||
+ | tar xfjpv stage3-amd64-20101118.tar.bz2 -C $BEROOT | ||
+ | tar xfvj portage-latest.tar.bz2 -C $BEROOT/usr | ||
+ | </ | ||
+ | |||
+ | little helper to easily enter the build-env in the future | ||
+ | |||
+ | < | ||
+ | vi $BEROOT/ | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | echo " | ||
+ | env-update && source / | ||
+ | export SYSROOT="/ | ||
+ | cd $HOME | ||
+ | exec /bin/bash | ||
+ | </ | ||
+ | |||
+ | Change the permission to make it execuatble | ||
+ | |||
+ | < | ||
+ | |||
+ | for more comfort your can change your bash prompt to see that you're chrooted | ||
+ | |||
+ | <code bash> | ||
+ | echo " | ||
+ | </ | ||
+ | |||
+ | your gentoo base system is now almost ready to enter | ||
+ | |||
+ | <code bash> | ||
+ | cp -L / | ||
+ | mount -t proc proc $BEROOT/ | ||
+ | mount -o rbind /dev $BEROOT/dev | ||
+ | </ | ||
+ | |||
+ | ===chroot=== | ||
+ | |||
+ | <code bash> | ||
+ | chroot ${EGROOT} / | ||
+ | </ | ||
+ | |||
+ | === Update & Preparation of the Build-Environment === | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | Prepare the make.conf of the build-environment | ||
+ | |||
+ | <code bash> | ||
+ | CFLAGS=" | ||
+ | CXXFLAGS=" | ||
+ | CHOST=" | ||
+ | MAKEOPTS=" | ||
+ | |||
+ | USE="" | ||
+ | |||
+ | GENTOO_MIRRORS=" | ||
+ | http:// | ||
+ | |||
+ | PORTDIR_OVERLAY=/ | ||
+ | </ | ||
+ | |||
+ | Create the local portage overlay | ||
+ | |||
+ | <code bash> | ||
+ | mkdir / | ||
+ | mkdir / | ||
+ | </ | ||
+ | |||
+ | |||
+ | === emerge crossdev === | ||
+ | |||
+ | setting up portage to choose latest crossdev | ||
+ | |||
+ | < | ||
+ | nano / | ||
+ | </ | ||
+ | |||
+ | content | ||
+ | |||
+ | < | ||
+ | sys-devel/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | Finally emerge the crossdev tools | ||
+ | |||
+ | <code bash> | ||
+ | |||
+ | === build crossdev chain === | ||
+ | |||
+ | Now it's start to set up the toolchain | ||
+ | |||
+ | USE=-* crossdev -t armv5tejl-softfloat-linux-gnueabi | ||
+ | |||
+ | The above didnt work in any combination, | ||
+ | armv5te-softfloat-linux-gnueabi however worked with default values like a charm. Need to test if the compiled code will work in the AT91 and if there are other complications. | ||
+ | |||
+ | < | ||
+ | crossdev -v -t armv5te-softfloat-linux-gnueabi | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | The output will hopefully look similar to this: | ||
+ | |||
+ | <code bash> | ||
+ | * crossdev version: | ||
+ | * Host Portage ARCH: amd64 | ||
+ | * Target Portage ARCH: arm | ||
+ | * Target System: | ||
+ | * Stage: | ||
+ | |||
+ | * binutils: | ||
+ | * gcc: | ||
+ | * headers: | ||
+ | * libc: glibc-[latest] | ||
+ | |||
+ | * PORTDIR_OVERLAY: | ||
+ | * PORT_LOGDIR: | ||
+ | * PORTAGE_CONFIGROOT: | ||
+ | |||
+ | * Forcing the latest versions of {binutils, | ||
+ | * Emerging cross-binutils ... [ ok ] | ||
+ | * Emerging cross-linux-headers-quick ... [ ok ] | ||
+ | * Emerging cross-glibc-headers ... [ ok ] | ||
+ | * Emerging cross-gcc-stage1 ... [ ok ] | ||
+ | * Emerging cross-linux-headers ... [ ok ] | ||
+ | * Emerging cross-glibc ... [ ok ] | ||
+ | * Emerging cross-gcc-stage2 ... [ ok ] | ||
+ | </ | ||
+ | |||
+ | At this point the cross toolchain is successfully installed, usually you can proceed without the next step but better to be safe than sorry, check if the toolchain works, simply launch: | ||
+ | |||
+ | <code bash> | ||
+ | [EG-CHROOT] ~ $ armv5te-softfloat-linux-gnueabi-gcc --version | ||
+ | armv5te-softfloat-linux-gnueabi-gcc (Gentoo 4.5.1-r1 p1.3, pie-0.4.5) 4.5.1 | ||
+ | Copyright (C) 2010 Free Software Foundation, Inc. | ||
+ | This is free software; see the source for copying conditions. | ||
+ | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== set up the target infrastructure ==== | ||
+ | |||
+ | Next set up the target infrastructure | ||
+ | |||
+ | <code bash> | ||
+ | mkdir ${SYSROOT}/ | ||
+ | cp / | ||
+ | mkdir -p " | ||
+ | </ | ||
+ | |||
+ | |||
+ | Prepare the make.conf of the target-environment | ||
+ | |||
+ | < | ||
+ | nano ${SYSROOT}/ | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | # | ||
+ | # make.conf for Netus G20 ARM Embedded System | ||
+ | # | ||
+ | |||
+ | CHOST=armv5tejl-softfloat-linux-gnueabi | ||
+ | CBUILD=i686-pc-linux-gnu | ||
+ | ROOT=/ | ||
+ | ARCH=" | ||
+ | |||
+ | MAKEOPTS=" | ||
+ | ACCEPT_KEYWORDS=" | ||
+ | CFLAGS=" | ||
+ | CXXFLAGS=" | ||
+ | LDFLAGS=" | ||
+ | |||
+ | |||
+ | USE=" | ||
+ | |||
+ | |||
+ | PKG_CONFIG_PATH=" | ||
+ | FEATURES=" | ||
+ | PORTDIR_OVERLAY="/ | ||
+ | PKGDIR=${ROOT}/ | ||
+ | PORTAGE_TMPDIR=${ROOT}/ | ||
+ | PORTAGE_WORKDIR_MODE=2775 | ||
+ | PORTAGE_ECLASS_WARNING_ENABLE=0 | ||
+ | CLEAN_DELAY=0 | ||
+ | EPAUSE_IGNORE=1 | ||
+ | EBEEP_IGNORE=1 | ||
+ | |||
+ | GENTOO_MIRRORS=" | ||
+ | http:// | ||
+ | |||
+ | VIDEO_CARDS="" | ||
+ | INPUT_DEVICES="" | ||
+ | </ | ||
+ | |||
+ | original: | ||
+ | |||
+ | lrwxrwxrwx 1 root root 30 Nov 22 08:18 / | ||
+ | |||
+ | |||
+ | < | ||
+ | ln -s / | ||
+ | </ | ||
+ | |||
+ | |||
+ | xkmake: A cross kernel make wrapper | ||
+ | |||
+ | < | ||
+ | nano / | ||
+ | </ | ||
+ | |||
+ | |||
+ | <code bash> | ||
+ | #!/bin/sh | ||
+ | exec make ARCH=" | ||
+ | </ | ||
+ | |||
+ | === Kernel === | ||
+ | |||
+ | < | ||
+ | USE=" | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | <code bash> | ||
+ | cd / | ||
+ | wget http:// | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | patch -p1 < linux-2.6.35.4-foxg20-patches | ||
+ | |||
+ | patching file arch/ | ||
+ | patching file arch/ | ||
+ | patching file arch/ | ||
+ | </ | ||
+ | |||
+ | Download example Kernel configuration file: | ||
+ | |||
+ | <code bash> | ||
+ | $ wget http:// | ||
+ | $ mv linux-2.6.35.4-foxg20-config .config | ||
+ | </ | ||
+ | |||
+ | Download the **makefile** (with minus m) useful to simplify the compiling command: | ||
+ | |||
+ | <code bash> | ||
+ | $ wget http:// | ||
+ | $ mv linux-2.6.35.4-foxg20-makefile makefile | ||
+ | </ | ||
+ | |||
+ | |||
+ | to get pps working | ||
+ | |||
+ | < | ||
+ | Device drivers -> PPS support | ||
+ | * Enable high-resolution timestamps | ||
+ | * Enable ' | ||
+ | </ | ||
+ | |||
+ | otherwise ldattach: cannot set line discipline: Invalid argument | ||
+ | |||
+ | === create sd card === | ||
+ | |||
+ | tune2fs -c 0 -i 0 /dev/xyz | ||
+ | |||
+ | |||
+ | Why not jffs2 or ubifs | ||
+ | |||
+ | What about file systems like jffs2 and ubifs, which are aware of flash card wearing? | ||
+ | SD cards, according to SanDisk specs, should have wear leveling logic, which controls the number of writes and remaps blocks as needed. Wear-aware file systems might actually play against the logic of the card and are usually not recommendable. | ||
+ | |||
+ | ==== Software ==== | ||
+ | |||
+ | gpsd-2.95 | ||
+ | |||
+ | before emerging chrony: | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | wget " | ||
+ | cd / | ||
+ | wget http:// | ||
+ | |||
+ | </ | ||
+ | |||
+ | chrony-1.24 | ||
+ | |||
+ | setserial | ||
+ | |||
+ | < | ||
+ | localhost ~ # setserial /dev/ttyS1 low_latency | ||
+ | localhost ~ # ldattach 18 / | ||
+ | [ 419.370000] new PPS source atmel_serial1 at ID 0 | ||
+ | [ 419.370000] PPS source #0 "/ | ||
+ | </ | ||
+ | |||
+ | {{tag> | ||