Sign inSign up

awesometic/odroid-kernel-builder

By awesometic

•Updated over 5 years ago

An image to make Odroid kernel build much easier.

Image
0

2.9K

awesometic/odroid-kernel-builder repository overview

⁠docker-odroid-kernel-builder

⁠What is this

This image is written for easy compile on development of Odroid Linux kernel.

This has all the toolchain the Odroid boards requires in advance. So you can compile your custom Linux kernel by just downloading Odroid kernel source tree and running this image.

⁠Performance on Windows and macOS

Unfortunately, it should be too slow.

This image runs on Ubuntu Linux based, which means that it runs on Linux Kernel. In macOS or Windows, their Docker uses the specific virtual engine provided by each OS to emulate the Linux environment.

So that the performance is tooooo slower than the native Linux machine does. In my case, on macOS 10.14 with E3-1230v3 processor, it takes more than 2 hours for compiling XU4 kernel. This might be acceptable for someone but it may not in most cases.

Thus, it should work on any Docker supported system but the performance will be very slow.

For further information, please refer to References⁠ section of this documents.

⁠WSL 2 (Windows Subsystem for Linux)

However, if you use Windows 20h1 or higher, you can build as fast as on the Linux system thanks to the WSL 2 that is introduced in modern Windows 10.

In my experience, that difference is only a few minutes between native Linux and WSL 2. Probably it can be just a few seconds for the powerful system.

You can refer to this link to know about Docker WSL2 backend⁠.

⁠Only supports Hardkernel official Ubuntu image

It is not suitable for third party images like Android kernel, @tobetter's Debian/Ubuntu, and Armbian, DietPi. All these images have different kernel source tree and also has differed boot directory structure.

⁠How to use

The full usage is,

docker run -it --rm \
-v { Kernel source path }:/kernel \
-v { Path to receive output kernel binaries from the image }:/output \
-v { Path to boot media's boot partition }:/media/boot \
-v { Path to boot media's rootfs partition }:/media/rootfs \
-e USER_UID={ UID to correct ownership, set 1000 by default } \
-e USER_GID={ GID to correct ownership, set 1000 by default } \
-e SBC={ The name of your SBC without the prefix word Odroid } \
-e MAKE_ARGS={ make arguments you about to use } \
-e AUTO_INSTALL={ Install automatically to the boot media after complete building kernel } \
awesometic/odroid-kernel-builder

Looks quite complicate. The examples in the below.

  • Just check build time for N2
docker run -it --rm \
-v $(pwd):/kernel \
-e USER_UID=$UID \
-e USER_GID=$GID \
-e SBC=n2 \
-e MAKE_ARGS=cleanbuild \
awesometic/odroid-kernel-builder
  • Save the built kernel results such as kernel image, DTBs to the shared folder names "kernel-outputs".
docker run -it --rm \
-v $(pwd):/kernel \
-v ~/kernel-outputs:/output \
-e USER_UID=$UID \
-e USER_GID=$GID \
-e SBC=n2 \
-e MAKE_ARGS=cleanbuild \
awesometic/odroid-kernel-builder
  • Install automatically to your boot media. Building a kernel is for replacing the current kernel with the custom one in most cases, the boot media should have the correct partitions by flashing the other official Ubuntu image before. The third party images are not supported.
  • In this case, the boot, rootfs partitions are mounted to the corresponding directories respectively on the host PC. If AUTO_INSTALL is set to false, the /media/boot, /media/rootfs volumes will be not affect anything.
docker run -it --rm \
-v $(pwd):/kernel \
-v /media/boot:/media/boot \
-v /media/rootfs:/media/rootfs \
-e USER_UID=$UID \
-e USER_GID=$GID \
-e SBC=n2 \
-e MAKE_ARGS=cleanbuild \
-e AUTO_INSTALL=true \
awesometic/odroid-kernel-builder
⁠Choose a type of SBC

You have to put your Odroid device name as a value of SBC environment variable. Currently supported boards are here.

  • XU3: 3.10, 4.9
  • XU4: 4.14, 5.4
  • C1: 3.10
  • C2: 3.14, 3.16
  • N2: 4.9
  • C4/HC4: 4.9
⁠Parameters for make command

You can put your parameters for the make command as a value of MAKE_ARGS environment variable. Here are the prepared make options.

  • defconfig:make odroid???_defconfig for the given SBC environment value
  • menuconfig: make menuconfig
  • clean: make clean
  • distclean: make distclean
  • cleanbuild: make distclean; make odroid???_defconfig; make
  • Given nothing: make

The building process will use all the available CPU cores by using "$(nproc) * 6 / 5" fomula.

⁠Do not treat it as a daemon mode

Do not run this image as a daemon. Promptly to be terminated because it doesn't have any jobs to keep doing.

⁠References

⁠Author

Deokgyu Yang ([email protected]⁠)

Tag summary

Content type

Image

Digest

Size

1.3 GB

Last updated

over 5 years ago

docker pull awesometic/odroid-kernel-builder