1

I am using RPI3 model B

I have compiled toolchain using crosstool-ng with the following sample.

./ct-ng aarch64-rpi3-linux-gnu

Using ./ct-ng menuconfig, I changed C library from glibc to uClibc. And then toolchain is built with command ./ct-ng build

With this toolchain, I have cross compiled U-Boot for RPI3 model b. I am able to load the boocode.bin, start.elf and U-Boot and able to execute U-Boot commands from the console.

Now I wanted to cross compile the Linux kernel. But I am unable to build with this toolchain. Here are the compilation logs ...

nayab@dobglr:linux$ make ARCH=arm CROSS_COMPILE=arm-linux-rpi3- bcm2709_defconfig V=1
make -f ./scripts/Makefile.build obj=scripts/basic
  gcc -Wp,-MD,scripts/basic/.fixdep.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89         -o scripts/basic/fixdep scripts/basic/fixdep.c   
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig bcm2709_defconfig
  gcc -Wp,-MD,scripts/kconfig/.conf.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89       -c -o scripts/kconfig/conf.o scripts/kconfig/conf.c
  bison -oscripts/kconfig/zconf.tab.c -t -l scripts/kconfig/zconf.y
  flex -oscripts/kconfig/zconf.lex.c -L scripts/kconfig/zconf.l
  gcc -Wp,-MD,scripts/kconfig/.zconf.tab.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89      -Iscripts/kconfig -c -o scripts/kconfig/zconf.tab.o scripts/kconfig/zconf.tab.c
  gcc   -o scripts/kconfig/conf scripts/kconfig/conf.o scripts/kconfig/zconf.tab.o   
scripts/kconfig/conf  --defconfig=arch/arm/configs/bcm2709_defconfig Kconfig
#
# configuration written to .config
#
nayab@dobglr:linux$ 
nayab@dobglr:linux$ 
nayab@dobglr:linux$ 
nayab@dobglr:linux$ 
nayab@dobglr:linux$ 
nayab@dobglr:linux$ 
nayab@dobglr:linux$ make ARCH=arm CROSS_COMPILE=arm-linux-rpi3- zImage modules dtbs V=1
make -f ./scripts/Makefile.build obj=arch/arm/tools uapi
  /bin/sh './arch/arm/tools/syscallhdr.sh' 'arch/arm/tools/syscall.tbl' 'arch/arm/include/generated/uapi/asm/unistd-common.h' 'common' '' '__NR_SYSCALL_BASE'
  /bin/sh './arch/arm/tools/syscallhdr.sh' 'arch/arm/tools/syscall.tbl' 'arch/arm/include/generated/uapi/asm/unistd-oabi.h' 'oabi' '' '__NR_SYSCALL_BASE'
  /bin/sh './arch/arm/tools/syscallhdr.sh' 'arch/arm/tools/syscall.tbl' 'arch/arm/include/generated/uapi/asm/unistd-eabi.h' 'eabi' '' '__NR_SYSCALL_BASE'
set -e; mkdir -p include/config/;   echo "4.19.114$(/bin/sh ./scripts/setlocalversion .)" > include/config/kernel.release.tmp; if [ -r include/config/kernel.release ] && cmp -s include/config/kernel.release include/config/kernel.release.tmp; then rm -f include/config/kernel.release.tmp; else : '  UPD     include/config/kernel.release'; mv -f include/config/kernel.release.tmp include/config/kernel.release; fi
make -f ./scripts/Makefile.asm-generic \
            src=uapi/asm obj=arch/arm/include/generated/uapi/asm
  echo "#include <asm-generic/bitsperlong.h>" >arch/arm/include/generated/uapi/asm/bitsperlong.h
  echo "#include <asm-generic/bpf_perf_event.h>" >arch/arm/include/generated/uapi/asm/bpf_perf_event.h
  echo "#include <asm-generic/errno.h>" >arch/arm/include/generated/uapi/asm/errno.h
  echo "#include <asm-generic/ioctl.h>" >arch/arm/include/generated/uapi/asm/ioctl.h
  echo "#include <asm-generic/ipcbuf.h>" >arch/arm/include/generated/uapi/asm/ipcbuf.h
  echo "#include <asm-generic/msgbuf.h>" >arch/arm/include/generated/uapi/asm/msgbuf.h
  echo "#include <asm-generic/param.h>" >arch/arm/include/generated/uapi/asm/param.h
  echo "#include <asm-generic/poll.h>" >arch/arm/include/generated/uapi/asm/poll.h
  echo "#include <asm-generic/resource.h>" >arch/arm/include/generated/uapi/asm/resource.h
  echo "#include <asm-generic/sembuf.h>" >arch/arm/include/generated/uapi/asm/sembuf.h
  echo "#include <asm-generic/shmbuf.h>" >arch/arm/include/generated/uapi/asm/shmbuf.h
  echo "#include <asm-generic/siginfo.h>" >arch/arm/include/generated/uapi/asm/siginfo.h
  echo "#include <asm-generic/socket.h>" >arch/arm/include/generated/uapi/asm/socket.h
  echo "#include <asm-generic/sockios.h>" >arch/arm/include/generated/uapi/asm/sockios.h
  echo "#include <asm-generic/termbits.h>" >arch/arm/include/generated/uapi/asm/termbits.h
  echo "#include <asm-generic/termios.h>" >arch/arm/include/generated/uapi/asm/termios.h
make -f ./scripts/Makefile.asm-generic \
            src=asm obj=arch/arm/include/generated/asm
  echo "#include <asm-generic/compat.h>" >arch/arm/include/generated/asm/compat.h
  echo "#include <asm-generic/current.h>" >arch/arm/include/generated/asm/current.h
  echo "#include <asm-generic/early_ioremap.h>" >arch/arm/include/generated/asm/early_ioremap.h
  echo "#include <asm-generic/emergency-restart.h>" >arch/arm/include/generated/asm/emergency-restart.h
  echo "#include <asm-generic/exec.h>" >arch/arm/include/generated/asm/exec.h
  echo "#include <asm-generic/extable.h>" >arch/arm/include/generated/asm/extable.h
  echo "#include <asm-generic/irq_regs.h>" >arch/arm/include/generated/asm/irq_regs.h
  echo "#include <asm-generic/kdebug.h>" >arch/arm/include/generated/asm/kdebug.h
  echo "#include <asm-generic/local.h>" >arch/arm/include/generated/asm/local.h
  echo "#include <asm-generic/local64.h>" >arch/arm/include/generated/asm/local64.h
  echo "#include <asm-generic/mm-arch-hooks.h>" >arch/arm/include/generated/asm/mm-arch-hooks.h
  echo "#include <asm-generic/msi.h>" >arch/arm/include/generated/asm/msi.h
  echo "#include <asm-generic/parport.h>" >arch/arm/include/generated/asm/parport.h
  echo "#include <asm-generic/preempt.h>" >arch/arm/include/generated/asm/preempt.h
  echo "#include <asm-generic/rwsem.h>" >arch/arm/include/generated/asm/rwsem.h
  echo "#include <asm-generic/seccomp.h>" >arch/arm/include/generated/asm/seccomp.h
  echo "#include <asm-generic/segment.h>" >arch/arm/include/generated/asm/segment.h
  echo "#include <asm-generic/serial.h>" >arch/arm/include/generated/asm/serial.h
  echo "#include <asm-generic/simd.h>" >arch/arm/include/generated/asm/simd.h
  echo "#include <asm-generic/sizes.h>" >arch/arm/include/generated/asm/sizes.h
  echo "#include <asm-generic/timex.h>" >arch/arm/include/generated/asm/timex.h
  echo "#include <asm-generic/trace_clock.h>" >arch/arm/include/generated/asm/trace_clock.h
set -e; mkdir -p include/generated/uapi/linux/;     (echo \#define LINUX_VERSION_CODE 267122; echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) > include/generated/uapi/linux/version.h.tmp; if [ -r include/generated/uapi/linux/version.h ] && cmp -s include/generated/uapi/linux/version.h include/generated/uapi/linux/version.h.tmp; then rm -f include/generated/uapi/linux/version.h.tmp; else : '  UPD     include/generated/uapi/linux/version.h'; mv -f include/generated/uapi/linux/version.h.tmp include/generated/uapi/linux/version.h; fi
rm -f include/linux/version.h
set -e; mkdir -p include/generated/;    if [ `echo -n "4.19.114-v7+" | wc -c ` -gt 64 ]; then echo '"4.19.114-v7+" exceeds 64 characters' >&2; exit 1; fi; (echo \#define UTS_RELEASE \"4.19.114-v7+\";) > include/generated/utsrelease.h.tmp; if [ -r include/generated/utsrelease.h ] && cmp -s include/generated/utsrelease.h include/generated/utsrelease.h.tmp; then rm -f include/generated/utsrelease.h.tmp; else : '  UPD     include/generated/utsrelease.h'; mv -f include/generated/utsrelease.h.tmp include/generated/utsrelease.h; fi
mkdir -p .tmp_versions ; rm -f .tmp_versions/*
make -f ./scripts/Makefile.build obj=scripts/basic
(cat /dev/null; ) > scripts/basic/modules.order
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=arch/arm/tools kapi
  /bin/sh './arch/arm/tools/syscallnr.sh' 'arch/arm/tools/syscall.tbl' 'arch/arm/include/generated/asm/unistd-nr.h' ''
  mkdir -p arch/arm/include/generated/asm/ && awk -f arch/arm/tools/gen-mach-types arch/arm/tools/mach-types > arch/arm/include/generated/asm/mach-types.h || { rm -f arch/arm/include/generated/asm/mach-types.h; /bin/false; }
  /bin/sh './arch/arm/tools/syscalltbl.sh' 'arch/arm/tools/syscall.tbl' 'arch/arm/include/generated/calls-oabi.S' 'common,oabi'
  /bin/sh './arch/arm/tools/syscalltbl.sh' 'arch/arm/tools/syscall.tbl' 'arch/arm/include/generated/calls-eabi.S' 'common,eabi'
make -f ./scripts/Makefile.build obj=.
(cat /dev/null; ) > modules.order
  arm-linux-rpi3-gcc -Wp,-MD,kernel/.bounds.s.d  -nostdinc -isystem /home/nayab/x-tools/aarch64-rpi3-linux-uclibc/lib/gcc/aarch64-rpi3-linux-uclibc/9.2.0/include -I./arch/arm/include -I./arch/arm/include/generated  -I./include -I./arch/arm/include/uapi -I./arch/arm/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -fno-dwarf2-cfi-asm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=aapcs-linux -mfpu=vfp -funwind-tables -Wa,-W -D__LINUX_ARM_ARCH__=7 -march=armv5t -Wa,-march=armv7-a -msoft-float -Uarm -O2 -fstack-protector-strong -fno-omit-frame-pointer -fno-optimize-sibling-calls -pg    -DKBUILD_BASENAME='"bounds"' -DKBUILD_MODNAME='"bounds"'  -fverbose-asm -S -o kernel/bounds.s kernel/bounds.c
arm-linux-rpi3-gcc: error: unrecognized argument in option '-mabi=aapcs-linux'
arm-linux-rpi3-gcc: note: valid arguments to '-mabi=' are: ilp32 lp64
arm-linux-rpi3-gcc: error: unrecognized command line option '-mapcs'
arm-linux-rpi3-gcc: error: unrecognized command line option '-mno-sched-prolog'
arm-linux-rpi3-gcc: error: unrecognized command line option '-mfpu=vfp'
arm-linux-rpi3-gcc: error: unrecognized command line option '-msoft-float'
make[1]: *** [Kbuild:21: kernel/bounds.s] Error 1
make: *** [Makefile:1102: prepare0] Error 2
nayab@dobglr:linux$ 
nayab@dobglr:linux$ 
nayab@dobglr:linux$ 
nayab@dobglr:linux$ 
nayab@dobglr:linux$ file ~/x-tools/aarch64-rpi3-linux-uclibc/bin/arm-linux-rpi3-gcc
/home/nayab/x-tools/aarch64-rpi3-linux-uclibc/bin/arm-linux-rpi3-gcc: symbolic link to aarch64-rpi3-linux-uclibc-gcc
nayab@dobglr:linux$ 

I would like to know if it is possible to compile kernel using this toolchain. If yes, could anybody help me resolve the above errors.

Note : The original offical forum thread can be found here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.