User:Fabled: Difference between revisions

From Alpine Linux
 
Line 1: Line 1:
==Bootstrapping new architectures==
==Bootstrapping new architectures==


abuild, since 2.17.0, more or less supports creating cross-compiler and cross-compiling.
That still needs a little bit of polishing, same goes to my scripts.
All my scripts and example configs are located at http://dev.alpinelinux.org/~tteras/bootstrap
# Decide on toolchain name (triplet), and update gcc aport to add proper configure flags for it
# Create cross compiler
# Create cross compiler
#* I decided to use crosstool-ng as build cross-compiler is tricky
#* Write abuild-createcross-$ARCH.conf for it, and use createcross-toolchain.sh to create a cross-compiler.
#** Wrote patch to support musl as C-library
#** Wrote patch to enable building toolchains with PIE as default
#* Create crosstool-ng .config, [http://dev.alpinelinux.org/~tteras/crosstool-ng-alpine-arm.config My ARM config]
#** NOTE: for some reason binutils gold linker crashes when compiling gcc, so needed to keep it disabled.
#* run 'ct-ng build' to build the new tool chain
# Cross compile minimal system image
# Cross compile minimal system image
#* abuild and core APKBUILDs modified to support cross building
#* With above generated toolchain, you can use crossbuild-alpine-bootstrap.sh to create the minimal image.
#* Wrote [http://dev.alpinelinux.org/~tteras/crossbuild-alpine-bootstrap.sh crossbuild-alpine-bootstrap.sh] to invoke abuild with cross-compiler
# Setup new box
#* Cross-building script uses abuild.conf overlay to define new target [http://dev.alpinelinux.org/~tteras/abuild-cross-armel.conf My ARM overlay]
#* If running on new hardware, you also need to prepare kernel images, initramfs and modloop to create the initial bootimage.
#* This produces all core .apk files for the target platform that can be used to boot qemu, qemu-user target or native hardware
#* If running as vserver guest, you can just install the .apks from previous step.
# Rebuild system and setup builder
#* Setup builder.
#* Decided to use qemu-user for ARM as it the fastest option available for us (no fast native hardware yet)
#* Setup qemu-arm support for target chroot
#*# apk --arch x86 --root $chroot/qemu --initdb add qemu-arm
#*# cd $chroot/lib ; ln -s ../qemu/lib/ld-* .
#*# ldconfig -r $chroot /qemu/lib /qemu/usr/lib
#*# create binfmt_misc mapping
#*# seems qemu-user needs to access /proc/sys/vm/mmap_min_addr or it does not work
#* Setup target main chroot
#** apk --arch arm --root $chroot --initdb add alpine-base build-base
#** enter chroot

Latest revision as of 09:17, 25 September 2013

Bootstrapping new architectures

abuild, since 2.17.0, more or less supports creating cross-compiler and cross-compiling. That still needs a little bit of polishing, same goes to my scripts. All my scripts and example configs are located at http://dev.alpinelinux.org/~tteras/bootstrap

  1. Decide on toolchain name (triplet), and update gcc aport to add proper configure flags for it
  2. Create cross compiler
    • Write abuild-createcross-$ARCH.conf for it, and use createcross-toolchain.sh to create a cross-compiler.
  3. Cross compile minimal system image
    • With above generated toolchain, you can use crossbuild-alpine-bootstrap.sh to create the minimal image.
  4. Setup new box
    • If running on new hardware, you also need to prepare kernel images, initramfs and modloop to create the initial bootimage.
    • If running as vserver guest, you can just install the .apks from previous step.
    • Setup builder.