*solved* Can't build Linux kernel on WSL (Ubuntu 18.04)

Hi,

I’m newbee and trying to build the linux kernel with according to this official document (http://opensource.rock-chips.com/wiki_Linux_user_guide). I succeeded in building U-Boot, but failed to build the kernel.

I’m using WSL (Ubuntu 18.04).

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04 LTS"

This is the command and the error message.

$ make ARCH=arm rk3288-firefly.img -j8
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     scripts/mod/devicetable-offsets.h
make[1]: 'include/generated/mach-types.h' is up to date.
make[1]: 'arch/arm/boot/dts/rk3288-firefly.dtb' is up to date.
  CHK     include/generated/timeconst.h
  CHK     include/generated/bounds.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  GZIP    kernel/config_data.gz
  CHK     kernel/config_data.h
  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/zImage is ready
/bin/sh: ./scripts/mkkrnlimg: cannot execute binary file: Exec format error
arch/arm/Makefile:382: recipe for target 'kernel.img' failed
make: *** [kernel.img] Error 126

Is there anyone who understands the solution?
Please help someone.

Follow the guide here: http://en.t-firefly.com/doc/product/info/447.html
However, change gcc-aarch64-linux-gnu to gcc-5-aarch64-linux-gnu in step 1.1

The 18.04 will give you a gcc-7 cross compiler, but the kernel won’t compile under that (yet). The gcc-5 one should work.

Dan

robodan65 Posted at 6/12/2018 06:57
Follow the guide here: http://en.t-firefly.com/doc/product/info/447.html
However, change gcc-aarch …

Thank you Dan,

However my board is RK3288, and I tried following this guide: http://en.t-firefly.com/doc/product/info/253.html
It also gave almost the same results.

kernel$ make rk3288-firefly-linux.img -j8
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: 'arch/arm/boot/dts/rk3288-firefly-linux.dtb' is up to date.
make[1]: 'include/generated/mach-types.h' is up to date.
  CHK     include/generated/timeconst.h
  CHK     include/generated/bounds.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CHK     kernel/config_data.h
  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/zImage is ready
/bin/sh: 1: ./scripts/mkkrnlimg: Exec format error
arch/arm/Makefile:382: recipe for target 'kernel.img' failed
make: *** [kernel.img] Error 2

The following code are my operations. (Using gcc-5-arm-linux-gnueabif and gcc-5-aarch64-linux-gnu)

32bit-app setting

$ sudo dpkg --add-architecture i386
$ sudo apt update

Environment setting

$ sudo apt install git gnupg flex bison gperf build-essential zip tar curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib cmake tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 lzop
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
$ sudo apt install gcc-5-arm-linux-gnueabihf gcc-5-aarch64-linux-gnu device-tree-compiler lzop libncurses5-dev libssl1.0.0 libssl-dev
$ dpkg -L gcc-5-arm-linux-gnueabihf
$ sudo cp /usr/bin/arm-linux-gnueabihf-gcc-5 /usr/bin/arm-linux-gnueabihf-gcc
$ sudo cp /usr/bin/aarch64-linux-gnu-gcc-5 /usr/bin/aarch64-linux-gnu-gcc

Compile Kernel

$ git clone -b firefly https://github.com/FireflyTeam/kernel.git
$ cd kernel
$ export ARCH=arm
$ export CROSS_COMPILE=arm-linux-gnueabihf-
$ make firefly_linux_defconfig
$ make rk3288-firefly-linux.img -j8

Hi,

It seems that the cause of the problem was in WSL.
I used Ubuntu 16.04 on VirtualBox, solved the problem.

Thank you.

This article is very content-rich and has helped me enhance my understanding. CWDP-305 reliable practice questions files offers a wealth of content, available for free, hoping it aids your learning.

難道你不想在你的工作生涯中做出一番輝煌的成績嗎?肯定希望那樣吧。那麼,你就有必要時常提升自己了。在BCS行業工作的你應該怎樣提升自己的水準呢?其實參加IT認證考試獲得認證資格是一個好方法。BCS的認證考試資格是很重要的資格,因此參加BAPv5考試的人變得越來越多了。

Thank you for sharing; the content of the article is truly impressive! The Exam D-CSF-SC-01 tips exam that helped me get promoted and earn a salary raise is available for you today at no charge. Hope you reach your career targets soon!

一回だけでNREMTのEMT試験に合格したい?PassTestは君の欲求を満たすために存在するのです。PassTestは君にとってベストな選択になります。ここには、私たちは君の需要に応じます。PassTestのNREMTのEMT問題集を購入したら、私たちは君のために、一年間無料で更新サービスを提供することができます。もし不合格になったら、私たちは全額返金することを保証します。

The article was a breath of fresh air in terms of insight. Best of luck! Here’s the free Reliable FS-Con-101 exam vce test content for everyone.