Difference between revisions of "Zero/dev/kernel"
RadxaYuntian (Talk | contribs) |
|||
(One intermediate revision by the same user not shown) | |||
Line 5: | Line 5: | ||
=== Build, pack and install Radxa Zero Kernel === | === Build, pack and install Radxa Zero Kernel === | ||
− | Below | + | Below we will show you how to build, pack, and install Radxa Zero kernel with a Ubuntu 20.04 HOST PC. |
− | + | ||
==== Hardware Required ==== | ==== Hardware Required ==== | ||
Line 12: | Line 11: | ||
* Radxa Zero | * Radxa Zero | ||
* USB A to C cable | * USB A to C cable | ||
− | * A PC/laptop running | + | * A PC/laptop running Ubuntu 18.04 or higher |
− | ==== | + | ==== Set up build environment ==== |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
+ | $ sudo apt update | ||
+ | $ sudo apt install gcc-aarch64-linux-gnu device-tree-compiler libncurses5 libncurses5-dev bc python dosfstools flex build-essential libssl-dev mtools bison flex bison git wget | ||
$ 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 | $ 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 | $ sudo tar xvf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz -C /opt | ||
− | ==== Get | + | ==== Get kernel source code ==== |
$ mkdir ~/radxa-zero-sdk | $ mkdir ~/radxa-zero-sdk | ||
Line 30: | Line 26: | ||
$ git clone https://github.com/radxa/kernel.git -b linux-5.10.y-radxa-zero | $ git clone https://github.com/radxa/kernel.git -b linux-5.10.y-radxa-zero | ||
− | ==== Build | + | ==== Build kernel ==== |
$ cd kernel | $ cd kernel | ||
Line 37: | Line 33: | ||
$ make radxa_zero_defconfig | $ make radxa_zero_defconfig | ||
$ make -j8 | $ make -j8 | ||
− | |||
− | |||
− | |||
$ ls arch/arm64/boot/Image | $ ls arch/arm64/boot/Image | ||
− | arch/arm64/boot/Image | + | arch/arm64/boot/Image # this is the kernel image |
− | + | ||
− | + | ||
− | + | ||
$ ls arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dtb | $ ls arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dtb | ||
− | arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dtb | + | arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dtb # this is the device tree blob |
==== Pack Kernel ==== | ==== Pack Kernel ==== | ||
Line 53: | Line 43: | ||
$ export CROSS_COMPILE=/opt/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/aarch64-none-elf- | $ export CROSS_COMPILE=/opt/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/aarch64-none-elf- | ||
$ make radxa_zero_defconfig | $ make radxa_zero_defconfig | ||
− | $ export build_id="999" # make sure it's big enough so that our kernel is | + | $ export build_id="999" # make sure it's big enough so that our kernel is newer than package from apt repository |
$ export lv="-$build_id-amlogic" | $ export lv="-$build_id-amlogic" | ||
$ export kv=$(make kernelversion) | $ export kv=$(make kernelversion) | ||
$ export debv="$kv$lv" | $ export debv="$kv$lv" | ||
− | $ make | + | $ make bindeb-pkg -j8 LOCALVERSION=$lv KDEB_PKGVERSION=$debv # for packing on non Debian system you may need `DPKG_FLAGS=-d` to skip dependency check |
− | The generated packages are(the kernel revision name | + | The generated packages are (the kernel revision name might be different, in our case it is 5.10.69): |
$ ls ../*.deb | $ ls ../*.deb | ||
Line 68: | Line 58: | ||
==== Install Kernel on Radxa Zero ==== | ==== 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. | + | 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. Then install with following commands: |
− | + | ||
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-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 | rock@zero:~$ sudo dpkg -i linux-image-5.10.69-999-amlogic_5.10.69-999-amlogic_arm64.deb | ||
− | Reboot | + | Reboot into your new kernel. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Latest revision as of 01:59, 11 January 2022
Radxa Zero > Development > Kernel
Contents
Build, pack and install Radxa Zero Kernel
Below we will show you how to build, pack, and install Radxa Zero kernel with a Ubuntu 20.04 HOST PC.
Hardware Required
- Radxa Zero
- USB A to C cable
- A PC/laptop running Ubuntu 18.04 or higher
Set up build environment
$ sudo apt update $ sudo apt install gcc-aarch64-linux-gnu device-tree-compiler libncurses5 libncurses5-dev bc python dosfstools flex build-essential libssl-dev mtools bison flex bison git wget $ 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 code
$ 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 $ ls arch/arm64/boot/Image arch/arm64/boot/Image # this is the kernel image $ ls arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dtb arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dtb # this is the device tree blob
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 newer than package from apt repository $ export lv="-$build_id-amlogic" $ export kv=$(make kernelversion) $ export debv="$kv$lv" $ make bindeb-pkg -j8 LOCALVERSION=$lv KDEB_PKGVERSION=$debv # for packing on non Debian system you may need `DPKG_FLAGS=-d` to skip dependency check
The generated packages are (the kernel revision name might be different, in our case it is 5.10.69):
$ 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. Then install with following commands:
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 into your new kernel.