0
votes

I am trying to port kernel 4.12 to my board, but I'm facing a very weird issue.

Some context: I am using u-boot as bootloader, booting from a zImage with device tree support. The board has a Sitara AM3352.

What happens is that sometimes the kernel will start printing stuff, but most often it does nothing.

Situation 1:

U-Boot# bootz $kloadaddr - $fdtaddr
## Current stack ends at 0x83ee8bf8 Kernel image @ 0x80007fc0 [ 0x00000000 - 0x002d9430 ]
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
using: FDT
using: FDT
   Loading Device Tree to 83edd000, end 83ee7337 ... OK
## Transferring control to Linux (at address 80007fc0)...

Starting kernel ...

Situation 2:

U-Boot# bootz $kloadaddr - $fdtaddr
## Current stack ends at 0x83ee8bf8 Kernel image @ 0x80007fc0 [ 0x00000000 - 0x002d9430 ]
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
using: FDT
using: FDT
   Loading Device Tree to 83edd000, end 83ee7337 ... OK
## Transferring control to Linux (at address 80007fc0)...

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.12.0R01-Beta (guilherme@epoch) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0) ) #4 Thu Aug 3 14:30:16 BRT 2017
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Test Board
[    0.000000] earlycon: omapserial0 at MMIO 0x44e09000 (options '')
[    0.000000] bootconsole [omapserial0] enabled
[    0.000000] Memory policy: Data cache writeback
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] AM335X ES2.1 (neon)
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mtdblock10 rw rootfstype=jffs2 noinitrd earlycon
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Memory: 56952K/65536K available (4096K kernel code, 179K rwdata, 1484K rodata, 1024K init, 438K bss, 8584K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc4800000 - 0xff800000   ( 944 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0500000   (5088 kB)
[    0.000000]       .init : 0xc0700000 - 0xc0800000   (1024 kB)
[    0.000000]       .data : 0xc0800000 - 0xc082cd90   ( 180 kB)
[    0.000000]        .bss : 0xc0831794 - 0xc089f2c8   ( 439 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
[    0.000000] OMAP clockevent source: timer2 at 24000000 Hz
[    0.000020] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.008003] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.017467] OMAP clocksource: timer1 at 24000000 Hz
[    0.022622] clocksource_probe: no matching clocksources found
[    0.028583] Calibrating delay loop... 599.04 BogoMIPS (lpj=1198080)
[    0.059960] pid_max: default: 32768 minimum: 301
[    0.064987] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.071729] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.079579] CPU: Testing write buffer coherency: ok
[    0.085216] Setting up static identity map for 0x80100000 - 0x80100060
[    0.095211] devtmpfs: initialized
[    0.107961] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    0.116265] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.126579] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.132888] pinctrl core: initialized pinctrl subsystem
[    0.139759] NET: Registered protocol family 16
[    0.145433] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.165036] omap_hwmod: debugss: _wait_target_disable failed
[    0.171060] Unhandled fault: external abort on non-linefetch (0x1028) at 0xf9e3e078
[    0.178849] pgd = c0004000
[    0.181618] [f9e3e078] *pgd=44e11452(bad)
[    0.185740] Internal error: : 1028 [#1] ARM
[    0.190019] Modules linked in:
[    0.193157] CPU: 0 PID: 1 Comm: swapper Not tainted 4.12.0R01-Beta #4
[    0.199760] Hardware name: Generic AM33XX (Flattened Device Tree)
[    0.206019] task: c3830000 task.stack: c382e000
[    0.210684] PC is at _update_sysc_cache+0x2c/0x94
[    0.215494] LR is at _enable+0x240/0x2a8
[    0.219517] pc : [<c0120b24>]    lr : [<c0121314>]    psr: 40000013
[    0.219517] sp : c382fe98  ip : c0124774  fp : 00000000
[    0.231311] r10: c0721838  r9 : 00000045  r8 : c08317c0
[    0.236673] r7 : c080abf0  r6 : 00000000  r5 : c0831c68  r4 : c080a5a4
[    0.243377] r3 : f9e3e078  r2 : c080b084  r1 : f9e3e000  r0 : c080a5a4
[    0.250083] Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[    0.257409] Control: 10c5387d  Table: 80004019  DAC: 00000051
[    0.263307] Process swapper (pid: 1, stack limit = 0xc382e210)
[    0.269296] Stack: (0xc382fe98 to 0xc3830000)
[    0.273768] fe80:                                                       00000000 c0121314
[    0.282173] fea0: 00000000 a0000013 c08092a8 c0803048 c080a5a4 c080a5d4 c080a5e8 c0709328
[    0.290574] fec0: c382fed4 d3053b52 c080ae5c d3053b52 c080a5a4 c0807808 c0709240 00000000
[    0.298975] fee0: c08317c0 c0121718 0000100c c0803048 00000002 c07099c8 00000000 c0709a6c
[    0.307377] ff00: 00000000 c0101794 00000154 c3ffed09 c0671b34 c0147200 000017c0 c0228d30
[    0.315777] ff20: c0803048 c05edd2c c07005dc 00000000 00000002 00000002 00000000 c0803048
[    0.324179] ff40: 00000000 c3ffed09 00000000 d3053b52 00000000 d3053b52 00000002 c072c0f8
[    0.332580] ff60: 00000002 c0721820 c08317c0 c08317c0 00000045 c0700dc8 00000002 00000002
[    0.340981] ff80: 00000000 c07005dc 00000000 c04a7cc0 00000000 00000000 00000000 00000000
[    0.349382] ffa0: 00000000 c04a7cc8 00000000 c010dd98 00000000 00000000 00000000 00000000
[    0.357783] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    0.366184] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 ffffffff fffffffb
[    0.374609] [<c0120b24>] (_update_sysc_cache) from [<c0121314>] (_enable+0x240/0x2a8)
[    0.382637] [<c0121314>] (_enable) from [<c0709328>] (_setup+0xe8/0x4e8)
[    0.389516] [<c0709328>] (_setup) from [<c0121718>] (omap_hwmod_for_each+0x38/0x60)
[    0.397378] [<c0121718>] (omap_hwmod_for_each) from [<c0709a6c>] (__omap_hwmod_setup_all+0xa4/0xac)
[    0.406676] [<c0709a6c>] (__omap_hwmod_setup_all) from [<c0101794>] (do_one_initcall+0x50/0x18c)
[    0.415708] [<c0101794>] (do_one_initcall) from [<c0700dc8>] (kernel_init_freeable+0x140/0x1dc)
[    0.424650] [<c0700dc8>] (kernel_init_freeable) from [<c04a7cc8>] (kernel_init+0x8/0x10c)
[    0.433052] [<c04a7cc8>] (kernel_init) from [<c010dd98>] (ret_from_fork+0x14/0x3c)
[    0.440815] Code: e3110c01 e5901054 e6f13073 1a00000c (e5933000)
[    0.447075] ---[ end trace 396cebd12b8145f9 ]---
[    0.451867] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    0.451867]
[    0.461190] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    0.461190]
[    1.373583] random: fast init done

This is my .dts file:

/dts-v1/;                                                                                               

#include "am33xx.dtsi"                                                                                  
#include <dt-bindings/interrupt-controller/irq.h>                                                       

/ {                                                                                                     
   model = "Test Board";                                                                             
   compatible = "guilherme,test_board", "ti,am33xx";                                                           

   memory@80000000 {                                                                                    
      device_type = "memory";                                                                           
      reg = <0x80000000 0x04000000>; /* 64 MB */                                                        
   };                                                                                                   

   chosen {                                                                                             
      stdout-path = &uart0;                                                                             
      bootargs ="console=ttyO0,115200n8 root=/dev/mtdblock10 rw rootfstype=jffs2 noinitrd earlycon";    
   };

};

While I was expecting to run into a kernel panic, what bugs me is this printing inconsistency. Also I can't see a way to pinpoint if this issue is due to some weird u-boot config, or something related to the kernel itself.

1
How much memory do you actually have? Is this a custom board? Have you updated the memory configuration information to know you only have 64MB as that dts says? - Tom Rini
It is a custom board and the memory size is indeed 64MB. - Guilherme Costa
I could think of wrong memory settings and / or addresses. - 0andriy
The "print inconsistency" is indicative of a boot failure. The fact that you can intermittently see the kernel perform initialization implies that the U-Boot and kernel load addresses are okay. The intermittent boot failures do put the memory functionality into question. Have you performed an extensive memory test on this board of yours? - sawdust
First, since you only have 64MB, check that you've updated the memory init sequence correctly. Second, since you only have 64MB, only the area between 0x80000000 and 0x84000000 is going to be valid. That you put the device tree at 0x88000000 (+128MB from base) and it was found implies that no, part of memory is not configured correctly and it 'mirrored' the contents at 0x80000000 I think. You'll probably want to check other addresses used as the general assumption was a minimum of 256MB, not 64MB. - Tom Rini

1 Answers

0
votes

So, found out the problem! As I was working with a previously configured u-Boot, I tried to keep the u-Boot modifications to a minimum. Among these previously existing configurations, was a setenv bootargs = .... This bootargs definition overrides the definition in the .dtb file, causing conflicts. Once I removed this variable definition, the printing issue was resolved.

The reason the system was printing seemingly at random is because the bootargs definition was dependant on the state of a pin the is used to boot from images in a SDCard.