I’m trying to build a linux kernel, dt (containing custom IP hw configuration) and rootfs following this tutorial:
The tutorial does it mainly for a ZU+, but I just have a microzed (Zynq-7000).
So far I was aleady able to set up fsbl and the dts with vivado and vitis. I also build u-boot and so far this part seems to works. Now I want to use buildroot to build a kernel from linux-xlnx. I used xilinx_zynq_defconfig to create the kernel .config file.
The Buildroot config file:
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_NEON=y
BR2_ARM_ENABLE_VFP=y
BR2_KERNEL_HEADERS_5_4=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
#Linux Kernel
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/Xilinx/linux-xlnx.git"
BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="xilinx-v2020.1"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_MYDIR_PATH}/board/kernel.config"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_USE_CUSTOM_DTS=y
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="${BR2_EXTERNAL_MYDIR_PATH}/board/kernel.dts"
#Packages
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y
BR2_PACKAGE_DROPBEAR=y
BR2_PACKAGE_DROPBEAR_DISABLE_REVERSEDNS=y
BR2_PACKAGE_DROPBEAR_WTMP=y
BR2_PACKAGE_DROPBEAR_LASTLOG=y
BR2_PACKAGE_ETHTOOL=y
BR2_PACKAGE_HAVEGED=y
BR2_PACKAGE_LIBGPIOD=y
BR2_PACKAGE_LIBGPIOD_TOOLS=y
BR2_PACKAGE_SPI_TOOLS=y
BR2_PACKAGE_TCF_AGENT=y
#BR2_PACKAGE_CUSTOM=y
#Target
BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyPS0"
BR2_TARGET_GENERIC_HOSTNAME="CUstomZU"
BR2_TARGET_GENERIC_ISSUE="Welcome to Martins uzed"
BR2_TARGET_GENERIC_PASSWD_SHA512=y
BR2_TARGET_GENERIC_ROOT_PASSWD="root"
BR2_TARGET_ROOTFS_CPIO=y
BR2_TARGET_ROOTFS_CPIO_LZMA=y
BR2_TARGET_ROOTFS_CPIO_TAR=n
# RootFS
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_MYDIR_PATH)/board/rootfs-overlay"
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_MYDIR_PATH)/board/post-image.sh"
an build it, then I create an image with kernel, dtb and rootfs using the following its (FIT) file:
/dts-v1/;
/ {
description = "Simple image with single Linux kernel";
images {
kernel-1 {
description = "Linux kernel";
data = /incbin/("./zImage.gz");
type = "kernel";
arch = "arm";
os = "linux";
compression = "gzip";
load = <0x8000>;
entry = <0x8000>;
hash-1 {
algo = "sha1";
};
};
fdt-1 {
description = "Device Tree blob";
data = /incbin/("./kernel.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash-1 {
algo = "sha1";
};
};
ramdisk-1 {
description = "petalinux-image-minimal";
data = /incbin/("./rootfs.cpio");
type = "ramdisk";
arch = "ARM";
os = "linux";
compression = "none";
hash {
algo = "sha256";
};
};
};
configurations {
default = "config-1";
config-1 {
description = "Boot Linux kernel";
kernel = "kernel-1";
fdt = "fdt-1";
ramdisk = "ramdisk-1";
hash-1 {
algo = "sha1";
};
};
};
};
u-boot loads the itb file form SD card and starts the kernel which runs into a kernel panic:
U-Boot 2020.01 (Dec 29 2021 - 11:49:08 +0100)
CPU: Zynq 7z010
Silicon: v3.1
DRAM: ECC disabled 1 GiB
Flash: 0 Bytes
NAND: 0 MiB
MMC: mmc@e0100000: 0
Loading Environment from SPI Flash... SF: Detected s25fl128s with page size 256 Bytes, erase size 64 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
In: serial@e0001000
Out: serial@e0001000
Err: serial@e0001000
Net:
ZYNQ GEM: e000b000, mdio bus e000b000, phyaddr -1, interface rgmii-id
Warning: ethernet@e000b000 (eth0) using random MAC address - 72:da:85:32:49:f9
eth0: ethernet@e000b000
Hit any key to stop autoboot: 0
Copying Linux from SDCard to RAM...
13309917 bytes read in 1130 ms (11.2 MiB/s)
Loading kernel from FIT Image at 03000000 ...
Using 'config-1' configuration
Verifying Hash Integrity ... OK
Trying 'kernel-1' kernel subimage
Description: Linux kernel
Type: Kernel Image
Compression: gzip compressed
Data Start: 0x030000c8
Data Size: 4182451 Bytes = 4 MiB
Architecture: ARM
OS: Linux
Load Address: 0x00008000
Entry Point: 0x00008000
Hash algo: sha1
Hash value: 4a503e5aa2d56ace0fe0084206c222f1a5707b83
Verifying Hash Integrity ... sha1+ OK
Loading ramdisk from FIT Image at 03000000 ...
Using 'config-1' configuration
Verifying Hash Integrity ... OK
Trying 'ramdisk-1' ramdisk subimage
Description: petalinux-image-minimal
Type: RAMDisk Image
Compression: uncompressed
Data Start: 0x0340028c
Data Size: 9113600 Bytes = 8.7 MiB
Architecture: ARM
OS: Linux
Load Address: unavailable
Entry Point: unavailable
Hash algo: sha256
Hash value: 9305eec29a98a21cec5f5b7717b9be8e88cc898242df616289acfdbf10cf3c94
Verifying Hash Integrity ... sha256+ OK
Loading fdt from FIT Image at 03000000 ...
Using 'config-1' configuration
Verifying Hash Integrity ... OK
Trying 'fdt-1' fdt subimage
Description: Device Tree blob
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x033fd368
Data Size: 11874 Bytes = 11.6 KiB
Architecture: ARM
Hash algo: sha1
Hash value: fbd24a6bd4bcc30bc443ecf7edfdb13ba70c26ab
Verifying Hash Integrity ... sha1+ OK
Booting using the fdt blob at 0x33fd368
Uncompressing Kernel Image
Loading Ramdisk to 3e259000, end 3eb0a000 ... OK
Loading Device Tree to 3e253000, end 3e258e61 ... OK
Starting kernel ...
Booting Linux on physical CPU 0x0
Linux version 5.4.0-xilinx (martin@ubuntu) (gcc version 10.3.0 (Buildroot 2021.11-575-gcf494c78c1)) #16 SMP PREEMPT Wed Dec 29 20:22:29 CET 2021
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: xlnx,zynq-7000
earlycon: cdns0 at MMIO 0xe0001000 (options '115200n8')
printk: bootconsole [cdns0] enabled
Memory policy: Data cache writealloc
cma: Reserved 16 MiB at 0x3f000000
8<--- cut here ---
Unable to handle kernel paging request at virtual address fe253000
pgd = (ptrval)
[fe253000] *pgd=00000000
Internal error: Oops - BUG: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 5.4.0-xilinx #16
Hardware name: Xilinx Zynq Platform
PC is at fdt32_ld+0x0/0xc
LR is at fdt_check_header+0x10/0x144
pc : [<c0677ca4>] lr : [<c0677d6c>] psr: a00000d3
sp : c0a01f20 ip : 00a5237f fp : c0a104cc
r10: c085c5a8 r9 : c091f758 r8 : 00000000
r7 : fe253000 r6 : c0a4bbcc r5 : c0a0823c r4 : c091f758
r3 : fe253000 r2 : d00dfeed r1 : 00000000 r0 : fe253000
Flags: NzCv IRQs off FIQs off Mode SVC_32 ISA ARM Segment none
Control: 18c5387d Table: 0000404a DAC: 00000051
Process swapper (pid: 0, stack limit = 0x(ptrval))
Stack: (0xc0a01f20 to 0xc0a02000)
1f20: c091f758 c0a0823c c0a4bbcc c0537628 c091f758 c0a0823c c0a06e40 c0a310c0
1f40: c0a40c90 efffeec0 c085c5a8 c09208a4 00000000 0000000c c092d398 c090418c
1f60: ffffffff 18c5387d c0a30f40 00000000 00000000 00000001 413fc090 18c5387d
1f80: 00000000 c0154e88 c07f3e2d 00000000 00000001 c0900330 c0a30f40 c0a03c40
1fa0: 00000000 00000001 413fc090 18c5387d 00000000 c090095c 00000000 00000000
1fc0: 00000000 00000000 00000000 c092fa40 00000000 00000000 00000000 c0900330
1fe0: 00000051 10c0387d 00000000 3e253000 413fc090 00000000 00000000 00000000
[<c0677ca4>] (fdt32_ld) from [<c0677d6c>] (fdt_check_header+0x10/0x144)
[<c0677d6c>] (fdt_check_header) from [<c0537628>] (__unflatten_device_tree+0x28/0xfc)
[<c0537628>] (__unflatten_device_tree) from [<c09208a4>] (unflatten_device_tree+0x24/0x40)
[<c09208a4>] (unflatten_device_tree) from [<c090418c>] (setup_arch+0x64c/0xa9c)
[<c090418c>] (setup_arch) from [<c090095c>] (start_kernel+0x58/0x41c)
[<c090095c>] (start_kernel) from [<00000000>] (0x0)
Code: ebf217db e28dd014 e49df004 c0677b9c (e5900000)
random: get_random_bytes called from init_oops_id+0x24/0x48 with crng_init=0
---[ end trace 0000000000000000 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---
Possibly my kernel config is wrong or the rootFS is misconfigured, but not sure where to start since the kernel log is not really helping me.