Set of simple scripts and instructions for cross-compiling customized, Arch Linux(ARM) based distro for Raspberry Pi(or with some modifications for any similar embedded device).
Well, I started this "project" when there only was armv5 image from Arch Linux ARM and I wanted to check how much performance it would gain from enabling hardware FPU and compiling everything specifically for Raspberry Pi hardware like Raspbian did. And I also wanted to remove stuff I dont really use on that device like LDAP, nfsv4, etc.
- Install qemu with support for desired architecture(and probably also other stuff I forgot to mention)
- You may want to edit some config files in
config/
directory.- customize
RB_*
inhost.conf
- customize
- Run
. bin/activate
to enable special variables, custom scripts etc. - Install crosstool-NG
- Preferably
./configure --prefix ${RB_WORKDIR}/host
- Preferably
- Install scratchbox2
- Preferably
./configure --prefix ${RB_WORKDIR}/host
- Preferably
- Build sysroot with crosstool-NG (there is example config I use in
config/
)ct-ng menuconfig
- to configurect-ng build
- to build
- Initialize scratchbox2 directory
sb2-init -n -d -c "${RB_QEMU}" "${RB_BUILDNAME}" "${RB_READYDIR}/bin/${RB_TARGET_HOST}-gcc"
in${RB_TARGETDIR}
directory.- Adjust config files generated by scratchbox in
~/.scratchbox2/${RB_BUILDNAME}/sb2.config.d/
gcc.config.lua
extra_cross_compiler_args
+=-L@SBOX_TARGET_ROOT@/opt/vc/lib -I@SBOX_TARGET_ROOT@/opt/vc/include -I@SBOX_TARGET_ROOT@/opt/vc/include/interface/vcos/pthreads
extra_cross_ld_args
+=:@SBOX_TARGET_ROOT@/opt/vc/lib
gcc.config.sh
SBOX_EXTRA_CROSS_COMPILER_ARGS
+=-L@SBOX_TARGET_ROOT@/opt/vc/lib -I@SBOX_TARGET_ROOT@/opt/vc/include -I@SBOX_TARGET_ROOT@/opt/vc/include/interface/vcos/pthreads
- Adjust scratchbox2 mapping in
${RB_WORKDIR}/host/share/scratchbox2/lua_scripts/pathmaps/simple/00_default.lua
:
-- -----------------------------------------------
-- 99. Other rules.
{prefix = "/usr/share/python", use_orig_path = true, readonly = true},
{prefix = "/usr/share/pyshared", use_orig_path = true, readonly = true},
{prefix = "/usr/lib/pymodules", use_orig_path = true, readonly = true},
{prefix = "/usr/lib/pyshared", use_orig_path = true, readonly = true},
{prefix = "/usr/lib/python", use_orig_path = true, readonly = true},
+ -- Change above python binings to this before compiling python
+ --{prefix = "/usr/bin/python", map_to = target_root},
+ --{prefix = "/usr/bin/python2", map_to = target_root},
{prefix = "/usr/lib/perl", map_to = tools},
+ -- Change above line to this before compiling and installing perl in sysroot
+ --{prefix = "/usr/bin/perl", map_to = target_root},
+ --{prefix = "/usr/share/perl5", map_to = target_root},
+ {prefix = "/opt", map_to = target_root},
+ -- Add below after compiling and installing libtool in sysroot
+ -- {prefix = "/usr/bin/libtool", map_to = target_root},
- Adjust sysroot created by crosstool-NG
- move
${RB_TARGETDIR}/lib
to${RB_TARGETDIR}/usr/lib
and symlink(ln -s
)lib
tousr/lib
- it's default on Arch Linux - move
${RB_TARGETDIR}/sbin
to${RB_TARGETDIR}/usr/bin
and symlink(ln -s
)sbin
tousr/bin
- it's default on Arch Linux, same with${RB_TARGETDIR}/usr/sbin
- create
${RB_TARGETDIR}/var/lib/pacman/
directory - change permissions in
${RB_TARGETDIR}/*
toroot:root
755
(recursive)
- move
- I'm getting PKGBUILDs from ABS or Arch Linux ARM repo or AUR
- There is
rb_autobuild
script that tries to automate part of the build EXPERIMENTAL - Ones adjusted and prepared for
rb_autobuild
are insources/
directory - Use
rb_makepkg
instead ofmakepkg
- it has patched support for scratchbox2 instead of fakeroot and usesmakepkg.conf
fromconfig/
- For building order check rb_autobuild