Where can I load a GPIO module at the earliest? - linux-kernel

I wrote a kernel module which works as expected. But I want that to be loaded at the beginning of the boot process. So I moved this code to
OpenWRT/build_dir/target-i386_geode_eglibc-2.19/linux-x86_alix2/linux-3.10.49/arch/x86/platform
and my code is here:
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/gpio.h>
#include <linux/delay.h>
#include <linux/cs5535.h>
MODULE_AUTHOR("Ramana");
MODULE_DESCRIPTION("POWER LED DRIVER");
#ifdef MODULE_LICENSE
MODULE_LICENSE("Dual BSD/GPL");
#endif
#define HW_VERSION_GPIO 15
#define LATCH_GPIO 6
#define DATA_GPIO 25
#define CLOCK_GPIO 27
#define HIGH 1
#define LOW 0
static void set_power_led(void)
{
uint8_t i = 0;
/*
* Configure Pins Q8 Q7 Q6....Q0 in shift register
* Set 0 to glow LED
*
* shift_reg:
* indices 0, 1 and 2 are for LED3
* 0 1 1 -> Blue_ON, GREEN_OFF, RED_OFF
*
* indices 3, 4 and 5 are for LED1
*
* indices 6, 7 and 8 are for LED2
* 0 1 1 -> Blue_ON, GREEN_OFF, RED_OFF
*
* The pins Q9 Q10 and Q11 are don't care, so we are not using here
*/
uint8_t shift_reg[9] = {0, 1, 1, 1, 1, 1, 1, 1, 1};
/*
* Clear register before set
*/
for (i = 0; i < 9 ; i ++) {
gpio_set_value(CLOCK_GPIO, LOW);
if (shift_reg[i] == 0) {
gpio_set_value(DATA_GPIO, HIGH);
} else {
gpio_set_value(DATA_GPIO, LOW);
}
gpio_set_value(CLOCK_GPIO, HIGH);
}
gpio_set_value(LATCH_GPIO, HIGH);
msleep(1);
gpio_set_value(LATCH_GPIO, LOW);
}
static int __init power_led_init(void)
{
/*
* If GPIO 15 is high, it is old hardware
*/
printk(KERN_INFO "LED INIT\n");
if (!gpio_is_valid(LATCH_GPIO)) {
printk(KERN_INFO "LEDs: Latch gpio is not valid\n");
return -ENODEV;
}
if (!gpio_is_valid(DATA_GPIO)) {
printk(KERN_INFO "LEDs: Data gpio is not valid\n");
return -ENODEV;
}
if (!gpio_is_valid(CLOCK_GPIO)) {
printk(KERN_INFO "LEDs: Clock gpio is not valid\n");
return -ENODEV;
}
gpio_request(LATCH_GPIO, "sysfs");
gpio_request(DATA_GPIO, "sysfs");
gpio_request(CLOCK_GPIO, "sysfs");
gpio_direction_output(LATCH_GPIO, LOW);
gpio_direction_output(DATA_GPIO, LOW);
gpio_direction_output(CLOCK_GPIO, LOW);
set_power_led();
printk(KERN_INFO "Power LED: registered\n");
return 0;
}
static void __exit power_led_exit(void)
{
uint8_t i;
for (i = 0; i < 9 ; i++) {
gpio_set_value(CLOCK_GPIO, LOW);
gpio_set_value(DATA_GPIO, LOW);
gpio_set_value(CLOCK_GPIO, HIGH);
}
gpio_set_value(LATCH_GPIO, HIGH);
msleep(1);
gpio_set_value(LATCH_GPIO, LOW);
}
module_init(power_led_init);
module_exit(power_led_exit);
With this there is a kernel panic:
[ 0.104709] LED INIT
[ 0.105306] BUG: unable to handle kernel NULL pointer dereference at 0000004c
[ 0.106284] IP: [<c115acc2>] __gpio_set_value+0x12/0x80
[ 0.106284] *pde = 00000000
[ 0.106284] Oops: 0000 [#1]
[ 0.106284] Modules linked in:
[ 0.106284] CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.49 #33
[ 0.106284] task: cf834000 ti: cf840000 task.ti: cf840000
[ 0.106284] EIP: 0060:[<c115acc2>] EFLAGS: 00010286 CPU: 0
[ 0.106284] EIP is at __gpio_set_value+0x12/0x80
[ 0.106284] EAX: c13a1624 EBX: c13a1624 ECX: ffffffea EDX: 00000000
[ 0.106284] ESI: 00000000 EDI: 00000000 EBP: cf841f80 ESP: cf841f24
[ 0.106284] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
[ 0.106284] CR0: 8005003b CR2: 0000004c CR3: 01371000 CR4: 00000090
[ 0.106284] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[ 0.106284] DR6: ffff0ff0 DR7: 00000400
[ 0.106284] Stack:
[ 0.106284] cf841f3b cf841f44 0000003e c133b05e c12b0d03 006e6967 01010101 01010101
[ 0.106284] 00000000 c133afbb c1000172 cfdff401 00060006 c13019c0 c12ced19 cfdff460
[ 0.106284] 00000000 cfdff460 00000200 c114956a c136c480 00000006 0000003e cf840000
[ 0.106284] Call Trace:
[ 0.106284] [<c133b05e>] ? power_led_init+0xa3/0x112
[ 0.106284] [<c133afbb>] ? alix_init+0xf6/0xf6
[ 0.106284] [<c1000172>] ? do_one_initcall+0xb2/0x150
[ 0.106284] [<c114956a>] ? strcpy+0xa/0x20
[ 0.106284] [<c132da22>] ? kernel_init_freeable+0xd1/0x173
[ 0.106284] [<c132d4aa>] ? do_early_param+0x77/0x77
[ 0.106284] [<c124ad68>] ? kernel_init+0x8/0x170
[ 0.106284] [<c1251322>] ? ret_from_kernel_thread+0x6/0x28
[ 0.106284] [<c1251337>] ? ret_from_kernel_thread+0x1b/0x28
[ 0.106284] [<c124ad60>] ? rest_init+0x60/0x60
[ 0.106284] Code: d6 ab aa aa aa ff d1 5b 5e 5f c3 8d b4 26 00 00 00 00 8d bc 27 00 00 00 00 57 f
[ 0.106284] EIP: [<c115acc2>] __gpio_set_value+0x12/0x80 SS:ESP 0068:cf841f24
[ 0.106284] CR2: 000000000000004c
[ 0.106284] ---[ end trace 23021a4cac17faa2 ]---
[ 0.107751] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
[ 0.107751]
Why this is crashing here and where can I add this to make this module loaded at the earliest.
Full minicom log
PC Engines ALIX.3 v0.99h
640 KB Base Memory
153603174448128645128089697280113664130048146432162816179200195584211968228352244736261120 KB Extended Memory
01F0 Master 045A InnoDisk Corp. - iCF4000 8GB
Phys C/H/S 16000/16/63 Log C/H/S 1003/255/63 LBA
GRUB loading....
Booting `OpenWrt'
[ 0.000000] Linux version 3.10.49 (savari#Ramana) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 unknown) ) #40 Tue Nov 8 13:11:49 IST 2016
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009ffff] usable
[ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000000fffffff] usable
[ 0.000000] BIOS-e820: [mem 0x00000000fff00000-0x00000000ffffffff] reserved
[ 0.000000] Notice: NX (Execute Disable) protection missing in CPU!
[ 0.000000] DMI not present or invalid.
[ 0.000000] e820: last_pfn = 0x10000 max_arch_pfn = 0x100000
[ 0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff]
[ 0.000000] init_memory_mapping: [mem 0x0fc00000-0x0fffffff]
[ 0.000000] init_memory_mapping: [mem 0x08000000-0x0fbfffff]
[ 0.000000] init_memory_mapping: [mem 0x00100000-0x07ffffff]
[ 0.000000] 256MB LOWMEM available.
[ 0.000000] mapped low ram: 0 - 10000000
[ 0.000000] low ram: 0 - 10000000
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x00001000-0x00ffffff]
[ 0.000000] Normal [mem 0x01000000-0x0fffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x00001000-0x0009ffff]
[ 0.000000] node 0: [mem 0x00100000-0x0fffffff]
[ 0.000000] Using APIC driver default
[ 0.000000] No local APIC present or hardware disabled
[ 0.000000] APIC: disable apic facility
[ 0.000000] APIC: switched to apic NOOP
[ 0.000000] e820: [mem 0x10000000-0xffefffff] available for PCI devices
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 64927
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz block2mtd.block2mtd=/dev/hda2,131072,rootfs,5 root=/dev/mtdblock0 rootfstype=jffs2 rootwait console=tty0 console=ttyS0,38400n8 noinitrd
[ 0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[ 0.000000] Initializing CPU#0
[ 0.000000] Memory: 255600k/262144k available (2377k kernel code, 6156k reserved, 873k data, 260k init, 0k highmem)
[ 0.000000] virtual kernel memory layout:
[ 0.000000] fixmap : 0xfffa3000 - 0xfffff000 ( 368 kB)
[ 0.000000] vmalloc : 0xd0800000 - 0xfffa1000 ( 759 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
[ 0.000000] .init : 0xc132d000 - 0xc136e000 ( 260 kB)
[ 0.000000] .data : 0xc1252630 - 0xc132cd00 ( 873 kB)
[ 0.000000] .text : 0xc1000000 - 0xc1252630 (2377 kB)
[ 0.000000] Checking if this processor honours the WP bit even in supervisor mode...Ok.
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:2304 nr_irqs:256 16
[ 0.000000] console [ttyS0] enabled
[ 0.000000] tsc: Fast TSC calibration using PIT
[ 0.000000] tsc: Detected 498.062 MHz processor
[ 0.003005] Calibrating delay loop (skipped), value calculated using timer frequency.. 996.12 BogoMIPS (lpj=498062)
[ 0.005013] pid_max: default: 32768 minimum: 301
[ 0.007653] Mount-cache hash table entries: 512
[ 0.011056] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[ 0.011056] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0
[ 0.011056] tlb_flushall_shift: -1
[ 0.012009] CPU: Geode(TM) Integrated Processor by AMD PCS (fam: 05, model: 0a, stepping: 02)
[ 0.018327] Performance Events: no PMU driver, software events only.
[ 0.026472] NET: Registered protocol family 16
[ 0.030862] PCI: PCI BIOS revision 2.10 entry at 0xfced9, last bus=0
[ 0.031012] PCI: Using configuration type 1 for base access
[ 0.051103] bio: create slab <bio-0> at 0
[ 0.057403] SCSI subsystem initialized
[ 0.060534] PCI: Probing PCI hardware
[ 0.062281] PCI host bridge to bus 0000:00
[ 0.063030] pci_bus 0000:00: root bus resource [io 0x0000-0xffff]
[ 0.064033] pci_bus 0000:00: root bus resource [mem 0x00000000-0xffffffff]
[ 0.065020] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[ 0.078410] Switching to clocksource pit
[ 0.086307] NET: Registered protocol family 2
[ 0.088599] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.089847] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.090949] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.092136] TCP: reno registered
[ 0.093867] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.095398] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.096873] NET: Registered protocol family 1
[ 0.100630] platform rtc_cmos: registered platform RTC device (no PNP device found)
[ 0.104665] alix: system is recognized as "PC Engines ALIX.3 v0.99h"
[ 0.106619] LED INIT
[ 0.107229] BUG: unable to handle kernel NULL pointer dereference at 0000004c
[ 0.108207] IP: [<c115acc2>] __gpio_set_value+0x12/0x80
[ 0.108207] *pde = 00000000
[ 0.108207] Oops: 0000 [#1]
[ 0.108207] Modules linked in:
[ 0.108207] CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.49 #40
[ 0.108207] task: cf834000 ti: cf840000 task.ti: cf840000
[ 0.108207] EIP: 0060:[<c115acc2>] EFLAGS: 00010286 CPU: 0
[ 0.108207] EIP is at __gpio_set_value+0x12/0x80
[ 0.108207] EAX: c13a1624 EBX: c13a1624 ECX: ffffffea EDX: 00000000
[ 0.108207] ESI: 00000000 EDI: 00000000 EBP: cf841f80 ESP: cf841f24
[ 0.108207] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
[ 0.108207] CR0: 8005003b CR2: 0000004c CR3: 01371000 CR4: 00000090
[ 0.108207] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[ 0.108207] DR6: ffff0ff0 DR7: 00000400
[ 0.108207] Stack:
[ 0.108207] cf841f3b cf841f44 0000003e c133b031 c12b0deb 006e6967 01010101 01010101
[ 0.108207] 00000000 c133afbb c1000172 00000001 00060006 c1301bf0 c12ceeb1 cfdff460
[ 0.108207] 00000000 cfdff460 00000200 00000000 c136c480 00000006 0000003e cf840000
[ 0.108207] Call Trace:
[ 0.108207] [<c133b031>] ? power_led_init+0x76/0xe5
[ 0.108207] [<c133afbb>] ? alix_init+0xf6/0xf6
[ 0.108207] [<c1000172>] ? do_one_initcall+0xb2/0x150
[ 0.108207] [<c132da22>] ? kernel_init_freeable+0xd1/0x173
[ 0.108207] [<c132d4aa>] ? do_early_param+0x77/0x77
[ 0.108207] [<c124b058>] ? kernel_init+0x8/0x170
[ 0.108207] [<c1251622>] ? ret_from_kernel_thread+0x6/0x28
[ 0.108207] [<c1251637>] ? ret_from_kernel_thread+0x1b/0x28
[ 0.108207] [<c124b050>] ? rest_init+0x60/0x60
[ 0.108207] Code: d6 ab aa aa aa ff d1 5b 5e 5f c3 8d b4 26 00 00 00 00 8d bc 27 00 00 00 00 57 89 d7 56 53 e8 46 f4 ff ff 85 c0 89 c3 74 5d 8b 30 <f6> 46 4c 01 74 10 ba 8a 07 00 00 b8 5c da 2c c1 e8 b9 bb ec ff
[ 0.108207] EIP: [<c115acc2>] __gpio_set_value+0x12/0x80 SS:ESP 0068:cf841f24
[ 0.108207] CR2: 000000000000004c
[ 0.108207] ---[ end trace 7b3836317c1bee78 ]---
[ 0.108879] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
[ 0.108879]

I think you have put this in kernel source directory. You should place this in drivers/gpio/ in kernel source. Then add the entries in Kconfig and Makefile of drivers/gpio/ directory. In Kconfig, you can specify the dependency. Selecting it with make menuconfig, you will be able to compile this module as a part of kernel, and it will be loaded at boot-time when kernel is loaded. You can decrease the time further in this case using early_initcall() instead of module_init().
If you are not putting this at kernel source (i.e. not building the driver as part of kernel), then you should call this using "insmod my_module.ko" in a shell script, and put it in init.d and call it at your desired runlevel.

Related

On rhel8 os When I run a program the kernel crash, how can I determine which line of code reports the error ?

I don't know about kernel, I don't know how to troubleshoot.
When the problem happened, my system kernel crashed, the following is the vmcore-dmesg.txt log
##dmesg logs
[ 378.442884] SPDMD-LUN:[ERROR]lun_del:2218 device nvfile-mgmtd-0 is busy :2
[ 424.511211] XFS (nvfile-storage-0): Mounting V5 Filesystem
[ 424.513045] XFS (nvfile-storage-2): Mounting V5 Filesystem
[ 424.538953] XFS (nvfile-storage-2): Starting recovery (logdev: internal)
[ 424.546536] XFS (nvfile-storage-2): Ending recovery (logdev: internal)
[ 425.512217] XFS (nvfile-storage-0): Starting recovery (logdev: internal)
[ 425.518929] XFS (nvfile-storage-1): Mounting V5 Filesystem
[ 425.520813] XFS (nvfile-storage-3): Mounting V5 Filesystem
[ 426.288987] XFS (nvfile-storage-3): Starting recovery (logdev: internal)
[ 426.475465] XFS (nvfile-storage-1): Starting recovery (logdev: internal)
[ 427.496551] XFS (nvfile-storage-0): Ending recovery (logdev: internal)
[ 428.320932] XFS (nvfile-storage-3): Ending recovery (logdev: internal)
[ 428.977479] XFS (nvfile-storage-1): Ending recovery (logdev: internal)
[ 445.927118] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
[ 445.927685] PGD 0 P4D 0
[ 445.928216] Oops: 0000 [#1] SMP NOPTI
[ 445.928723] CPU: 4 PID: 591 Comm: kworker/u193:1 Kdump: loaded Tainted: G OE --------- - - 4.18.0-305.el8.x86_64 #1
[ 445.929735] Hardware name: Lenovo ThinkSystem SR860 V2/7Z60CTO1WW, BIOS M5E118K-1.52 08/06/2021
[ 445.930305] Workqueue: xfs-cil/nvfile-storage- xlog_cil_push_work [xfs]
[ 445.930910] RIP: 0010:blk_queue_split+0x1c6/0x660
[ 445.933048] Code: c0 45 31 f6 89 44 24 44 89 7c 24 40 31 ff 85 db 0f 84 56 04 00 00 8b 44 24 44 48 89 c1 48 89 44 24 30 48 c1 e1 04 49 03 4d 78 <8b> 41 08 8b 71 0c 48 8b 11 44 29 f8 39 d8 48 89 54 24 48 0f 47 c3
[ 445.936323] RSP: 0018:ffffbcbf9a4bfaf8 EFLAGS: 00010246
[ 445.936711] RAX: 0000000000000000 RBX: 0000000000003000 RCX: 0000000000000000
[ 445.937028] RDX: 0000000000000018 RSI: 0000000000000018 RDI: 0000000000000000
[ 445.937343] RBP: ffffbcbf9a4bfb90 R08: 0000000000000000 R09: ffff940c1965d700
[ 445.937659] R10: 0000000000000000 R11: 0000000000000000 R12: ffff94ca6f590000
[ 445.937979] R13: ffff940bda0ddc80 R14: 0000000000000000 R15: 0000000000000000
[ 445.938304] FS: 0000000000000000(0000) GS:ffff940effd00000(0000) knlGS:0000000000000000

How to load image in sama5d27-som1-ek kit using SDcard

I am following standard process to boot sama5d27-som1-ek kit using SDcard but i got following error
i cannot understand why it shows cannot open root device.i used 8GB sd for this process
VFS: Cannot open root device "mmcblk0p2" or unknown-block(179,2): error -30
Please append a correct "root=" boot option; here are the available partitions:
0100 8192 ram0
(driver?)
0101 8192 ram1
(driver?)
0102 8192 ram2
(driver?)
0103 8192 ram3
(driver?)
1f00 64 mtdblock0
(driver?)
1f01 640 mtdblock1
(driver?)
1f02 64 mtdblock2
(driver?)
1f03 128 mtdblock3
(driver?)
1f04 4096 mtdblock4
(driver?)
b300 7864320 mmcblk0
driver: mmcblk
b301 65536 mmcblk0p1 da6e5492-01
b302 914432 mmcblk0p2 da6e5492-02
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)
CPU: 0 PID: 1 Comm: swapper Not tainted 4.19.78-linux4sam-6.2 #1
Hardware name: Atmel SAMA5
Function entered at [<c010dcd8>] from [<c010ae5c>]
Function entered at [<c010ae5c>] from [<c0117f48>]
Function entered at [<c0117f48>] from [<c0a01270>]
Function entered at [<c0a01270>] from [<c0a01590>]
Function entered at [<c0a01590>] from [<c0a01730>]
Function entered at [<c0a01730>] from [<c0a00e1c>]
Function entered at [<c0a00e1c>] from [<c0729e00>]
Function entered at [<c0729e00>] from [<c01010e8>]
Exception stack(0xc642dfb0 to 0xc642dff8)
dfa0: 00000000 00000000 00000000 00000000
dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2) ]---
random: fast init done
random: crng init done
please help to know error.because i am following standard process.
The kernel can not mount the rootfs. (can not find init)
Can you please show the kernel command line?
What file system do you use?
It looks like you have 2 partitions.

Error in booting from uSD-card - No filesystem could mount root, tried:Ext4

I am trying to build an embedded Linux to be run on PocketBeagle using Buildroot; and following the instructions in (source1). The resulting images are copied then to the uSD-card.
When inserting the uSD-card in the Pocketbeagle and monitor the booting process via a serial connection; I got the following error:
No filesystem could mount root, tried:
ext4
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1).
The used resources are:
Buildroot: 2018.02
File system: ext4
Bootloader: U-Boot (custom version 2018.01)
Kernel version: 4.14.24
Applying all the patches stated in source above and can be found in (source2):
- 0001-Stripped-back-pocketbeagle-devicetree.patch
- 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
- 0002-U-Boot-BeagleBone-Cape-Manager.patch
- 0003-pocketbeagle-tweaks.patch
Runing the build results in the following files and images:
MLO: First stage bootloader
U-boot.img: Second stage bootloader
uEnv.txt: U-boot environmnt
zImage: Linux kernel image
am335x-pocketbeagle.dtb: Linux kernel Device Tree Blob
rootfs.ext4: Root filesystem image
The uEnv.txt is as follows:
fdtfile=am335x-pocketbeagle.dtb
bootpart=0:1
bootdir=
bootargs=console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait
uenvcmd=run loadimage;run loadfdt;printenv bootargs;bootz ${loadaddr} - ${fdtaddr};
Then by using genimage in buildroot (and rebuilding) to generate the uSd-image that contains two partitions:
1. FAT partition containing the bootloader images, the kernel image and Device Tree
2. Rootfs partition containing the root filesystem ext4
The resulting image is called sdcard.img is copies to the uSD-card by using program etcher (etcher-electron-1.4.3-x86_64.AppImage) or by (sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 bs=1M)
I have used two different uSD-cards to test the build, but the result was the same:
1. Kingstone 32 GB (SDHC 10)
2. Sandisk 16GB (SDHC 10)
It's worth to say that I have used the same uSD-cards to load the original image of the PocketBeagle from the official site and boot from them, the cards boots without problem.
Any idea to help is highly appreciated.
ADDENDUM
Another error that is shown in the log file occurs in the beginning of the boot:
U-Boot SPL 2018.01 (Mar 24 2018 - 21:13:25)
Trying to boot from MMC1
*** Warning - bad CRC, using default environment
reading u-boot.img
reading u-boot.img
U-Boot 2018.01 (Mar 24 2018 - 21:13:25 +0100)
CPU : AM335X-GP rev 2.1 I2C: ready DRAM: 512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
Reset Source: Power-on reset has occurred.
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning - bad CRC, using default environment
The full log is as follows:
U-Boot SPL 2018.01 (Mar 24 2018 - 21:13:25)
Trying to boot from MMC1
*** Warning - bad CRC, using default environment
reading u-boot.img
reading u-boot.img
U-Boot 2018.01 (Mar 24 2018 - 21:13:25 +0100)
CPU : AM335X-GP rev 2.1
I2C: ready
DRAM: 512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
Reset Source: Power-on reset has occurred.
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning - bad CRC, using default environment
Model: BeagleBoard.org PocketBeagle
<ethaddr> not set. Validating first E-fuse MAC
Net: No ethernet found.
Press SPACE to abort autoboot in 2 seconds
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
gpio: pin 53 (gpio 53) value is 1
switch to partitions #0, OK
mmc0 is current device
gpio: pin 54 (gpio 54) value is 1
Checking for: /uEnv.txt ...
reading uEnv.txt
218 bytes read in 4 ms (52.7 KiB/s)
gpio: pin 55 (gpio 55) value is 1
Loaded environment from /uEnv.txt
Importing environment from mmc ...
Checking if uenvcmd is set ...
gpio: pin 56 (gpio 56) value is 1
Running uenvcmd ...
reading /zImage
5540120 bytes read in 351 ms (15.1 MiB/s)
loading /am335x-pocketbeagle.dtb ...
reading /am335x-pocketbeagle.dtb
33516 bytes read in 9 ms (3.6 MiB/s)
bootargs=console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Loading Device Tree to 8fff4000, end 8ffff2eb ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.14.24 (ammar#ammar-System-Product-Name) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #1 SMP Sat Mar 24 21:23:50 CET 2018
[ 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: TI AM335x PocketBeagle
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] cma: Reserved 16 MiB at 0x9e800000
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] AM335X ES2.1 (sgx neon)
[ 0.000000] random: fast init done
[ 0.000000] percpu: Embedded 17 pages/cpu #df93f000 s40872 r8192 d20568 u69632
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 129412
[ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait
[ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Memory: 479900K/522240K available (8192K kernel code, 810K rwdata, 2412K rodata, 1024K init, 7547K bss, 25956K reserved, 16384K 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 : 0xe0000000 - 0xff800000 ( 504 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xdfe00000 ( 510 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0xc0008000 - 0xc0900000 (9184 kB)
[ 0.000000] .init : 0xc0c00000 - 0xc0d00000 (1024 kB)
[ 0.000000] .data : 0xc0d00000 - 0xc0dca9b8 ( 811 kB)
[ 0.000000] .bss : 0xc0dcc000 - 0xc152af94 (7548 kB)
[ 0.000000] Running RCU self tests
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU event tracing is enabled.
[ 0.000000] RCU lockdep checking is enabled.
[ 0.000000] RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 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.000017] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000044] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000097] OMAP clocksource: timer1 at 24000000 Hz
[ 0.000569] timer_probe: no matching timers found
[ 0.001470] Console: colour dummy device 80x30
[ 0.001516] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[ 0.001530] ... MAX_LOCKDEP_SUBCLASSES: 8
[ 0.001542] ... MAX_LOCK_DEPTH: 48
[ 0.001554] ... MAX_LOCKDEP_KEYS: 8191
[ 0.001566] ... CLASSHASH_SIZE: 4096
[ 0.001578] ... MAX_LOCKDEP_ENTRIES: 32768
[ 0.001589] ... MAX_LOCKDEP_CHAINS: 65536
[ 0.001601] ... CHAINHASH_SIZE: 32768
[ 0.001613] memory used by lock dependency info: 4655 kB
[ 0.001626] per task-struct memory footprint: 1536 bytes
[ 0.001663] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
[ 0.078740] pid_max: default: 32768 minimum: 301
[ 0.079147] Security Framework initialized
[ 0.079285] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.079306] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.082392] CPU: Testing write buffer coherency: ok
[ 0.083889] CPU0: thread -1, cpu 0, socket -1, mpidr 0
[ 0.085406] Setting up static identity map for 0x80100000 - 0x80100078
[ 0.085975] Hierarchical SRCU implementation.
[ 0.087625] smp: Bringing up secondary CPUs ...
[ 0.087648] smp: Brought up 1 node, 1 CPU
[ 0.087665] SMP: Total of 1 processors activated (996.14 BogoMIPS).
[ 0.087679] CPU: All CPU(s) started in SVC mode.
[ 0.091643] devtmpfs: initialized
[ 0.116033] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[ 0.116853] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.116916] futex hash table entries: 256 (order: 2, 16384 bytes)
[ 0.118550] pinctrl core: initialized pinctrl subsystem
[ 0.123225] NET: Registered protocol family 16
[ 0.130326] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.171692] omap_hwmod: debugss: _wait_target_disable failed
[ 0.226390] cpuidle: using governor menu
[ 0.237629] OMAP GPIO hardware version 0.1
[ 0.262333] No ATAGs?
[ 0.262360] hw-breakpoint: debug architecture 0x4 unsupported.
[ 0.262655] omap4_sram_init:Unable to allocate sram needed to handle errata I688
[ 0.262675] omap4_sram_init:Unable to get sram pool needed to handle errata I688
[ 0.298256] edma 49000000.edma: TI EDMA DMA engine driver
[ 0.303666] SCSI subsystem initialized
[ 0.305374] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup#44c00000/scm#210000/pinmux#800/pinmux_i2c0_pins, deferring probe
[ 0.307447] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 400 kHz
[ 0.307764] omap_i2c 4819c000.i2c: could not find pctldev for node /ocp/l4_wkup#44c00000/scm#210000/pinmux#800/mma8452_pins_default, deferring probe
[ 0.308058] pps_core: LinuxPPS API ver. 1 registered
[ 0.308076] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti#linux.it>
[ 0.308128] PTP clock support registered
[ 0.312478] clocksource: Switched to clocksource timer1
[ 0.448001] VFS: Disk quotas dquot_6.6.0
[ 0.448193] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 0.473020] NET: Registered protocol family 2
[ 0.474843] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.474948] TCP bind hash table entries: 4096 (order: 5, 147456 bytes)
[ 0.476120] TCP: Hash tables configured (established 4096 bind 4096)
[ 0.476506] UDP hash table entries: 256 (order: 2, 20480 bytes)
[ 0.476689] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
[ 0.477446] NET: Registered protocol family 1
[ 0.479566] RPC: Registered named UNIX socket transport module.
[ 0.479614] RPC: Registered udp transport module.
[ 0.479629] RPC: Registered tcp transport module.
[ 0.479643] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.482107] hw perfevents: no interrupt-affinity property for /pmu, guessing.
[ 0.483357] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
[ 0.487455] audit: initializing netlink subsys (disabled)
[ 0.490304] audit: type=2000 audit(0.480:1): state=initialized audit_enabled=0 res=1
[ 0.490640] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[ 0.493682] NFS: Registering the id_resolver key type
[ 0.494058] Key type id_resolver registered
[ 0.494099] Key type id_legacy registered
[ 0.494253] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
[ 0.500669] io scheduler noop registered
[ 0.500700] io scheduler deadline registered
[ 0.500822] io scheduler cfq registered (default)
[ 0.500841] io scheduler mq-deadline registered
[ 0.500856] io scheduler kyber registered
[ 0.503256] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
[ 0.510527] Serial: 8250/16550 driver, 6 ports, IRQ sharing enabled
[ 0.516492] omap_uart 44e09000.serial: no wakeirq for uart0
[ 0.516942] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 30, base_baud = 3000000) is a OMAP UART0
[ 1.250345] console [ttyO0] enabled
[ 1.255586] omap_uart 48022000.serial: no wakeirq for uart1
[ 1.261829] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 31, base_baud = 3000000) is a OMAP UART1
[ 1.272744] omap_uart 48024000.serial: no wakeirq for uart2
[ 1.278844] 48024000.serial: ttyO2 at MMIO 0x48024000 (irq = 32, base_baud = 3000000) is a OMAP UART2
[ 1.289570] omap_uart 481a8000.serial: no wakeirq for uart4
[ 1.295781] 481a8000.serial: ttyO4 at MMIO 0x481a8000 (irq = 33, base_baud = 3000000) is a OMAP UART4
[ 1.334046] brd: module loaded
[ 1.362138] loop: module loaded
[ 1.368162] mtdoops: mtd device (mtddev=name/number) must be supplied
[ 1.383297] libphy: Fixed MDIO Bus: probed
[ 1.390588] i2c /dev entries driver
[ 1.398755] omap_hsmmc 48060000.mmc: Got CD GPIO
[ 1.465093] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.472542] oprofile: using arm/armv7
[ 1.477095] Initializing XFRM netlink socket
[ 1.481985] NET: Registered protocol family 10
[ 1.493215] Segment Routing with IPv6
[ 1.497190] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 1.505262] NET: Registered protocol family 17
[ 1.509973] NET: Registered protocol family 15
[ 1.515090] Key type dns_resolver registered
[ 1.519724] omap_voltage_late_init: Voltage driver support not added
[ 1.526481] sr_dev_init: No voltage domain specified for smartreflex0. Cannot initialize
[ 1.535007] sr_dev_init: No voltage domain specified for smartreflex1. Cannot initialize
[ 1.543566] ThumbEE CPU extension supported.
[ 1.548049] Registering SWP/SWPB emulation handler
[ 1.553116] SmartReflex Class3 initialized
[ 1.623490] mmc0: host does not support reading read-only switch, assuming write-enable
[ 1.635560] mmc0: new high speed SDHC card at address 0007
[ 1.644119] mmcblk0: mmc0:0007 SD32G 28.8 GiB
[ 1.655081] mmcblk0: p1 p2
[ 1.671199] tps65217 0-0024: TPS65217 ID 0xe version 1.2
[ 1.677649] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[ 1.686633] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 400 kHz
[ 1.694194] hctosys: unable to open rtc device (rtc0)
[ 1.699490] sr_init: No PMIC hook to init smartreflex
[ 1.705144] sr_init: platform driver register failed for SR
[ 1.720670] List of all partitions:
[ 1.724586] 0100 16384 ram0
[ 1.724597] (driver?)
[ 1.730999] 0101 16384 ram1
[ 1.731008] (driver?)
[ 1.737842] 0102 16384 ram2
[ 1.737854] (driver?)
[ 1.744389] 0103 16384 ram3
[ 1.744400] (driver?)
[ 1.750791] 0104 16384 ram4
[ 1.750800] (driver?)
[ 1.757269] 0105 16384 ram5
[ 1.757278] (driver?)
[ 1.763737] 0106 16384 ram6
[ 1.763746] (driver?)
[ 1.770139] 0107 16384 ram7
[ 1.770148] (driver?)
[ 1.776597] 0108 16384 ram8
[ 1.776607] (driver?)
[ 1.783061] 0109 16384 ram9
[ 1.783071] (driver?)
[ 1.789456] 010a 16384 ram10
[ 1.789465] (driver?)
[ 1.795999] 010b 16384 ram11
[ 1.796008] (driver?)
[ 1.802540] 010c 16384 ram12
[ 1.802549] (driver?)
[ 1.809029] 010d 16384 ram13
[ 1.809038] (driver?)
[ 1.815571] 010e 16384 ram14
[ 1.815580] (driver?)
[ 1.822056] 010f 16384 ram15
[ 1.822065] (driver?)
[ 1.828679] b300 30228480 mmcblk0
[ 1.828690] driver: mmcblk
[ 1.835867] b301 16384 mmcblk0p1 00000000-01
[ 1.835877]
[ 1.843044] b302 524288 mmcblk0p2 00000000-02
[ 1.843053]
[ 1.850164] No filesystem could mount root, tried:
[ 1.850173] ext4
[ 1.855340]
[ 1.858913] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)
[ 1.867873] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)
The failure to mount the rootfs is occurring because the correct partition of the SDcard has not been specified.
In the kernel command line, the kernel is (incorrectly) instructed to find the rootfs in the partition corresponding to /dev/mmcblk0p1.
bootargs=console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait
and
[ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait
However the mmc subsystem reports that there are two partitions on your SDcard, and the boot log reports the device names of these partitions for you twice.
First:
[ 1.635560] mmc0: new high speed SDHC card at address 0007
[ 1.644119] mmcblk0: mmc0:0007 SD32G 28.8 GiB
[ 1.655081] mmcblk0: p1 p2
And then:
[ 1.720670] List of all partitions:
...
[ 1.828679] b300 30228480 mmcblk0
[ 1.828690] driver: mmcblk
[ 1.835867] b301 16384 mmcblk0p1 00000000-01
[ 1.835877]
[ 1.843044] b302 524288 mmcblk0p2 00000000-02
So the kernel command line (through bootargs) should specify the second partition, /dev/mmcblk0p2, rather than the first partition for the rootfs.
Since the storage area for your U-Boot environment has not been properly initialized (i.e. the "Warning - bad CRC, using default environment" messages) (or your uEnv.txt file is missing or corrupt), U-Boot is booting the Linux kernel with a hardcoded bootargs value that is defined in your board's configuration file.
You could either edit that file and re-build U-Boot, or abort the autoboot and use
setenv bootargs console=ttyO0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait and saveenv commands to correct this mis-specification.

Booting Debian Wheezy on a BeagleCore ? (Kernel panic - not syncing: Attempted to kill init!)

I'm trying to boot a Debian Wheezy Image, Ker 3.8 on my BeagleCore (a smaller version of BeagleBone) with TI AM335x Cortex-A8 processor.
I took the Debian Image from beagleboard site.
When I try to boot, on a serial interface for debug, I get this messages:
U-Boot SPL 2016.01-00001-g4eb802e (Jan 13 2016 - 11:14:31)
Trying to boot from MMC
bad magic
U-Boot 2016.01-00001-g4eb802e (Jan 13 2016 - 11:14:31 -0600), Build: jenkins-github_Bootloader-Builder-313
Watchdog enabled
I2C: ready
DRAM: 512 MiB
Reset Source: Power-on reset has occurred.
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Using default environment
Net: <ethaddr> not set. Validating first E-fuse MAC
Could not get PHY for cpsw: addr 0
cpsw, usb_ether
Press SPACE to abort autoboot in 2 seconds
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
gpio: pin 53 (gpio 53) value is 1
switch to partitions #0, OK
mmc0 is current device
gpio: pin 54 (gpio 54) value is 1
Checking for: /uEnv.txt ...
Checking for: /boot.scr ...
Checking for: /boot/boot.scr ...
Checking for: /boot/uEnv.txt ...
gpio: pin 55 (gpio 55) value is 1
2181 bytes read in 16 ms (132.8 KiB/s)
Loaded environment from /boot/uEnv.txt
Checking if uname_r is set in /boot/uEnv.txt...
gpio: pin 56 (gpio 56) value is 1
Running uname_boot ...
loading /boot/vmlinuz-3.8.13-bone79 ...
5644336 bytes read in 333 ms (16.2 MiB/s)
loading /boot/dtbs/3.8.13-bone79/am335x-boneblack.dtb ...
26118 bytes read in 24 ms (1 MiB/s)
loading /boot/initrd.img-3.8.13-bone79 ...
2905600 bytes read in 179 ms (15.5 MiB/s)
debug: [console=ttyO0,115200n8 capemgr.enable_partno=BB-UART1,BB-UART2,BB-UART4,BB-UART5 capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN root=UUID=4d8c9d4c-a16d-47ac-a32c-43d0155df072 ro rootfstype=ext4 rootwait coherent_pool=1M quiet init=/lib/systemd/systemd cape_universal=enable] ...
debug: [bootz 0x82000000 0x88080000:2c5600 0x88000000] ...
Kernel image # 0x82000000 [ 0x000000 - 0x562030 ]
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Loading Ramdisk to 8fd3a000, end 8ffff600 ... OK
Loading Device Tree to 8fd30000, end 8fd39605 ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
[ 0.384810] omap2_mbox_probe: platform not supported
[ 0.540541] tps65217-bl tps65217-bl: no platform data provided
[ 0.604330] bone-capemgr bone_capemgr.9: slot #0: No cape found
[ 0.641437] bone-capemgr bone_capemgr.9: slot #1: No cape found
[ 0.678546] bone-capemgr bone_capemgr.9: slot #2: No cape found
[ 0.715656] bone-capemgr bone_capemgr.9: slot #3: No cape found
[ 0.741854] omap_hsmmc mmc.5: of_parse_phandle_with_args of 'reset' failed
[ 0.803809] pinctrl-single 44e10800.pinmux: pin 44e10854 already requested by 44e10800.pinmux; cannot claim for gpio-leds.8
[ 0.815463] pinctrl-single 44e10800.pinmux: pin-21 (gpio-leds.8) status -22
[ 0.822748] pinctrl-single 44e10800.pinmux: could not request pin 21 on device pinctrl-single
[ 0.893233] Unhandled fault: external abort on non-linefetch (0x1008) at 0xe0858c20
[ 0.901225] Internal error: : 1008 [#1] SMP THUMB2
[ 0.906217] Modules linked in:
[ 0.909405] CPU: 0 Not tainted (3.8.13-bone79 #1)
[ 0.914691] PC is at cpts_fifo_read.constprop.1+0x18/0xc4
[ 0.920317] LR is at cpts_systim_read+0x11/0x7c
[ 0.925040] pc : [<c0326468>] lr : [<c0326761>] psr: 000001b3
[ 0.925040] sp : df071db8 ip : 00000000 fp : de231664
[ 0.936993] r10: de231000 r9 : de231758 r8 : c084e0c0
[ 0.942440] r7 : 00000001 r6 : ffffffff r5 : 00000010 r4 : de231670
[ 0.949241] r3 : e0858c00 r2 : 00000001 r1 : de2316d0 r0 : de231670
[ 0.956039] Flags: nzcv IRQs off FIQs on Mode SVC_32 ISA Thumb Segment kernel
[ 0.963925] Control: 50c5387d Table: 80004019 DAC: 00000015
[ 0.969907] Process swapper/0 (pid: 1, stack limit = 0xdf070240)
[ 0.976163] Stack: (0xdf071db8 to 0xdf072000)
[ 0.980699] 1da0: e0858c00 de2316d0
[ 0.989219] 1dc0: de2316bc 35318bf5 00000000 0000001d c052e7a8 c0326761 de2316e8 de2316bc
[ 0.997740] 1de0: 35318bf5 c00611f1 de231670 20000113 de2316e8 c0326927 35318bf5 00000000
[ 1.006259] 1e00: 00000000 00000004 df0d5410 de231000 df0d5400 c0325bab df0d8ac0 de231540
[ 1.014775] 1e20: c0893bb8 0000002b de231540 df0d5400 df0d5410 00000005 00000000 df0d5410
[ 1.023298] 1e40: e0858800 e0858a00 e0858a20 e0858a40 e0858a60 e08588c0 e08588e0 00000008
[ 1.031813] 1e60: 00000001 0000003c 4a102000 4a102000 00002000 00000010 00000001 de231298
[ 1.040338] 1e80: e0858d00 0000000a 00000400 00000002 00000020 00000008 df0d5410 c094362c
[ 1.048868] 1ea0: df0d5410 c08b2c40 00000000 c0829039 00000102 c0846d70 00000000 c02c82b1
[ 1.057381] 1ec0: c02c82a1 c02c7753 00000000 df0d5410 c08b2c40 df0d5444 00000000 c02c78b3
[ 1.065896] 1ee0: c08b2c40 c02c7869 00000000 c02c6887 df049478 df0c6180 c08b2c40 c08a8090
[ 1.074421] 1f00: de23d140 c02c7247 c0753554 c08b2c40 c08b2c40 df070000 c08d4180 00000000
[ 1.082937] 1f20: c0829039 c02c7bb5 00000000 c0833968 df070000 c08d4180 00000000 c0829039
[ 1.091461] 1f40: 00000102 c000867f 00000007 00000007 c088bc98 c0833964 c0833968 00000007
[ 1.099978] 1f60: c0833948 c08d4180 c080d1c9 c0846d70 00000000 c080d6a3 00000007 00000007
[ 1.108503] 1f80: c080d1c9 c0d60fc0 00000000 c04ccfb1 00000000 00000000 00000000 00000000
[ 1.117013] 1fa0: 00000000 c04ccfb7 00000000 c000c8fd 00000000 00000000 00000000 00000000
[ 1.125537] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1.134055] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[ 1.142587] [<c0326468>] (cpts_fifo_read.constprop.1+0x18/0xc4) from [<c0326761>] (cpts_systim_read+0x11/0x7c)
[ 1.153018] [<c0326761>] (cpts_systim_read+0x11/0x7c) from [<c00611f1>] (timecounter_init+0x11/0x1c)
[ 1.162545] [<c00611f1>] (timecounter_init+0x11/0x1c) from [<c0326927>] (cpts_register+0xf3/0x1b8)
[ 1.171894] [<c0326927>] (cpts_register+0xf3/0x1b8) from [<c0325bab>] (cpsw_probe+0x823/0x960)
[ 1.180877] [<c0325bab>] (cpsw_probe+0x823/0x960) from [<c02c82b1>] (platform_drv_probe+0x11/0x14)
[ 1.190222] [<c02c82b1>] (platform_drv_probe+0x11/0x14) from [<c02c7753>] (driver_probe_device+0x53/0x168)
[ 1.200282] [<c02c7753>] (driver_probe_device+0x53/0x168) from [<c02c78b3>] (__driver_attach+0x4b/0x4c)
[ 1.210093] [<c02c78b3>] (__driver_attach+0x4b/0x4c) from [<c02c6887>] (bus_for_each_dev+0x27/0x48)
[ 1.219521] [<c02c6887>] (bus_for_each_dev+0x27/0x48) from [<c02c7247>] (bus_add_driver+0xe3/0x168)
[ 1.228949] [<c02c7247>] (bus_add_driver+0xe3/0x168) from [<c02c7bb5>] (driver_register+0x3d/0xc4)
[ 1.238289] [<c02c7bb5>] (driver_register+0x3d/0xc4) from [<c000867f>] (do_one_initcall+0x1f/0xf4)
[ 1.247630] [<c000867f>] (do_one_initcall+0x1f/0xf4) from [<c080d6a3>] (kernel_init_freeable+0xc3/0x158)
[ 1.257516] [<c080d6a3>] (kernel_init_freeable+0xc3/0x158) from [<c04ccfb7>] (kernel_init+0x7/0x98)
[ 1.266951] [<c04ccfb7>] (kernel_init+0x7/0x98) from [<c000c8fd>] (ret_from_fork+0x11/0x34)
[ 1.275659] Code: 2701 f100 09e8 6823 (6a1a) 07d3
[ 1.280655] ---[ end trace b2036333b4d03ad2 ]---
[ 1.285687] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
With a Debian Jessie image, Ker 4.4, board is booting normally.
Any idea how to solve this, is kindly appreciated.
Thank you.
As per my knowledge there was some issue with CTPS driver in kernel V3.13 (forget the exact kernel version). So it was an open issue. May be with newer kernel version they have fixed it. If you have the source code then try by disabling the CTPS driver CONFIG_TI_CPTS=n.

What do these Linux Kernel Oops fields mean?

I have already encountered some Oops in my developer's life and whereas I am familiar with some information that I can retrieve from these Oops, there are still pieces of information I can't understand and therefore, can't use to solve problems.
Below you will find an Oops example and I will describe what I can deduce from it. Then, I will ask what the remaining info can teach me about the problem.
[ 716.485951] BUG: unable to handle kernel paging request at fc132158
[ 716.485973] IP: [<fc1936e7>] ubi_change_vtbl_record+0x87/0x1c0 [ubi]
[ 716.485986] *pdpt = 00000000019e6001 *pde = 000000002c558067 *pte = 0000000000000000
[ 716.485997] Oops: 0002 [#1] SMP
[ 716.486004] Modules linked in: ubi(O) mtdchar nandsim nand mtd nand_ids nand_bch bch nand_ecc bnep rfcomm bluetooth parport_pc ppdev lp parport nfsd nfs_acl auth_rpcgss nfs fscache lockd sunrpc binfmt_misc dm_crypt snd_hda_codec_hdmi snd_hda_codec_analog kvm_intel snd_hda_intel snd_hda_codec snd_hwdep kvm snd_pcm snd_seq_midi snd_rawmidi snd_seq_midi_event hid_generic snd_seq cdc_acm snd_timer snd_seq_device mei tpm_tis snd mac_hid serio_raw soundcore lpc_ich snd_page_alloc microcode coretemp usbhid hid nouveau usb_storage ttm drm_kms_helper drm floppy e1000e i2c_algo_bit mxm_wmi video wmi
[ 716.486128] Pid: 3994, comm: ubimkvol Tainted: G O 3.8.0-rc3+ #3 LENOVO 6239AS8/LENOVO
[ 716.486136] EIP: 0060:[<fc1936e7>] EFLAGS: 00010246 CPU: 0
[ 716.486144] EIP is at ubi_change_vtbl_record+0x87/0x1c0 [ubi]
[ 716.486151] EAX: 000000ac EBX: eb5ea000 ECX: 0000002b EDX: 00000000
[ 716.486157] ESI: eb4d1d74 EDI: fc132158 EBP: eb4d1d40 ESP: eb4d1d20
[ 716.486164] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
[ 716.486170] CR0: 8005003b CR2: fc132158 CR3: 27542000 CR4: 000407f0
[ 716.486176] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[ 716.486183] DR6: ffff0ff0 DR7: 00000400
[ 716.486188] Process ubimkvol (pid: 3994, ti=eb4d0000 task=ec01d9b0 task.ti=eb4d0000)
[ 716.486195] Stack:
[ 716.486199] e755f000 eb4d1d2c c11cad11 eb4d1d34 eb543c00 eb5ea000 00000000 eb4d1e20
[ 716.486215] eb4d1e30 fc195412 e755f000 fc1adf01 eb5ea26c 00000002 0000009e eb5ea480
[ 716.486232] 00000002 e755f22c e755f2ac e755f000 eb4d1d74 2a000000 01000000 00000000
[ 716.486248] Call Trace:
[ 716.486257] [<c11cad11>] ? sysfs_create_file+0x21/0x30
[ 716.486266] [<fc195412>] ubi_create_volume+0x4b2/0x790 [ubi]
[ 716.486277] [<fc19967a>] ubi_cdev_ioctl+0x5da/0xac0 [ubi]
[ 716.486285] [<c117202a>] ? link_path_walk+0x5a/0x7d0
[ 716.486294] [<fc1990a0>] ? vol_cdev_ioctl+0x440/0x440 [ubi]
[ 716.486842] [<c1177e12>] do_vfs_ioctl+0x82/0x5b0
[ 716.487703] [<c1171ced>] ? final_putname+0x1d/0x40
[ 716.488564] [<c1171ced>] ? final_putname+0x1d/0x40
[ 716.489422] [<c1171ced>] ? final_putname+0x1d/0x40
[ 716.489891] [<c1171eb4>] ? putname+0x24/0x40
[ 716.489891] [<c1167239>] ? do_sys_open+0x169/0x1d0
[ 716.489891] [<c11783b0>] sys_ioctl+0x70/0x80
[ 716.489891] [<c16205cd>] sysenter_do_call+0x12/0x38
[ 716.489891] Code: ac 00 00 00 03 bb c8 04 00 00 f7 c7 01 00 00 00 0f 85 ee 00 00 00 f7 c7 02 00 00 00 0f 85 ca 00 00 00 89 c1 31 d2 c1 e9 02 a8 02 <f3> a5 74 0b 0f b7 16 66 89 17 ba 02 00 00 00 a8 01 74 07 0f b6
[ 716.489891] EIP: [<fc1936e7>] ubi_change_vtbl_record+0x87/0x1c0 [ubi] SS:ESP 0068:eb4d1d20
[ 716.489891] CR2: 00000000fc132158
[ 716.516453] ---[ end trace 473b15a7780e19ea ]---
It seems that the kernel wanted to access a wrong page. Now,
The Oops code 0002 tells me that it occurred while trying to read something in user-mode.
The Instruction Pointer is at ubi_change_vtbl_record, which means the offending instruction is located in this function.
I can deduce the path that lead to the faulting function from the
call trace (an ioctl launched from process ubimkvol)
From there, Is the "stack" a dump of the raw stack of the task ? I can see that some values mentioned are also function addresses found in the call trace. Then, I got fancy looking values like EAX, EBX ... DR7. I think they are CPU registers but still, I don't know what they really are.
Finally, the following line gets me lost :
[ 716.485986] *pdpt = 00000000019e6001 *pde = 000000002c558067 *pte = 0000000000000000
What are pdpt, pde and pte ? I feel they are information about the page fault but I could not retrieve further information after some googling around.
Yes, EAX, etc. are 32-bit x86 processor registers. pdpt (page directory pointer table), pde (page directory entry), and pte (page table entry) are all paging structures.
IP (also EIP for 32-bit or RIP for 64-bit processors) is the instruction pointer at the time of the Oops.
The stack is the raw stack for this processor. Each processor will have its own stack. Note that on this architecture the stack grows down (addresses start with 0xfxxxxxx).
Correct me if I am wrong but,
OOPS 0002 means no page found when writing in kernel mode:
bit 0 == 0 means no page found, 1 means a protection fault
bit 1 == 0 means read, 1 means write
bit 2 == 0 means kernel, 1 means user-mode

Resources