joelguittet/meta-chip

CHIP does not reboot after flashing it

Closed this issue · 13 comments

Configuration

Ubuntu 16.04
C.H.I.P Toshiba 4GB MLC

Issue

I successfully compiled the image, and flashed it. The C.H.I.P boots once (directly after flashing it), as expected.
Once I remove the FEL jumper, and reboot the C.H.I.P, nothing happens anymore.

I tried to reboot it by unplugging the power cable, by pressing the button and with the reboot command. Same result, not booting anymore.

I also tried to use Rocko Poky, adapted u-boot-chip and kernel accordingly to be able to compile. Again, the C.H.I.P boots after flashing it, but nothing happens after reapplying power.

It looks like the C.H.I.P is stuck in FEL mode as I can reflash it without the jumper (it appears as /dev/usb-chip)

Faulty C.H.I.Ps ?

I don't think my C.H.I.Ps are faulty because :

  • I used chip-update-firmware.sh to restore the server image. The C.H.I.P starts working as expected again, and reboots well.
  • I tried to modify your flashing script to use "nand scrub.chip" in place of "nand erase.chip". Did not help.
  • I tried on both of my C.H.I.Ps, same result.

Did you face this problem ? Do you have any idea that could help me ?

Nevertheless, thank you for your amazing work, I'm pretty sure that this issue is to that critical and can be easily resolved, but I must admit that I am quite new to C.H.I.P and Yocto development. I'm a bit left without any other idea right now...

UART Log:

U-Boot 2016.01 (Mar 02 2018 - 19:42:17 +0100) Allwinner Technology

CPU:   Allwinner A13 (SUN5I)
I2C:   ready
DRAM:  512 MiB
NAND:  4096 MiB
video-mode 720x480-24@60 not available, falling back to 1024x768-24@60
Setting up a 720x480i composite-ntsc console (overscan 40x20)
In:    serial
Out:   serial
Err:   serial
Net:   usb_ether
starting USB...
No controllers found
Hit any key to stop autoboot:  0 
(FEL boot)
## Executing script at 43100000

NAND erase.chip: device 0 whole chip
Skipping bad block at  0x14800000                                          
Skipping bad block at  0x15800000                                          
Skipping bad block at  0x16800000                                          
Skipping bad block at  0x2a800000                                          
Skipping bad block at  0x4a800000                                          
Skipping bad block at  0x67c00000                                          
Skipping bad block at  0x8e800000                                          
Erasing at 0xffc00000 -- 100% complete.
OK

NAND write:  3462144 bytes written: OK

NAND write:  3462144 bytes written: OK

NAND write: device 0 offset 0x800000, size 0x400000
 4194304 bytes written: OK

NAND write: device 0 offset 0x1000000, size 0x2c00000
 46137344 bytes written: OK
## Resetting to default environment
Saving Environment to NAND...
Erasing NAND...
Erasing at 0xc00000 -- 100% complete.
Writing to NAND... OK
(FEL boot)
## Executing script at 43100000
Wrong image format for "source" command

device nand0 <sunxi-nand.0>, # parts = 5
 #: name                size            offset          mask_flags
 0: spl                 0x00400000      0x00000000      0
 1: spl-backup          0x00400000      0x00400000      0
 2: uboot               0x00400000      0x00800000      0
 3: env                 0x00400000      0x00c00000      0
 4: UBI                 0xff000000      0x01000000      0

active partition: nand0,0 - (spl) 0x00400000 @ 0x00000000

defaults:
mtdids  : none
mtdparts: none
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: volume 0 ("rootfs") re-sized from 20 to 996 LEBs
ubi0: attached mtd1 (name "mtd=4", size 4080 MiB)
ubi0: PEB size: 2097152 bytes (4096 KiB), LEB size: 2064384 bytes
ubi0: min./max. I/O unit sizes: 16384/16384, sub-page size 16384
ubi0: VID header offset: 16384 (aligned 16384), data offset: 32768
ubi0: good PEBs: 1013, bad PEBs: 7, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1282282818
ubi0: available PEBs: 0, total reserved PEBs: 1013, PEBs reserved for bad PEB handling: 13
Loading file '/boot/sun5i-r8-chip.dtb' to addr 0x43000000...
Done
Loading file '/boot/zImage' to addr 0x42000000...
Done
Kernel image @ 0x42000000 [ 0x000000 - 0x69fd68 ]
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
   Loading Device Tree to 49ff3000, end 49fffe03 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.4.30-yocto-example-c (arnaud@ubuntu) (gcc version 4.9.2 (GCC) ) #1 SMP Sun Mar 4 15:44:13 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] Machine model: NextThing C.H.I.P.
[    0.000000] Memory policy: Data cache writeback
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] PERCPU: Embedded 12 pages/cpu @dfe78000 s19136 r8192 d21824 u49152
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 129711
[    0.000000] Kernel command line: root=ubi0:rootfs rootfstype=ubifs rw earlyprintk ubi.mtd=4
[    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: 502556K/522932K available (8818K kernel code, 1125K rwdata, 4244K rodata, 1076K init, 346K bss, 20376K 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 : 0xe0000000 - 0xff800000   ( 504 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xdfead000   ( 510 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0208000 - 0xc0eca894   (13067 kB)
[    0.000000]       .init : 0xc0ecb000 - 0xc0fd8000   (1076 kB)
[    0.000000]       .data : 0xc0fd8000 - 0xc10f14f8   (1126 kB)
[    0.000000]        .bss : 0xc10f4000 - 0xc114ab20   ( 347 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000]  RCU restricting CPUs from NR_CPUS=16 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=1
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000026] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000056] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000495] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6370868154 ns
[    0.001855] Console: colour dummy device 80x30
[    0.002291] console [tty0] enabled
[    0.002329] Calibrating delay loop... 1002.70 BogoMIPS (lpj=2506752)
[    0.025120] pid_max: default: 32768 minimum: 301
[    0.025260] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.025287] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.025962] CPU: Testing write buffer coherency: ok
[    0.026290] CPU0: thread -1, cpu 0, socket -1, mpidr 0
[    0.026393] Setting up static identity map for 0x40209000 - 0x40209098
[    0.034260] Brought up 1 CPUs
[    0.034320] SMP: Total of 1 processors activated (1002.70 BogoMIPS).
[    0.034342] CPU: All CPU(s) started in SVC mode.
[    0.034900] devtmpfs: initialized
[    0.046711] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    0.047668] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302231375000 ns
[    0.048214] pinctrl core: initialized pinctrl subsystem
[    0.050340] NET: Registered protocol family 16
[    0.050939] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.052710] cpuidle: using governor ladder
[    0.052758] cpuidle: using governor menu
[    0.060858] No ATAGs?
[    0.060892] hw-breakpoint: debug architecture 0x4 unsupported.
[    0.064039] Serial: AMBA PL011 UART driver
[    0.077602] reg-fixed-voltage usb0-vbus: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/chip_vbus_pin@0, deferring probe
[    0.080997] vgaarb: loaded
[    0.082035] SCSI subsystem initialized
[    0.082691] usbcore: registered new interface driver usbfs
[    0.082788] usbcore: registered new interface driver hub
[    0.082861] usbcore: registered new device driver usb
[    0.084071] pps_core: LinuxPPS API ver. 1 registered
[    0.084102] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.084158] PTP clock support registered
[    0.084353] EDAC MC: Ver: 3.0.0
[    0.087093] clocksource: Switched to clocksource timer
[    0.088632] simple-framebuffer 5febc000.framebuffer: framebuffer at 0x5febc000, 0x135600 bytes, mapped to 0xe0100000
[    0.088693] simple-framebuffer 5febc000.framebuffer: format=x8r8g8b8, mode=640x440x32, linelength=2880
[    0.093655] Console: switching to colour frame buffer device 80x27
[    0.100486] simple-framebuffer 5febc000.framebuffer: fb0: simplefb registered!
[    0.116072] NET: Registered protocol family 2
[    0.119597] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    0.122500] TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
[    0.125403] TCP: Hash tables configured (established 4096 bind 4096)
[    0.128387] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.131314] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.134411] NET: Registered protocol family 1
[    0.137752] RPC: Registered named UNIX socket transport module.
[    0.140622] RPC: Registered udp transport module.
[    0.143428] RPC: Registered tcp transport module.
[    0.146157] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.151117] futex hash table entries: 256 (order: 2, 16384 bytes)
[    0.166708] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.170866] NFS: Registering the id_resolver key type
[    0.173937] Key type id_resolver registered
[    0.176800] Key type id_legacy registered
[    0.179650] ntfs: driver 2.1.32 [Flags: R/O].
[    0.184266] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    0.190090] io scheduler noop registered
[    0.192942] io scheduler deadline registered
[    0.195704] io scheduler cfq registered (default)
[    0.200299] sun4i-usb-phy 1c13400.phy: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/chip_id_det_pin@0, deferring probe
[    0.209634] sun5i-a13-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.226878] coupled-voltage-regulator wifi_reg: Couldn't get regulator vin0
[    0.289300] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.315175] 1c28400.serial: ttyS0 at MMIO 0x1c28400 (irq = 28, base_baud = 1500000) is a U6_16550A
[    0.910549] console [ttyS0] enabled
[    0.937996] 1c28c00.serial: ttyS1 at MMIO 0x1c28c00 (irq = 29, base_baud = 1500000) is a U6_16550A
[    0.953498] SuperH (H)SCI(F) driver initialized
[    0.961599] msm_serial: driver initialized
[    0.968906] STMicroelectronics ASC driver initialized
[    0.978000] [drm] Initialized drm 1.1.0 20060810
[    0.986547] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    0.996152] [drm] No driver support for vblank timestamp query.
[    1.005401] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc106b4f0)
[    1.019137] sun4i-tcon 1c0c000.lcd-controller: No panel or bridge found... RGB output disabled
[    1.033744] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc106b394)
[    1.047742] sun4i-drm display-engine: bound 1c0a000.tv-encoder (ops 0xc106b5cc)
[    1.061401] fb: switching to sun4i-drm-fb from simple
[    1.069829] Console: switching to colour dummy device 80x30
[    1.099925] Console: switching to colour frame buffer device 90x30
[    1.110599] sun4i-drm display-engine: fb0:  frame buffer device
[    1.126294] loop: module loaded
[    1.143245] nand: device found, Manufacturer ID: 0x98, Chip ID: 0xd7
[    1.152814] nand: Toshiba TC58TEG5DCLTA00
[    1.159827] nand: 4096 MiB, MLC, erase size: 4096 KiB, page size: 16384, OOB size: 1280
[    1.170981] Scanning device for bad blocks
[    1.193321] Bad eraseblock 82 at 0x000014800000
[    1.201547] Bad eraseblock 86 at 0x000015800000
[    1.209659] Bad eraseblock 90 at 0x000016800000
[    1.231671] Bad eraseblock 170 at 0x00002a800000
[    1.262568] Bad eraseblock 298 at 0x00004a800000
[    1.291326] Bad eraseblock 415 at 0x000067c00000
[    1.321351] random: nonblocking pool is initialized
[    1.334488] Bad eraseblock 570 at 0x00008e800000
[    1.425064] 5 ofpart partitions found on MTD device 1c03000.nand
[    1.433697] Creating 5 MTD partitions on "1c03000.nand":
[    1.441631] 0x000000000000-0x000000400000 : "SPL"
[    1.450311] 0x000000400000-0x000000800000 : "SPL.backup"
[    1.459431] 0x000000800000-0x000000c00000 : "U-Boot"
[    1.468030] 0x000000c00000-0x000001000000 : "env"
[    1.476217] 0x000001000000-0x000200000000 : "rootfs"
[    1.483533] mtd: partition "rootfs" extends beyond the end of device "1c03000.nand" -- size truncated to 0xff000000
[    1.503575] libphy: Fixed MDIO Bus: probed
[    1.510808] CAN device driver interface
[    1.518003] igb: Intel(R) Gigabit Ethernet Network Driver - version 5.3.0-k
[    1.527227] igb: Copyright (c) 2007-2014 Intel Corporation.
[    1.537334] pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver
[    1.547145] usbcore: registered new interface driver pegasus
[    1.555154] usbcore: registered new interface driver asix
[    1.562810] usbcore: registered new interface driver ax88179_178a
[    1.571085] usbcore: registered new interface driver cdc_ether
[    1.579058] usbcore: registered new interface driver smsc75xx
[    1.586897] usbcore: registered new interface driver smsc95xx
[    1.594612] usbcore: registered new interface driver net1080
[    1.602161] usbcore: registered new interface driver rndis_host
[    1.609936] usbcore: registered new interface driver cdc_subset
[    1.617720] usbcore: registered new interface driver zaurus
[    1.625220] usbcore: registered new interface driver cdc_ncm
[    1.634149] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.642678] ehci-pci: EHCI PCI platform driver
[    1.649147] ehci-platform: EHCI generic platform driver
[    1.656694] ehci-omap: OMAP-EHCI Host Controller driver
[    1.664075] ehci-orion: EHCI orion driver
[    1.670127] SPEAr-ehci: EHCI SPEAr driver
[    1.676111] ehci-st: EHCI STMicroelectronics driver
[    1.682984] ehci-exynos: EHCI EXYNOS driver
[    1.689170] ehci-atmel: EHCI Atmel driver
[    1.695186] tegra-ehci: Tegra EHCI driver
[    1.701262] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.709486] ohci-pci: OHCI PCI platform driver
[    1.715954] ohci-platform: OHCI generic platform driver
[    1.723362] ohci-omap3: OHCI OMAP3 driver
[    1.729437] SPEAr-ohci: OHCI SPEAr driver
[    1.735426] ohci-st: OHCI STMicroelectronics driver
[    1.742246] ohci-atmel: OHCI Atmel driver
[    1.748486] usbcore: registered new interface driver usb-storage
[    1.757695] udc-core: couldn't find an available UDC - added [g_serial] to list of pending drivers
[    1.770924] mousedev: PS/2 mouse device common for all mice
[    1.782691] i2c /dev entries driver
[    1.789959] axp20x 0-0034: AXP20x variant AXP209 found
[    1.812816] input: axp20x-pek as /devices/platform/soc@01c00000/1c2ac00.i2c/i2c-0/0-0034/axp20x-pek/input/input0
[    1.834905] axp20x 0-0034: AXP20X driver loaded
[    1.844286] pcf857x 2-0038: probed
[    1.873207] sunxi-wdt 1c20c90.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[    1.885752] sdhci: Secure Digital Host Controller Interface driver
[    1.894588] sdhci: Copyright(c) Pierre Ossman
[    1.902784] Synopsys Designware Multimedia Card Interface Driver
[    1.912720] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.922923] ledtrig-cpu: registered to indicate activity on CPUs
[    1.931909] usbcore: registered new interface driver usbhid
[    1.940116] usbhid: USB HID core driver
[    1.949776] ip_tables: (C) 2000-2006 Netfilter Core Team
[    1.958969] NET: Registered protocol family 10
[    1.967342] sit: IPv6 over IPv4 tunneling driver
[    1.975463] NET: Registered protocol family 17
[    1.982694] can: controller area network core (rev 20120528 abi 9)
[    1.991650] NET: Registered protocol family 29
[    1.998795] can: raw protocol (rev 20120528)
[    2.005741] can: broadcast manager protocol (rev 20120528 t)
[    2.014106] can: netlink gateway (rev 20130117) max_hops=1
[    2.022973] Key type dns_resolver registered
[    2.035441] ThumbEE CPU extension supported.
[    2.042614] Registering SWP/SWPB emulation handler
[    2.053608] usb0-vbus: supplied by vcc5v0
[    2.063769] ehci-platform 1c14000.usb: EHCI Host Controller
[    2.072177] ehci-platform 1c14000.usb: new USB bus registered, assigned bus number 1
[    2.082817] ehci-platform 1c14000.usb: irq 22, io mem 0x01c14000
[    2.097111] ehci-platform 1c14000.usb: USB 2.0 started, EHCI 1.00
[    2.106882] hub 1-0:1.0: USB hub found
[    2.113374] hub 1-0:1.0: 1 port detected
[    2.121796] ohci-platform 1c14400.usb: Generic Platform OHCI controller
[    2.131148] ohci-platform 1c14400.usb: new USB bus registered, assigned bus number 2
[    2.141600] ohci-platform 1c14400.usb: irq 23, io mem 0x01c14400
[    2.207149] hub 2-0:1.0: USB hub found
[    2.213423] hub 2-0:1.0: 1 port detected
[    2.222752] usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    2.233493] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    2.241763] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 3
[    2.253240] hub 3-0:1.0: USB hub found
[    2.259541] hub 3-0:1.0: 1 port detected
[    2.266753] g_serial gadget: Gadget Serial v2.4
[    2.273705] g_serial gadget: g_serial ready
[    2.282386] sunxi-mmc 1c0f000.mmc: No vqmmc regulator found
[    2.291965] sunxi-mmc 1c0f000.mmc: allocated mmc-pwrseq
[    2.327132] sunxi-mmc 1c0f000.mmc: base:0xe00fc000 irq:20
[    2.337889] ubi0: attaching mtd4
[    2.349137] sunxi-mmc 1c0f000.mmc: smc 0 err, cmd 8, RTO !!
[    2.368663] mmc0: new high speed SDIO card at address 0001
[    2.851929] ubi0: scanning is finished
[    2.864185] ubi0 warning: print_rsvd_warning: cannot reserve enough PEBs for bad PEB handling, reserved 13, need 53
[    2.880508] ubi0: attached mtd4 (name "rootfs", size 4080 MiB)
[    2.888931] ubi0: PEB size: 4194304 bytes (2048 KiB), LEB size: 2064384 bytes
[    2.898567] ubi0: min./max. I/O unit sizes: 16384/16384, sub-page size 16384
[    2.908105] ubi0: VID header offset: 16384 (aligned 16384), data offset: 32768
[    2.917858] ubi0: good PEBs: 1013, bad PEBs: 7, corrupted PEBs: 0
[    2.926484] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
[    2.936318] ubi0: max/mean erase counter: 1/0, WL threshold: 100, image sequence number: 1282282818
[    2.950609] ubi0: available PEBs: 0, total reserved PEBs: 1013, PEBs reserved for bad PEB handling: 13
[    2.965878] hctosys: unable to open rtc device (rtc0)
[    2.978904] vcc3v0: disabling
[    2.984809] vcc3v3: disabling
[    2.990519] usb0-vbus: disabling
[    2.997162] ubi0: background thread "ubi_bgt0d" started, PID 57
[    3.016956] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 58
[    3.655759] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[    3.666118] UBIFS (ubi0:0): LEB size: 2064384 bytes (2016 KiB), min./max. I/O unit sizes: 16384 bytes/16384 bytes
[    3.681909] UBIFS (ubi0:0): FS size: 2035482624 bytes (1941 MiB, 986 LEBs), journal size 18579457 bytes (17 MiB, 9 LEBs)
[    3.698619] UBIFS (ubi0:0): reserved for root: 0 bytes (0 KiB)
[    3.707464] UBIFS (ubi0:0): media format: w4/r0 (latest is w4/r0), UUID 56B339F8-1722-486A-8EEC-78B9CC0F414E, small LPT model
[    3.729304] VFS: Mounted root (ubifs filesystem) on device 0:15.
[    3.742459] devtmpfs: mounted
[    3.749975] Freeing unused kernel memory: 1076K (c0ecb000 - c0fd8000)
INIT: version 2.88 booting
Starting udev
[    4.479461] udevd[82]: starting version 182
[    5.602874] sun4i-codec 1c22c00.codec: Codec <-> 1c22c00.codec mapping ok
Populating dev cache
hwclock: can't open '/dev/misc/rtc': No such file or directory
Sun Mar  4 16:13:26 UTC 2018
INIT: Entering runlevel: 5misc/rtc': No such file or directory
Configuring network interfaces... ifconfig: SIOCGIFFLAGS: No such device
ifconfig: SIOCSIFADDR: No such device
hwclock: can't open '/dev/misc/rtc': No such file or directory
Starting syslogd/klogd: done

Poky (Yocto Project Reference Distro) 1.8.2 chip /dev/ttyS0

chip login: root
root@chip:~# reboot

Broadcast message from root@chip (ttyS0) (Sun Mar  4 16:13:35 2018):

The system is going down for reboot NOW!
INIT: Sending processes the TERM signal
root@chip:~# [   18.776620] g_serial gadget: high-speed config #2: CDC ACM config
INIT: Sendinghwclock: can't open '/dev/misc/rtc': No such file or directory
Stopping syslogd/klogd: stopped syslogd (pid 363)
stopped klogd (pid 366)
done
Deconfiguring network interfaces... ifdown: interface wlan0 not configured
done.
Sending all processes the TERM signal...
Sending all processes the KILL signal...
Unmounting remote filesystems...
Deactivating swap...
Unmounting local filesystems...
[   29.289450] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" stops
Rebooting... [   31.368867] musb-hdrc musb-hdrc.1.auto: remove, state 4
[   31.381364] usb usb3: USB disconnect, device number 1
[   31.394544] musb-hdrc musb-hdrc.1.auto: USB bus 3 deregistered
[   31.411385] reboot: Restarting system

Hello @ArnaudNe
I have get the same issue during the development of my meta layer. It was due to the flashing and uboot options. I have reworked the flashing script for that. I see also you have forked my meta layer a long time ago.
=> Are you using the very last version of my meta layer and chip-tools ?
=> Have you got an Alpha CHIP or a CHIP ?
Joel

Hi Joel,

Thank you for your answer.
I am using your uniquely your meta-layer (on a clean Ubuntu VM), not my fork.

The CHIPs I use were preordered, so I imagine they come from one of the first production batch. How can I know if they are Αlpha revision or a more recent one ?
All I can indicate is that the mounted NAND is a Toshiba one (4GB), and that CHIP v1.0 is written on the bottom of the PCB.

What is also strange is that when I flash my both CHIP with the official Flash tool (Server image), they work as expected.

Edit: It looks like the CHIP I have (v1.0) are not Alpha (v0.21) from what I can see here.

What was the Linux distribution you used to build the image ? I used 16.04 (and Fido was apparently not verified with it, I'm trying to put all chances on my side 😄)

Probably your CHIP has one uboot option set I didn't expect.
Can you perform the following procedure:

  • In the script "chip-flash-chip.sh", add:
echo "printenv" >> "${UBOOT_SCRIPT_SRC}"

just before the line

echo "boot" >> "${UBOOT_SCRIPT_SRC}"

(line 112);

  • Flash the CHIP again with a serial link connected to Tx/Rx/GND pins.
  • At the end of the flashing procedure and before boot, you should see the following content or something equivalent, can you give me yours ?
baudrate=115200
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_targets=fel usb0 pxe dhcp
bootargs=root=ubi0:rootfs rootfstype=ubifs rw earlyprintk ubi.mtd=4
bootcmd=if test -n ${fel_booted} && test -n ${scriptaddr}; then echo (FEL boot); source ${scriptaddr}; fi; mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload $fdt_addr_r /boot/$fdtfile; ubifsload $kernel_addr_r /boot/zImage; bootz $kernel_addr_r - $fdt_addr_r
bootcmd_dhcp=usb start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi
bootcmd_fel=if test -n ${fel_booted} && test -n ${scriptaddr}; then echo '(FEL boot)'; source ${scriptaddr}; fi
bootcmd_pxe=usb start; dhcp; if pxe get; then pxe boot; fi
bootcmd_usb0=setenv devnum 0; run usb_boot
bootdelay=2
bootm_size=0xa000000
console=ttyS0,115200
dfu_alt_info_ram=kernel ram 0x42000000 0x1000000;fdt ram 0x43000000 0x100000;ramdisk ram 0x43300000 0x4000000
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
fdt_addr_r=0x43000000
fdtfile=sun5i-r8-chip.dtb
fel_booted=0
kernel_addr_r=0x42000000
mtdids=nand0=sunxi-nand.0
mtdparts=mtdparts=sunxi-nand.0:4m(spl),4m(spl-backup),4m(uboot),4m(env),-(UBI)
preboot=usb start
pxefile_addr_r=0x43200000
ramdisk_addr_r=0x43300000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x43100000
stderr=serial
stdin=serial
stdout=serial
ubifs_boot=if ubi part UBI && ubifsmount ubi${devnum}:boot; then setenv devtype ubi; setenv bootpart 0; run scan_dev_for_boot; fi
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi
usbnet_devaddr=de:ad:be:af:00:01

That's my output (appearing to be the exact same output than yours) :

baudrate=115200
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_targets=fel usb0 pxe dhcp
bootargs=root=ubi0:rootfs rootfstype=ubifs rw earlyprintk ubi.mtd=4
bootcmd=if test -n ${fel_booted} && test -n ${scriptaddr}; then echo (FEL boot); source ${scriptaddr}; fi; mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload $fdt_addr_r /boot/$fdtfile; ubifsload $kernel_addr_r /boot/zImage; bootz $kernel_addr_r - $fdt_addr_r
bootcmd_dhcp=usb start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi
bootcmd_fel=if test -n ${fel_booted} && test -n ${scriptaddr}; then echo '(FEL boot)'; source ${scriptaddr}; fi
bootcmd_pxe=usb start; dhcp; if pxe get; then pxe boot; fi
bootcmd_usb0=setenv devnum 0; run usb_boot
bootdelay=2
bootm_size=0xa000000
console=ttyS0,115200
dfu_alt_info_ram=kernel ram 0x42000000 0x1000000;fdt ram 0x43000000 0x100000;ramdisk ram 0x43300000 0x4000000
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
fdt_addr_r=0x43000000
fdtfile=sun5i-r8-chip.dtb
fel_booted=0
kernel_addr_r=0x42000000
mtdids=nand0=sunxi-nand.0
mtdparts=mtdparts=sunxi-nand.0:4m(spl),4m(spl-backup),4m(uboot),4m(env),-(UBI)
preboot=usb start
pxefile_addr_r=0x43200000
ramdisk_addr_r=0x43300000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x43100000
stderr=serial
stdin=serial
stdout=serial
ubifs_boot=if ubi part UBI && ubifsmount ubi${devnum}:boot; then setenv devtype ubi; setenv bootpart 0; run scan_dev_for_boot; fi
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi
usbnet_devaddr=de:ad:be:af:00:01

Yes the same, good point.

I see you have not the same NAND memory I have on my CHIPs. You have a 4GB NAND while I have an 8GB one. I know there were two different configurations but though the other one was alpha CHIP (I have not planned to support it).

Several steps:
1/ Replace "printenv" in the line I have ask you to add previously by "nand info" and make the same operation. You should see something like shown below just before the system boots but probably with OOB size at 1280 bytes.

Device 0: nand0, sector size 4096 KiB
  Page size      16384 b
  OOB size        1664 b
  Erase size   4194304 b
  subpagesize    16384 b
  options     0x40003200
  bbt options 0x  110000

Please paste me the result so I can get all the values.

2/ If previous step is confirmed, in the script "chip-flash-chip.sh" change the definition "NAND_OOB_SIZE=1664" at the beginning of the file with the correct OOB size. So probably "NAND_OOB_SIZE=1280" and try again to flash CHIP then to power off and reboot normally just by applying power supply. Let me known of the result.

Just also to be sure if you have CHIP or alpha CHIP, can you check pin location on your CHIP identified in red on the following schema ?

chip_v1_0_pinout

If you have LRADC at pin 9, you have an alpha CHIP.

images.tar.gz
Hi Joel,

I've verified that I've got the CHIP, not the Alpha revision. VCC is the closest Pin to FEL.

First, my nand info is the following :

Device 0: nand0, sector size 4096 KiB
  Page size      16384 b
  OOB size        1280 b
  Erase size   4194304 b
  subpagesize    16384 b
  options     0x40003200
  bbt options 0x  100000

As you predicted, I've got an OOB Size of 1280B. Is also see that our bbt options differ. Is that normal ? What is this setting ?

I changed the script accordingly :

# Tools
FEL=sunxi-fel

# NAND
NAND_PAGE_SIZE=16384
NAND_OOB_SIZE=1280

# FDT file name
FDT_FILE=sun5i-r8-chip.dtb

But that did not help... Same result. 😔
I managed to get a CHIP board (1.0, not Alpha) that was bought more recently and that has not been reflashed yet. It gave me, again, the same results...

Could you give me your generated images ? I would test them on my CHIPs to see if it could come from the compilation. What do you think ?

Here are mines if you wanna try them.
images.tar.gz

In the meantime, I will start over a new build from scratch and test again.
On what distribution did you make the build ?

From what I can see, I always get Wrong image format for "source" command after the second FEL Boot. Is that normal ?

Here are the last full logs.

chip_flash_log.txt
chip_uart_log.txt

Just tested your image and CHIP is working fine. So generation is OK. I see you have build starting from my C example but that you have removed helloworld demo :-)
I have attached my minimal image if you want to test:

images.zip

Sure the problem is the flashing procedure with this nand.
I see something which is not normal : why have you got files "ubi_type" and "uboot.scr" in your archive ? Are they old files ? My flashing scripts are not generating them, but NTC was doing that....

I just remembered I had this kind of issue with CHIP Pro particularly, not CHIP, can you try the following script to flash your CHIP:

chip-flash-chip-test.sh.zip

(it is CHIP pro script with CHIP nand characteristics - the mecanism to flash CHIP pro is very different and can solve the issue).

BBT is the bad block table. The additional flag I have is related to BBT scan on init. Disabled on my config, not sure why and how but I don't think it is related to your issue.

If above procedure is not working, this is probably because of a mix of all those things and I can also propose you to send me your CHIP (I have seen you are in France too). It is possible that we need to change the generation of the image itself.

Edit:
I have also "Wrong image format for "source" command".

Yep, exactly I tried to build the C Hello World example image to see if that could do better. But it was not.
I don't remember why and how I got those ubi_type and uboot.scr files, maybe during my endless tryouts this weekend 😔

This is the output I get with your images and the modified script (I had to increase the fast boot timeout duration).

U-Boot SPL 2016.01 (Feb 18 2018 - 19:06:58)
DRAM: 512 MiB
CPU: 1008000000Hz, AXI/AHB/APB: 3/2/2
Trying to boot from 


U-Boot 2016.01 (Feb 18 2018 - 19:06:58 +0100) Allwinner Technology

CPU:   Allwinner A13 (SUN5I)
I2C:   ready
DRAM:  512 MiB
NAND:  4096 MiB
video-mode 720x480-24@60 not available, falling back to 1024x768-24@60
Setting up a 720x480i composite-ntsc console (overscan 40x20)
In:    serial
Out:   serial
Err:   serial
Net:   usb_ether
starting USB...
No controllers found
Hit any key to stop autoboot:  0 
(FEL boot)
## Executing script at 43100000

NAND erase.chip: device 0 whole chip
Skipping bad block at  0x00000000                                          
Skipping bad block at  0x00400000                                          
Skipping bad block at  0x14800000                                          
Skipping bad block at  0x15800000                                          
Skipping bad block at  0x16800000                                          
Skipping bad block at  0x2a800000                                          
Skipping bad block at  0x4a800000                                          
Skipping bad block at  0x67c00000                                          
Skipping bad block at  0x8e800000                                          
Erasing at 0xffc00000 -- 100% complete.
OK

NAND write:  18087936 bytes written: OK

NAND write:  18087936 bytes written: OK

NAND write: device 0 offset 0x800000, size 0x400000
 4194304 bytes written: OK
## Resetting to default environment
Saving Environment to NAND...
Erasing NAND...
Erasing at 0xc00000 -- 100% complete.
Writing to NAND... OK
musb-hdrc: peripheral reset irq lost!
Starting download of 19661248 bytes
..........................................................................
..........................................................................
..
downloading of 19661248 bytes finished
Flashing sparse image on partition UBI at offset 0x1000000 (ID: 0)
start 0x400 blkcnt 0x10 partition 0x400 size 0x3fc00
Writing at offset 0x1000000
NAND write to offset 1040000 failed -5
Failed to write sparse chunk
store_sparse_image: Write 0 failed -5
status: -104 ep 'ep1in' trans: 4

device nand0 <sunxi-nand.0>, # parts = 5
 #: name                size            offset          mask_flags
 0: spl                 0x00400000      0x00000000      0
 1: spl-backup          0x00400000      0x00400000      0
 2: uboot               0x00400000      0x00800000      0
 3: env                 0x00400000      0x00c00000      0
 4: UBI                 0xff000000      0x01000000      0

active partition: nand0,0 - (spl) 0x00400000 @ 0x00000000

defaults:
mtdids  : none
mtdparts: none
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: empty MTD device detected
ubi0: attached mtd1 (name "mtd=4", size 4080 MiB)
ubi0: PEB size: 2097152 bytes (4096 KiB), LEB size: 2064384 bytes
ubi0: min./max. I/O unit sizes: 16384/16384, sub-page size 16384
ubi0: VID header offset: 16384 (aligned 16384), data offset: 32768
ubi0: good PEBs: 1013, bad PEBs: 7, corrupted PEBs: 0
ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 0
ubi0: available PEBs: 996, total reserved PEBs: 17, PEBs reserved for bad PEB hand3
Error reading superblock on volume 'ubi0:rootfs' errno=-19!
ubifsmount - mount UBIFS volume

Usage:
ubifsmount <volume-name>
    - mount 'volume-name' volume
UBIFS not mounted, use ubifs mount to mount volume first!
ubifsload - load file from an UBIFS filesystem

Usage:
ubifsload <addr> <filename> [bytes]
    - load file 'filename' to address 'addr'
UBIFS not mounted, use ubifs mount to mount volume first!
ubifsload - load file from an UBIFS filesystem

Usage:
ubifsload <addr> <filename> [bytes]
    - load file 'filename' to address 'addr'
Bad Linux ARM zImage magic!
=> 

I also tried your images and the "old" script, won't work either... It must be the NAND, or maybe the sunxi-tool ? I'm using the latest version of them. (master branch)

Yep, I can send you one of my CHIP if you think that it could help us find what is going wrong...

Ok according to the result of this script probably the method used for chip pro is not the right one for your chip. A mix of multiple modifications is probably the key. It is possible that I have to modify the generation of the image.

I just send you a linkedin invitation to share my postal address with you, it's probably the simplest solution I can propose you to progress on the subject.

After analysis and several testing, the problem is due to "sunxi-spl-with-ecc.bin" file which is generated with the wrong NAND settings for this CHIP version, particularly OOB size is different.

Solution applied: remove generation of the file "sunxi-spl-with-ecc.bin" in the u-boot recipe, detection of the NAND characteristics and generation of the right SPL format at the loading process.

See also joelguittet/chip-tools#1.

Just tested, it justs worked out of the box, and perfectly !
Thank you for your great work and patience !

Closing the issue.