Showing results for 
Show  only  | Search instead for 
Did you mean: 
Registered: ‎09-28-2018

[Xilinx-v2017.2] Linux manual build: Kernel Panic @ mii bus

Hi guys, 


Still working on the manual build of a Linux system for an SD card. I managed to do a Petalinux 2017.2 build but now, to get a sense of what is going on "behind the scenes" I'm trying to build things manually to determine at a later stage which way we will take for the production series. Petalinux works, but is a bit hard to understand what is really going on


I'm getting following error when booting Linux: 


CAN device driver interface
Unable to handle kernel NULL pointer dereference at virtual address 0000000c
pgd = c0004000
[0000000c] *pgd=00000000
Internal error: Oops - BUG: 5 [#1] PREEMPT SMP ARM

According to my previous Petalinux boot log it should load the MACB mmi bus driver :


libphy: MACB_mii_bus: probed

As far I know, the Linux configuration is the same as my Petalinux Kconfig. I checked this side by side. And I'm using the same DTB files as my Petalinux build, just to rule some things out. 


Full boot log:

U-Boot 2017.01+ (Oct 04 2018 - 07:29:06 -0700)

Model: Zynq PicoZed Board
Board: Xilinx Zynq
DRAM:  ECC disabled 
732.4 MiB
sdhci@e0100000: 0 (SD), sdhci@e0101000: 1 (eMMC)
Using default environment

In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Model: Zynq PicoZed Board
Board: Xilinx Zynq
Net:   ZYNQ GEM: e000b000, phyaddr 0, interface rgmii-id
eth0: ethernet@e000b000
Hit any key to stop autoboot:  2 
\0x08\0x08\0x08 1 
\0x08\0x08\0x08 0 
Device: sdhci@e0100000
Manufacturer ID: 1b
OEM: 534d
Name: EB1QT 
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 29.8 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
Copying Linux from SD to RAM...RFS in ext4
reading uImage

3771824 bytes read in 361 ms (10 MiB/s)
reading system.dtb

14082 bytes read in 15 ms (916 KiB/s)
## Booting kernel from Legacy Image at 02080000 ...
   Image Name:   Linux-4.9.0-xilinx-v2017.2-dirty
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3771760 Bytes = 3.6 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... 
## Flattened Device Tree blob at 02000000
   Booting using the fdt blob at 0x2000000
   Loading Kernel Image ... 
   Loading Device Tree to 2cf93000, end 2cf99701 ... OK

Starting kernel ...

Uncompressing Linux...
 done, booting the kernel.
Booting Linux on physical CPU 0x0

Linux version 4.9.0-xilinx-v2017.2-dirty (zynqdev@ubuntu) (gcc version 4.9.2 (Sourcery CodeBench Lite 2015.05-17) ) #8 SMP PREEMPT Thu Oct 4 07:20:15 PDT 2018
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
bootconsole [earlycon0] enabled
cma: Reserved 16 MiB at 0x2bc00000
Memory policy: Data cache writealloc
percpu: Embedded 14 pages/cpu @edc33000 s25984 r8192 d23168 u57344
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 186035
Kernel command line: console=ttyPS0,115200 earlyprintk uio_pdrv_genirq.of_id=generic-uio root=/dev/mmcblk0p2 rw rootwait
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 717020K/750000K available (6144K kernel code, 203K rwdata, 1456K rodata, 1024K init, 230K bss, 16596K reserved, 16384K cma-reserved, 0K highmem)
Virtual kernel memory layout:

    vector  : 0xffff0000 - 0xffff1000   (   4 kB)

    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)

    vmalloc : 0xee000000 - 0xff800000   ( 280 MB)

    lowmem  : 0xc0000000 - 0xedc6c000   ( 732 MB)

    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)

    modules : 0xbf000000 - 0xbfe00000   (  14 MB)

      .text : 0xc0008000 - 0xc0700000   (7136 kB)

      .init : 0xc0900000 - 0xc0a00000   (1024 kB)

      .data : 0xc0a00000 - 0xc0a32d40   ( 204 kB)

       .bss : 0xc0a32d40 - 0xc0a6c75c   ( 231 kB)
Preemptible hierarchical RCU implementation.
\0x09Build-time adjustment of leaf fanout to 32.
\0x09RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
NR_IRQS:16 nr_irqs:16 16
efuse mapped to ee000000
slcr mapped to ee002000
L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
L2C-310 erratum 769419 enabled
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 ID prefetch enabled, offset 1 lines
L2C-310 dynamic clock gating enabled, standby mode enabled
L2C-310 cache controller enabled, 8 ways, 512 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001
zynq_clock_init: clkc starts at ee002100
Zynq clock init
sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af025, max_idle_ns: 440795209040 ns
Switching to timer-based delay loop, resolution 3ns
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537538477 ns
timer #0 at ee00a000, irq=17
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 666.66 BogoMIPS (lpj=3333333)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x100000 - 0x100058
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
Brought up 2 CPUs
SMP: Total of 2 processors activated (1333.33 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor menu
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0xee040000
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
GPIO IRQ not connected
XGpio: /amba_pl/gpio@41200000: registered, base is 874
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
media: Linux media interface: v0.10
Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <>
PTP clock support
EDAC MC: Ver: 3.0.0
FPGA manager framework
fpga-region fpga-full: FPGA Region probed
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource arm_global_timer
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport m
RPC: Registered tcp NFSv4.1 backchannel transport module.
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
futex hash table entries: 512 (order: 3, 32768 bytes)
workingset: timestamp_bits=30 max_order=18 bucket_order=0
jffs2: version 2.2. (NAND) (SUMMARY)  \0xc2\0xa9 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-24133
dma-pl330 f8003000.dmac: \0x09DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
xilinx-vdma 40400000.dma: Xilinx AXI VDMA Engine Driver Probed!!
xilinx-vdma 40410000.dma: Xilinx AXI VDMA Engine Driver Probed!!
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 143, base_baud = 3125000) is a xuartps
\0xe0console [ttyPS0] enabled
console [ttyPS0] enabled
bootconsole [earlycon0] disabled
bootconsole [earlycon0] disabled

[drm] Initialized
brd: module load
loop: module loaded
libphy: Fixed MDIO Bus: probed
libphy: mdio_driver_register: xgmiitorgmii
CAN device driver interface
Unable to handle kernel NULL pointer dereference at virtual address 0000000c
pgd = c0004000
[0000000c] *pgd=00000000
Internal error: Oops - BUG: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.9.0-xilinx-v2017.2-dirty #8
Hardware name: Xilinx Zynq Platform
task: ed04f640 task.stack: ed050000
PC is at of_get_named_gpiod_flags+0x44/0xd8
LR is at __of_parse_phandle_with_args+0xb8/0xc4
pc : [<c030a8b4>]    lr : [<c04e0288>]    psr: a0000013
sp : ed051db8  ip : 00000000  fp : edc558d0
r10: 00000091  r9 : fffffffe  r8 : c080263c
r7 : 00000000  r6 : ed051dc0  r5 : 00000000  r4 : 00000000
r3 : 00000000  r2 : c080263c  r1 : c07280c4  r0 : c07ecc40
Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 18c5387d  Table: 0000404a  DAC: 00000051
Process swapper/0 (pid: 1, stack limit = 0xed050210)
Stack: (0xed051db8 to 0xed052000)
1da0:                                                       00000000 00000000
1dc0: 00000000 ed0bd000 ed150600 ed150610 ed0bd500 c04e02bc 00000000 ed051de0
1de0: 00000000 00000000 c0a5f2f0 00000000 c0a5f2f0 ed051e24 a0000013 c04de748
1e00: edc558d0 ed150600 ed150610 ed0bd000 ed150600 ed150610 ed0bd500 c073e5e0
1e20: 00000000 c030a950 00000000 c03ffe04 00000000 c0222d80 eb50c910 c0223688
1e40: 00000000 c03ff614 00000001 00000001 ed1dd7c0 ed1ddac0 eb507580 00000000
1e60: eb50c9b0 00000001 c0a32d40 c03ff9a0 ed150610 c0a1efa4 c0a1efa4 00000000
1e80: c0a32d40 c093283c 00000000 c03a0b2c ed150610 c0a5d374 00000000 c039f4d0
1ea0: ed150610 ed150644 c0a1efa4 c0a19d58 c0a32d40 c039f6b4 00000000 c0a1efa4
1ec0: c039f634 c039dc80 ed090f5c ed126f34 c0a1efa4 00000000 eb50de80 c039ec18
1ee0: c0802735 c0802736 00000000 c0a1efa4 c091d108 00000000 c093d1b0 c039fddc
1f00: c03a0604 00000006 c091d108 c010185c c070467c c0a3c9a0 00000000 c021b390
1f20: c07d5600 ed08ce00 000000c9 edc6bddb c086b56c c01332d4 c086a5b8 00000006
1f40: 00000006 c086b580 000000c9 c086b580 c0a0b5e4 00000006 c0932830 000000ca
1f60: 00000006 c0932834 000000ca c0a32d40 c0a32d40 c0900d34 00000006 00000006
1f80: 00000000 c0900598 00000000 c060dc3c 00000000 00000000 00000000 00000000
1fa0: 00000000 c060dc44 00000000 c0106fb8 00000000 00000000 00000000 00000000
1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[<c030a8b4>] (of_get_named_gpiod_flags) from [<c030a950>] (of_get_named_gpio_flags+0x8/0x18)
[<c030a950>] (of_get_named_gpio_flags) from [<c03ffe04>] (macb_probe+0x464/0xa10)
[<c03ffe04>] (macb_probe) from [<c03a0b2c>] (platform_drv_probe+0x50/0xa0)
[<c03a0b2c>] (platform_drv_probe) from [<c039f4d0>] (driver_probe_device+0x114/0x278)
[<c039f4d0>] (driver_probe_device) from [<c039f6b4>] (__driver_attach+0x80/0xa4)
[<c039f6b4>] (__driver_attach) from [<c039dc80>] (bus_for_each_dev+0x6c/0x90)
[<c039dc80>] (bus_for_each_dev) from [<c039ec18>] (bus_add_driver+0xc8/0x1e4)
[<c039ec18>] (bus_add_driver) from [<c039fddc>] (driver_register+0x9c/0xe0)
[<c039fddc>] (driver_register) from [<c010185c>] (do_one_initcall+0xac/0x120)
[<c010185c>] (do_one_initcall) from [<c0900d34>] (kernel_init_freeable+0x120/0x1e8)
[<c0900d34>] (kernel_init_freeable) from [<c060dc44>] (kernel_init+0x8/0x110)
[<c060dc44>] (kernel_init) from [<c0106fb8>] (ret_from_fork+0x14/0x3c)
Code: e58d5000 e1a02008 e59f0084 e59f1084 (e597300c) 
---[ end trace 1134608814abdcd2 ]---
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

CPU0: stopping
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G      D         4.9.0-xilinx-v2017.2-dirty #8
Hardware name: Xilinx Zynq Platform
[<c010e58c>] (unwind_backtrace) from [<c010a764>] (show_stack+0x10/0x14)
[<c010a764>] (show_stack) from [<c02dfa4c>] (dump_stack+0x80/0xa0)
[<c02dfa4c>] (dump_stack) from [<c010cd0c>] (ipi_cpu_stop+0x3c/0x70)
[<c010cd0c>] (ipi_cpu_stop) from [<c010d514>] (handle_IPI+0x64/0x84)
[<c010d514>] (handle_IPI) from [<c0101450>] (gic_handle_irq+0x78/0x94)
[<c0101450>] (gic_handle_irq) from [<c010b18c>] (__irq_svc+0x6c/0xa8)
Exception stack(0xc0a01f60 to 0xc0a01fa8)
1f60: 00000001 00000000 00000000 c0116800 00000000 00000000 c0a00000 c0a0302c
1f80: 00000001 c0942e38 c0a01fb8 00000000 c0a01f50 c0a01fb0 c01079dc c01079e0
1fa0: 60000013 ffffffff
[<c010b18c>] (__irq_svc) from [<c01079e0>] (arch_cpu_idle+0x2c/0x38)
[<c01079e0>] (arch_cpu_idle) from [<c014d2bc>] (cpu_startup_entry+0xf4/0x1a4)
[<c014d2bc>] (cpu_startup_entry) from [<c0900bb4>] (start_kernel+0x2f4/0x354)
[<c0900bb4>] (start_kernel) from [<0000807c>] (0x807c)
---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

The entry in the system-user.dtbi file:


&gem0 {
interrupt-parent = <&intc>;

&gem1 {
interrupt-parent = <&intc>;

&gem1 { local-mac-address = [00 0a 35 00 00 01]; phy-handle = <&phy0>;
gmii2rgmii-phy-handle = <&gmii_to_rgmii_0>; phy-mode = "gmii"; status = "okay"; ps7_ethernet_1_mdio: mdio { #address-cells = <1>; #size-cells = <0>; phy0: phy@0 { device_type = "ethernet-phy"; reg = <0>; }; gmii_to_rgmii_0: phy@8 { compatible = "xlnx,gmii-to-rgmii-1.0"; reg = <8>; phy-handle = <&phy0>; }; }; };

And the entry in the zynq-7000.dtsi file:

                gem0: ethernet@e000b000 {
                        compatible = "cdns,zynq-gem", "cdns,gem";
                        reg = <0xe000b000 0x1000>;
                        status = "disabled";
                        interrupts = <0 22 4>;
                        clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>;
                        clock-names = "pclk", "hclk", "tx_clk";
                        #address-cells = <1>;
                        #size-cells = <0>;

                gem1: ethernet@e000c000 {
                        compatible = "cdns,zynq-gem", "cdns,gem";
                        reg = <0xe000c000 0x1000>;
                        status = "disabled";
                        interrupts = <0 45 4>;
                        clocks = <&clkc 31>, <&clkc 31>, <&clkc 14>;
                        clock-names = "pclk", "hclk", "tx_clk";
                        #address-cells = <1>;
                        #size-cells = <0>;


Does this sound familiar to anyone, or do you have any ideas about this issue? 


0 Kudos
3 Replies
Registered: ‎12-04-2016



You mean boot images when generated in petalinux build works fine without MII issues? May I know what are the steps being followed during manual build? 



Best Regards


0 Kudos
Registered: ‎09-28-2018



Thanks for looking into this. 


My manual build is made from Xilinx git & SDK sources. The only 2 things I did is re-use the device tree ( dts files ) for the Linux boot and I compared the Linux configuration ( make menuconfig ) with the Petalinux configuration ( petalinux-config -c kernel ).


For anything else, I build things the manual way like indicated on these pages


Build the FSBL ( hsi ), Device tree compiler, U-boot, linux, and prepaired the Boot files with the SDK. 

I try to stick with the checkout tag "Xilinx-v2017.2" for the sources as I did for the Petalinux build. 


I'm lost in the woods right now, I can't figure out why my boot fails. 

0 Kudos
Registered: ‎09-28-2018

Did some more searching and it seems according to the tracelog it would go wrong here in this piece of code of macb.c ( Xilinx-v2017.2 tag  -> Github )


It seems like Linux want's to use a GPIO for the reset of the ethernet module, but there is none assigned on board nor in the devicetree. It should skip this step en go further with the booting. I'll try to add some debug messages into the code which hopefully tells me a bit more. 


/* Power up the PHY if there is a GPIO reset */
	phy_node = of_parse_phandle(np, "phy-handle", 0);
	if (!phy_node && of_phy_is_fixed_link(np)) {
		err = of_phy_register_fixed_link(np);
		if (err < 0) {
			dev_err(&pdev->dev, "broken fixed-link specification");
			goto failed_phy;
		phy_node = of_node_get(np);
		bp->phy_node = phy_node;
	} else {
		int gpio = of_get_named_gpio(phy_node, "reset-gpios", 0);
		if (gpio_is_valid(gpio)) {
			bp->reset_gpio = gpio_to_desc(gpio);
			gpiod_direction_output(bp->reset_gpio, 1);

Edit: I now found out the function  of_get_named_gpio() fails.

If I let this function out of the compilation Linux boots normally. 


Edit 2: If I dig deeper it leads me to xilinx-v2017.2/drivers/gpio/gpiolib-of.c

Where function 

ret = of_parse_phandle_with_args(np, propname, "#gpio-cells",index,&gpiospec);



@shabbirk Have you got any idea how to proceed? 

The parsing of non existent device tree entries fails which makes me wondering if the devicetree might be wrong. If on the other hand the devicetree is correct I feel like "out of my alley" and I think I just need to comment out the else statement. 


0 Kudos