Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Zero/dev/kernel

< Zero‎ | dev
    Radxa Zero >  Development >  Kernel

Build, pack and install Radxa Zero Kernel

Below is the instructions of how to build and pack Radxa Zero kernel on a Ubuntu 20.04 HOST PC. And install kernel packages on Radxa Zero.

Hardware Required

  • Radxa Zero
  • USB A to C cable
  • A PC/laptop running Linux(Ubuntu 18.04 or higher)

Install necessary tools

$ sudo apt-get install -y gcc-aarch64-linux-gnu device-tree-compiler libncurses5 libncurses5-dev
$ sudo apt-get install -y bc python dosfstools flex build-essential libssl-dev mtools bison flex bison git wget

Get the toolchain

$ wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
$ sudo tar xvf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz -C /opt

Get Kernel Source

$ mkdir ~/radxa-zero-sdk
$ cd ~/radxa-zero-sdk
$ git clone https://github.com/radxa/kernel.git -b linux-5.10.y-radxa-zero

Build Kernel

$ cd kernel
$ export ARCH=arm64
$ export CROSS_COMPILE=/opt/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/aarch64-none-elf-
$ make radxa_zero_defconfig
$ make -j8

And we will get kernel image

$ ls arch/arm64/boot/Image
arch/arm64/boot/Image

and Radxa Zero device tree.

$ ls arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dtb
arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dtb

Pack Kernel

$ export ARCH=arm64
$ export CROSS_COMPILE=/opt/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/aarch64-none-elf-
$ make radxa_zero_defconfig
$ export build_id="999" # make sure it's big enough so that our kernel is the newest.
$ export lv="-$build_id-amlogic"
$ export kv=$(make kernelversion)
$ export debv="$kv$lv"
$ make  bindeb-pkg -j8    LOCALVERSION=$lv    KDEB_PKGVERSION=$debv

The generated packages are(the kernel revision name maybe different):

$ ls  ../*.deb
../linux-headers-5.10.69-999-amlogic_5.10.69-999-amlogic_arm64.deb
../linux-libc-dev_5.10.69-999-amlogic_arm64.deb
../linux-image-5.10.69-999-amlogic_5.10.69-999-amlogic_arm64.deb

Install Kernel on Radxa Zero

Copy linux-headers-5.10.69-999-amlogic_5.10.69-999-amlogic_arm64.deb and linux-image-5.10.69-999-amlogic_5.10.69-999-amlogic_arm64.deb to your Radxa Zero. Install it on Radxa Zero.

rock@zero:~$ sudo dpkg -i linux-headers-5.10.69-999-amlogic_5.10.69-999-amlogic_arm64.deb
rock@zero:~$ sudo dpkg -i linux-image-5.10.69-999-amlogic_5.10.69-999-amlogic_arm64.deb

Reboot you will have the new kernel booting.

FAQs

Troubleshooting

If you have an issue, start a new post on the forum https://forum.radxa.com/c/zero.