Building Mainline Kernel

edited September 2017 in AML-S905X-CC

We will be assuming that you are cross compiling the kernel on a x86_64 machine.

Download the latest gcc from Linaro. As of writing, it is gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz.

Download or clone a Linux 4.13+ kernel.

Make the ARM64 defconfig via: PATH=PUT_GCC_PATH_HERE/bin:$PATH make -C "PUT_LINUX_PATH_HERE" ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig

If you are using our u-boot, we recommend adding built-in BTRFS support via sed -i "s/CONFIG\\_BTRFS\\_FS\\=m/CONFIG\\_BTRFS\\_FS\\=y/" .config

Compile the kernel, modules, and device tree blob via: PATH=PUT_GCC_PATH_HERE/bin:$PATH make -C "PUT_LINUX_PATH_HERE" ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4 Image modules amlogic/meson-gxl-s905x-libretech-cc.dtb


  • Thanks for the instructions.

    Once we have the dtb and Image, how do we package this up for use on the device?

    I modified the configuration to have all drivers built in (instead of modules). I then built a uImage and copied both the uImage and dtb to the first partition of the SD card.

     mkimage -A arm64 -O linux -C none -T kernel -a 0x01080000 -e 0x01080000 -d arch/arm64/boot/Image uImage

    It did not come back. I did not have serial connected so I don't know what the failure was.

  • @joel, For any type for debugging on these boards, it is vital to have an 3.3V UART cable. It is a really great investment for a couple of bucks on Amazon.

  • I agree.

    For others who are getting started with the board, it would be great to have instructions that explain how to get their own kernels booting. Are you able to confirm that mkimage line I used is correct?

  • Hi Joel,
    The necessity of that command is to address the deficiencies in Amlogic's uboot code. The Amlogic uboot uses 1080000 as the offset which causes issues with the mainline kernel as is. Otherwise, we wouldn't need that line at all. This will be fixed once this board is supported by mainline uboot next month.

  • Thank you for your explination. I assume the line I used is correct? I got it working.

    I was then trying to boot my own kernel over the network. I normally use FIT images, and created a fit configuration as follows:

    / {
            description = "test kernel";
            #address-cells = <1>;
            images {
                    kernel@1 {
                            data = /incbin/("arch/arm64/boot/Image");
                            type = "kernel";
                            arch = "arm64";
                            os = "linux";
                            compression = "none";
                            load = <0x01080000>;
                            entry = <0x01080000>;
                    fdt@1 {
                            data = /incbin/("arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dtb");
                            type = "flat_dt";
                            arch = "arm64";
                            compression = "none";
            configurations {
                    default = "conf@1";
                    conf@1 {
                kernel = "kernel@1";
                fdt = "fdt@1";

    I built this with mkimage -f pot.its /srv/tftp/pot and then loaded it over tftp. When I attempt to boot, I get this output and then the system hangs:

    ee_gate_off ...
    ## Loading kernel from FIT Image at 01080000 ...
       Using 'conf@1' configuration
       Trying 'kernel@1' kernel subimage
         Description:  unavailable
         Type:         Kernel Image
         Compression:  uncompressed
         Data Start:   0x010800a0
         Data Size:    14755848 Bytes = 14.1 MiB
         Architecture: AArch64
         OS:           Linux
         Load Address: 0x01080000
         Entry Point:  0x01080000
       Verifying Hash Integrity ... OK
    load dtb from 0x1000000 ......
          Amlogic multi-dtb tool
          Cannot find legal dtb!
    ## Loading fdt from FIT Image at 01080000 ...
       Using 'conf@1' configuration
       Trying 'fdt@1' fdt subimage
         Description:  unavailable
         Type:         Flat Device Tree
         Compression:  uncompressed
         Data Start:   0x01e92934
         Data Size:    36130 Bytes = 35.3 KiB
         Architecture: AArch64
       Verifying Hash Integrity ... OK
       Booting using the fdt blob at 0x1e92934
       Loading Kernel Image(COMP_NONE) ... OK
       kernel loaded at 0x01080000, end = 0x01e92808
    libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
    [rsvmem] fdt get prop fail.
       Loading Device Tree to 000000001fff4000, end 000000001ffffd21 ... OK
    fdt_instaboot: no instaboot image
    Starting kernel ...
    uboot time: 155889358 us
    [BL31]: tee size: 0
    domain-0 init dvfs: 4
  • @joel what's your boot args?
    ex: setenv bootargs root=/dev/mmcblk1p2 rootfstype=btrfs rootflags=subvol=@ rootwait console=ttyAML0,115200 no_console_suspend;

  • Hi Joel,
    With the 4.14 release, we moved to mainline u-boot so it is much simpler now. You can interrupt the execution at startup.

Sign In or Register to comment.