Skip to content
This repository has been archived by the owner on Jan 8, 2021. It is now read-only.

Set of simple scripts and instructions for building customized, archlinux based distro for raspberrypi.

Notifications You must be signed in to change notification settings

Neverous/projects-raspi-build

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raspi Build

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).

Why?

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.

HOWTO (Step by step instructions)

1. Prepare host system

  • 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_* in host.conf
  • Run . bin/activate to enable special variables, custom scripts etc.
  • Install crosstool-NG
    • Preferably ./configure --prefix ${RB_WORKDIR}/host
  • Install scratchbox2
    • Preferably ./configure --prefix ${RB_WORKDIR}/host

2. Prepare target sysroot

  • Build sysroot with crosstool-NG (there is example config I use in config/)
    • ct-ng menuconfig - to configure
    • ct-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 to usr/lib - it's default on Arch Linux
    • move ${RB_TARGETDIR}/sbin to ${RB_TARGETDIR}/usr/bin and symlink(ln -s) sbin to usr/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}/* to root:root 755 (recursive)

3. Build packages

  • 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 in sources/ directory
  • Use rb_makepkg instead of makepkg - it has patched support for scratchbox2 instead of fakeroot and uses makepkg.conf from config/

PACKAGE BUILDING ORDER:

About

Set of simple scripts and instructions for building customized, archlinux based distro for raspberrypi.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published