Skip to content

Instantly share code, notes, and snippets.

@CameronNemo
Created April 2, 2019 00:56
Show Gist options
  • Save CameronNemo/2628ce9cac1e970b579c2436081a74ad to your computer and use it in GitHub Desktop.
Save CameronNemo/2628ce9cac1e970b579c2436081a74ad to your computer and use it in GitHub Desktop.
Attempt to cross compile u-boot tools.

configure

First, make sandbox_defconfig:

cameronnemo@ceci ~/d/l/v/void-packages> ./xbps-src -m masterdir-x86_64-musl/ configure -a aarch64-musl -f uboot-mkimage
=> Using `/home/cameronnemo/docs/linux/void/void-packages/hostdir/binpkgs/uboot-mkimage-2019.01' as local repository.
[...]
=> uboot-mkimage-2019.04r4_1: removing autodeps, please wait...
=> uboot-mkimage-2019.04r4_1: removing autocrossdeps, please wait...
=> uboot-mkimage-2019.04r4_1: building ...
   [host] bison-3.3.2_1: found (https://alpha.de.repo.voidlinux.org/current/musl)
   [host] flex-2.6.4_3: found (https://alpha.de.repo.voidlinux.org/current/musl)
   [target] libressl-devel-2.8.3_1: found (https://alpha.de.repo.voidlinux.org/current/aarch64)
=> uboot-mkimage-2019.04r4_1: installing host dependency 'bison-3.3.2_1' ...
=> uboot-mkimage-2019.04r4_1: installing host dependency 'flex-2.6.4_3' ...
=> uboot-mkimage-2019.04r4_1: installing target dependency 'libressl-devel-2.8.3_1' ...
=> uboot-mkimage-2019.04r4_1: running pre-configure hook: 00-gnu-configure-asneeded ...
=> uboot-mkimage-2019.04r4_1: running pre-configure hook: 01-override-config ...
=> uboot-mkimage-2019.04r4_1: running pre-configure hook: 02-script-wrapper ...
=> uboot-mkimage-2019.04r4_1: running do_configure ...
  HOSTCC  scripts/basic/fixdep
#
# configuration written to .config
#

Verify that scripts/basic/fixdep is the correct arch:

cameronnemo@ceci ~/d/l/v/void-packages> file masterdir-x86_64-musl/builddir/u-boot-v2019.04-rc4/scripts/basic/fixdep
masterdir-x86_64-musl/builddir/u-boot-v2019.04-rc4/scripts/basic/fixdep: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, BuildID[sha1]=6cc7f83681676af9001451d4e76b9a3d060998b5, with debug_info, not stripped

build

Now, make cross_tools HOSTCC="$CC $CFLAGS $LDFLAGS" HOSTLD="$LD" (where CC is the cross cc, and LD is the cross ld, etc):

cameronnemo@ceci ~/d/l/v/void-packages> ./xbps-src -m masterdir-x86_64-musl/ build -a aarch64-musl -f uboot-mkimage
[...]
=> uboot-mkimage-2019.04r4_1: running pre-build hook: 02-script-wrapper ...
=> uboot-mkimage-2019.04r4_1: running do_build ...
  HOSTCC  scripts/basic/fixdep
/bin/sh: scripts/basic/fixdep: No such file or directory
make[2]: *** [scripts/Makefile.host:97: scripts/basic/fixdep] Error 127
make[2]: *** Deleting file 'scripts/basic/fixdep'
make[1]: *** [Makefile:415: scripts_basic] Error 2
make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'.  Stop.
=> ERROR: uboot-mkimage-2019.04r4_1: do_build: 'make cross_tools HOSTCC="$CC $CFLAGS $LDFLAGS" HOSTLD="$LD"' exited with 2
=> ERROR:   in do_build() at srcpkgs/uboot-mkimage/template:25

It did not like that. Deleted existing scripts/basic/fixdep and tried to create it anew.

Which does not even producing a working binary:

cameronnemo@ceci ~/d/l/v/void-packages> file masterdir-x86_64-musl/builddir/u-boot-v2019.04-rc4/scripts/basic/fixdep
masterdir-x86_64-musl/builddir/u-boot-v2019.04-rc4/scripts/basic/fixdep: cannot open `masterdir-x86_64-musl/builddir/u-boot-v2019.04-rc4/scripts/basic/fixdep' (No such file or directory)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment