Firefly Open Source Community

   Login   |   Register   |
New_Topic

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

99

Credits

0

Prestige

0

Contribution

registered members

Rank: 2

Credits
99
Posted at 6/10/2018 12:05:26     
Last edited by ueue In 6/22/2018 07:49 Editor

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).
  1. $ cat /etc/lsb-release
  2. DISTRIB_ID=Ubuntu
  3. DISTRIB_RELEASE=18.04
  4. DISTRIB_CODENAME=bionic
  5. DISTRIB_DESCRIPTION="Ubuntu 18.04 LTS"
Copy the code

This is the command and the error message.
  1. $ make ARCH=arm rk3288-firefly.img -j8
  2. scripts/kconfig/conf  --silentoldconfig Kconfig
  3.   CHK     include/config/kernel.release
  4.   CHK     include/generated/uapi/linux/version.h
  5.   CHK     include/generated/utsrelease.h
  6.   CHK     scripts/mod/devicetable-offsets.h
  7. make[1]: 'include/generated/mach-types.h' is up to date.
  8. make[1]: 'arch/arm/boot/dts/rk3288-firefly.dtb' is up to date.
  9.   CHK     include/generated/timeconst.h
  10.   CHK     include/generated/bounds.h
  11.   CHK     include/generated/asm-offsets.h
  12.   CALL    scripts/checksyscalls.sh
  13.   CHK     include/generated/compile.h
  14.   GZIP    kernel/config_data.gz
  15.   CHK     kernel/config_data.h
  16.   Kernel: arch/arm/boot/Image is ready
  17.   Kernel: arch/arm/boot/Image is ready
  18.   Kernel: arch/arm/boot/zImage is ready
  19. /bin/sh: ./scripts/mkkrnlimg: cannot execute binary file: Exec format error
  20. arch/arm/Makefile:382: recipe for target 'kernel.img' failed
  21. make: *** [kernel.img] Error 126
Copy the code

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

Reply

Use props Report

25

Credits

0

Prestige

0

Contribution

new registration

Rank: 1

Credits
25
Posted at 6/12/2018 06:57:51     
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
Reply

Use props Report

99

Credits

0

Prestige

0

Contribution

registered members

Rank: 2

Credits
99
Posted at 6/13/2018 00:04:22     
Last edited by ueue In 6/13/2018 09:53 Editor
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.
  1. kernel$ make rk3288-firefly-linux.img -j8
  2.   CHK     include/config/kernel.release
  3.   CHK     include/generated/uapi/linux/version.h
  4.   CHK     include/generated/utsrelease.h
  5. make[1]: 'arch/arm/boot/dts/rk3288-firefly-linux.dtb' is up to date.
  6. make[1]: 'include/generated/mach-types.h' is up to date.
  7.   CHK     include/generated/timeconst.h
  8.   CHK     include/generated/bounds.h
  9.   CHK     include/generated/asm-offsets.h
  10.   CALL    scripts/checksyscalls.sh
  11.   CHK     include/generated/compile.h
  12.   CHK     kernel/config_data.h
  13.   Kernel: arch/arm/boot/Image is ready
  14.   Kernel: arch/arm/boot/Image is ready
  15.   Kernel: arch/arm/boot/zImage is ready
  16. /bin/sh: 1: ./scripts/mkkrnlimg: Exec format error
  17. arch/arm/Makefile:382: recipe for target 'kernel.img' failed
  18. make: *** [kernel.img] Error 2
Copy the code

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

32bit-app setting
  1. $ sudo dpkg --add-architecture i386
  2. $ sudo apt update
Copy the code
Environment setting
  1. $ 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
  2. $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
  3. $ sudo apt install gcc-5-arm-linux-gnueabihf gcc-5-aarch64-linux-gnu device-tree-compiler lzop libncurses5-dev libssl1.0.0 libssl-dev
Copy the code
  1. $ dpkg -L gcc-5-arm-linux-gnueabihf
  2. $ sudo cp /usr/bin/arm-linux-gnueabihf-gcc-5 /usr/bin/arm-linux-gnueabihf-gcc
  3. $ sudo cp /usr/bin/aarch64-linux-gnu-gcc-5 /usr/bin/aarch64-linux-gnu-gcc
Copy the code
Compile Kernel
  1. $ git clone -b firefly https://github.com/FireflyTeam/kernel.git
  2. $ cd kernel
  3. $ export ARCH=arm
  4. $ export CROSS_COMPILE=arm-linux-gnueabihf-
  5. $ make firefly_linux_defconfig
  6. $ make rk3288-firefly-linux.img -j8
Copy the code


Reply

Use props Report

99

Credits

0

Prestige

0

Contribution

registered members

Rank: 2

Credits
99
Posted at 6/22/2018 07:43:06     
Hi,

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

Thank you.
Reply

Use props Report

You need to log in before you can reply Login | Register

This forum Credits Rules

Quick Reply Back to top Back to list