Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uBoot bootargs are missing and can't boot #7

Closed
ddB0515 opened this issue Nov 17, 2021 · 9 comments
Closed

uBoot bootargs are missing and can't boot #7

ddB0515 opened this issue Nov 17, 2021 · 9 comments

Comments

@ddB0515
Copy link

ddB0515 commented Nov 17, 2021

Opening this issue for making together uBoot bootargs as after rescue kernel and uBoot are flashed to SPI NAND device can't boot standalone
There is already some people in issue #5 that have same issues and this is not resolved

I have extracted from original SDK bootargs

setenv bootargs console=ttyS0,115200 ubi.mtd=UBI,2048 root=ubi:rootfs ro rootfstype=ubifs init=/linuxrc rootwait=1 LX_MEM=0x3f00000 mma_heap=mma_heap_name0,miu=0,sz=0x1a00000 mma_memblock_remove=1 highres=off mmap_reserved=fb,miu=0,sz=0x300000,max_start_off=0x3300000,max_end_off=0x3600000 $(mtdparts)
setenv bootcmd ' bootlogo 0 0 0 0 0; mw 1f001cc0 11; gpio out 8 0; nand read.e 0x22000000 KERNEL 0x500000; gpio out 8 1; bootm 0x22000000;nand read.e 0x22000000 RECOVERY 0x500000; bootm 0x22000000

And as we don't need most of this stuff we would need new one that will make us boot normally

1st issue I got in uBoot is no support for nand access and we have to do it with ubi so original will not be a lot of help
If you query from uBoot ubi info

UBI: MTD device name:            "UBI"
UBI: MTD device size:            125 MiB
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    126976 bytes
UBI: number of good PEBs:        1002
UBI: number of bad PEBs:         0
UBI: smallest flash I/O unit:    2048
UBI: VID header offset:          2048 (aligned 2048)
UBI: data offset:                4096
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     5
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 1002
UBI: number of PEBs reserved for bad PEB handling: 18
UBI: max/mean erase counter: 2/1

So we can see UBI just need to adjust some things as is suggested in #5 by @fifteenhex but I don't know how to save in this case
I have tried sf probe0 and saveenv but that just frooze and did nothing

Also do we need to separate bootcmd and bootargs? or we could use it as one?

@fifteenhex
Copy link
Owner

You just need to load the kernel into memory from ubi and jump to it.
If the ubi command is detecting your ubi device correctly you can use it to load the kernel from the right partition.

I don't think sf is meant for spi nand.

bootargs is you kernel commandline. You should tell it what to mount as root there.
bootcmd should be the ubi command to load the kernel into memory and bootm it.

saveenv should work too. But maybe if you use the sf command it breaks things.

@ddB0515
Copy link
Author

ddB0515 commented Nov 18, 2021

I have tried with sf and without it just freeze on saveenv so that is not working as intended to
Also how I can debug that I can save uBoot args and load automatically without need to do manual entry?

As I have tried this

setenv bootargs console=ttyS0,115200 ubi.mtd=1 ubi.block=0,4 root=/dev/ubiblock0_4 rootfstype=ubifs rw rootwait=1 ip=none
setenv loadaddr 0x22000000; ubi readvol ${loadaddr} kernel 0x800000; bootm ${loadaddr}

But it hangs when needs to load

Read 8388608 bytes from volume kernel to 22000000                               
## Loading kernel from FIT Image at 22000000 ...                                
   Using 'ssd201-som2d01' configuration                                         
   Trying 'kernel@0' kernel subimage                                            
     Description:  unavailable                                                  
     Type:         Kernel Image                                                 
     Compression:  uncompressed                                                 
     Data Start:   0x220000ac                                                   
     Data Size:    3429928 Bytes = 3.3 MiB                                      
     Architecture: ARM                                                          
     OS:           Linux                                                        
     Load Address: 0x21800000                                                   
     Entry Point:  0x21800000                                                   
     Hash algo:    crc32                                                        
     Hash value:   6003835a                                                     
     Hash algo:    sha1                                                         
     Hash value:   649bafb43093e65022f907f6ef1c3c6a1185f952                     
   Verifying Hash Integrity ... crc32+ sha1+ OK                                 
## Loading fdt from FIT Image at 22000000 ...                                   
   Using 'ssd201-som2d01' configuration                                         
   Trying 'fdt@0' fdt subimage                                                  
     Description:  unavailable                                                  
     Type:         Flat Device Tree                                             
     Compression:  uncompressed                                                 
     Data Start:   0x223457d4                                                   
     Data Size:    24563 Bytes = 24 KiB                                         
     Architecture: ARM                                                          
     Hash algo:    crc32                                                        
     Hash value:   30ecc305                                                     
     Hash algo:    sha1                                                         
     Hash value:   3ac3737b6390970d192742eb6af0605fd8d21d4b                     
   Verifying Hash Integrity ... crc32+ sha1+ OK                                 
   Booting using the fdt blob at 0x223457d4                                     
   Loading Kernel Image                                                         
   Loading Device Tree to 22f7d000, end 22f85ff2 ... OK                         
                                                                                
Starting kernel ...                                                             
                                                                                
[    0.000000] Booting Linux on physical CPU 0x0                                
[    0.000000] Linux version 5.15.0 (buildroot@buildroot) (arm-buildroot-linux-1
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d  
[    0.000000] CPU: div instructions available: patching division code          
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instructie
[    0.000000] OF: fdt: Machine model: SOM2D01 (SSD201)                         
[    0.000000] Memory policy: Data cache writealloc                             
[    0.000000] Zone ranges:                                                     
[    0.000000]   Normal   [mem 0x0000000020000000-0x0000000023ffffff]           
[    0.000000] Movable zone start for each node                                 
[    0.000000] Early memory node ranges                                         
[    0.000000]   node   0: [mem 0x0000000020000000-0x0000000023ffffff]          
[    0.000000] Initmem setup node 0 [mem 0x0000000020000000-0x0000000023ffffff] 
[    0.000000] percpu: Embedded 10 pages/cpu s16396 r0 d24564 u40960            
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256     
[    0.000000] Kernel command line: console=ttyS0,115200 ubi.mtd=1 ubi.block=0,e
[    0.000000] Unknown kernel command line parameters "rootwait=1 ip=none", wil.
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, li)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, lin)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off          
[    0.000000] Memory: 52536K/65536K available (7168K kernel code, 709K rwdata,)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1       
[    0.000000] rcu: Hierarchical RCU implementation.                            
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.    
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 ji.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2     
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16                  
[    0.000000] arch_timer: cp15 timer(s) running at 6.00MHz (phys).             
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycless
[    0.000001] sched_clock: 56 bits at 6MHz, resolution 166ns, wraps every 4398s
[    0.000023] Switching to timer-based delay loop, resolution 166ns            
[    0.000178] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, maxs
[    0.000229] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, maxs
[    0.000276] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, maxs
[    0.000677] Console: colour dummy device 80x30                               
[    0.000737] Calibrating delay loop (skipped), value calculated using timer f)
[    0.000759] pid_max: default: 32768 minimum: 301                             
[    0.000905] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, line)
[    0.000927] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes,)
[    0.001735] CPU: Testing write buffer coherency: ok                          
[    0.002043] /cpus/cpu@0 missing clock-frequency property                     
[    0.002088] /cpus/cpu@1 missing clock-frequency property                     
[    0.002109] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000                 
[    0.002715] Setting up static identity map for 0x20100000 - 0x20100060       
[    0.002855] rcu: Hierarchical SRCU implementation.                           
[    0.003665] smp: Bringing up secondary CPUs ...                              
[    0.004414] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001                 
[    0.004584] smp: Brought up 1 node, 2 CPUs                                   
[    0.004615] SMP: Total of 2 processors activated (24.00 BogoMIPS).           
[    0.004628] CPU: All CPU(s) started in SVC mode.                             
[    0.005179] devtmpfs: initialized                                            
[    0.012554] random: get_random_bytes called from setup_net+0x28/0x264 with c0
[    0.012971] VFP support v0.3: implementor 41 architecture 2 part 30 variant 5
[    0.013249] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, ms
[    0.013286] futex hash table entries: 512 (order: 3, 32768 bytes, linear)    
[    0.013436] pinctrl core: initialized pinctrl subsystem                      
[    0.014469] NET: Registered PF_NETLINK/PF_ROUTE protocol family              
[    0.014977] DMA: preallocated 256 KiB pool for atomic coherent allocations   
[    0.016558] cpuidle: using governor ladder                                   
[    0.016613] cpuidle: using governor menu                                     
[    0.037545] pm code is at c4875000, pm info is at c4874000, pmsleep is at c40
[    0.037700] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint.
[    0.037723] hw-breakpoint: maximum watchpoint size is 8 bytes.               
[    0.052068] debugfs: Directory 'vcc_dram' with parent 'regulator' already pr!
[    0.052575] SCSI subsystem initialized                                       
[    0.052801] usbcore: registered new interface driver usbfs                   
[    0.052850] usbcore: registered new interface driver hub                     
[    0.052913] usbcore: registered new device driver usb                        
[    0.053234] usb_phy_generic soc:fakephy@0: supply vcc not found, using dummyr
[    0.053630] mc: Linux media interface: v0.10                                 
[    0.053685] videodev: Linux video capture interface: v2.00                   
[    0.054028] FPGA manager framework                                           
[    0.054113] Advanced Linux Sound Architecture Driver Initialized.            
[    0.055287] clocksource: Switched to clocksource arch_sys_counter            
[    0.064544] NET: Registered PF_INET protocol family                          
[    0.064732] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linea)
[    0.065341] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144)
[    0.065407] TCP established hash table entries: 1024 (order: 0, 4096 bytes, )
[    0.065441] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear) 
[    0.065474] TCP: Hash tables configured (established 1024 bind 1024)         
[    0.065603] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)       
[    0.065656] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)  
[    0.065859] NET: Registered PF_UNIX/PF_LOCAL protocol family                 
[    0.066438] RPC: Registered named UNIX socket transport module.              
[    0.066464] RPC: Registered udp transport module.                            
[    0.066474] RPC: Registered tcp transport module.                            
[    0.066483] RPC: Registered tcp NFSv4.1 backchannel transport module.        
[    0.068584] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 countee
[    0.070795] Initialise system trusted keyrings                               
[    0.071103] workingset: timestamp_bits=30 max_order=14 bucket_order=0        
[    0.080698] squashfs: version 4.0 (2009/01/31) Phillip Lougher               
[    0.081837] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.            
[    0.198884] Key type asymmetric registered                                   
[    0.198916] Asymmetric key parser 'x509' registered                          
[    0.199135] Block layer SCSI generic (bsg) driver version 0.4 loaded (major )
[    0.200381] gicint: 25                                                       
[    0.202277] msc313-usb-phy soc:usb@0: Switching to UHC port                  
[    0.202313] msc313-usb-phy soc:usb@0: starting calibration...                
[    0.203332] msc313-usb-phy soc:usb@0: calibration finished.                  
[    0.203680] msc313-usb-phy soc:usb@0: supply vbus not found, using dummy regr
[    0.204127] dphy probe                                                       
[    0.213564] linking mux 8, back to 7                                         
[    0.213942] linking mux 13, back to 0                                        
[    0.214168] linking mux 17, back to 0                                        
[    0.214181] linking mux 17, back to 0                                        
[    0.214191] linking mux 17, back to 0                                        
[    0.216116] cmdq probe                                                       
[    0.216919] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled         
[    0.219494] printk: console [ttyS0] disabled                                 
[    0.219613] 1f221000.uart: ttyS0 at MMIO 0x1f221000 (irq = 55, base_baud = 1A
[    0.906491] printk: console [ttyS0] enabled                                  
[    0.912989] mstar-gop 1f246200.gop: no interrupt provided                    
[    0.938504] mstar-gop 1f246200.gop: rst: 0                                   
[    0.938504] scan_type: interlaced                                            
[    0.938504] colorspace: rgb                                                  
[    0.938504] dst: ip_main                                                     
[    0.938504] stretch window: 720 x 576 (0:0)                                  
[    0.955464] mstar-gop 1f246200.gop: window 1:                                
[    0.955464] en: 0                                                            
[    0.955464] addr: 0x00000000                                                 
[    0.955464] hstart: 0, hend 0, vstart: 0, vend: 0                            
[    0.955464] pitch: 0                                                         
[    0.971785] mstar-gop 1f246800.gop: no interrupt provided                    
[    0.997252] mstar-gop 1f246800.gop: rst: 0                                   
[    0.997252] scan_type: progressive                                           
[    0.997252] colorspace: rgb                                                  
[    0.997252] dst: ip_main                                                     
[    0.997252] stretch window: 720 x 576 (100:0)                                
[    1.014463] mstar-gop 1f246800.gop: window 1:                                
[    1.014463] en: 0                                                            
[    1.014463] addr: 0x00000000                                                 
[    1.014463] hstart: 0, hend 0, vstart: 0, vend: 0                            
[    1.014463] pitch: 0                                                         
[    1.030958] mstar-mop 1f280a00.mopg: MStar MOP                               
[    1.030958] global window size; height: 1920, width: 1080                    
[    1.040896] mstar-mop 1f280a00.mopg: Window dump                             
[    1.040896] enabled: 0                                                       
[    1.040896] yaddr: 0x00000000                                                
[    1.040896] caddr: 0x00000000                                                
[    1.040896] horizontal start: 0, end 0                                       
[    1.040896] vertical start: 0, end 0                                         
[    1.040896] pitch: 0                                                         
[    1.040896] source width: 0, height: 0                                       
[    1.040896] scale horizontal: 4096, vertical: 4096                           
[    1.071898] mstar-mop 1f280a00.mopg: Window dump                             
[    1.071898] enabled: 0                                                       
[    1.071898] yaddr: 0x00000000                                                
[    1.071898] caddr: 0x00000000                                                
[    1.071898] horizontal start: 0, end 0                                       
[    1.071898] vertical start: 0, end 0                                         
[    1.071898] pitch: 0                                                         
[    1.071898] source width: 0, height: 0                                       
[    1.071898] scale horizontal: 4096, vertical: 4096                           
[    1.102892] mstar-mop 1f280a00.mopg: Window dump                             
[    1.102892] enabled: 0                                                       
[    1.102892] yaddr: 0x00000000                                                
[    1.102892] caddr: 0x00000000                                                
[    1.102892] horizontal start: 0, end 0                                       
[    1.102892] vertical start: 0, end 0                                         
[    1.102892] pitch: 0                                                         
[    1.102892] source width: 0, height: 0                                       
[    1.102892] scale horizontal: 4096, vertical: 4096                           
[    1.133894] mstar-mop 1f280a00.mopg: Window dump                             
[    1.133894] enabled: 0                                                       
[    1.133894] yaddr: 0x00000000                                                
[    1.133894] caddr: 0x00000000                                                
[    1.133894] horizontal start: 0, end 0                                       
[    1.133894] vertical start: 0, end 0                                         
[    1.133894] pitch: 0                                                         
[    1.133894] source width: 0, height: 0                                       
[    1.133894] scale horizontal: 4096, vertical: 4096                           
[    1.164878] mstar-mop 1f280a00.mopg: Window dump                             
[    1.164878] enabled: 0                                                       
[    1.164878] yaddr: 0x00000000                                                
[    1.164878] caddr: 0x00000000                                                
[    1.164878] horizontal start: 0, end 0                                       
[    1.164878] vertical start: 0, end 0                                         
[    1.164878] pitch: 0                                                         
[    1.164878] source width: 0, height: 0                                       
[    1.164878] scale horizontal: 4096, vertical: 4096                           
[    1.195875] mstar-mop 1f280a00.mopg: Window dump                             
[    1.195875] enabled: 0                                                       
[    1.195875] yaddr: 0x00000000                                                
[    1.195875] caddr: 0x00000000                                                
[    1.195875] horizontal start: 0, end 0                                       
[    1.195875] vertical start: 0, end 0                                         
[    1.195875] pitch: 0                                                         
[    1.195875] source width: 0, height: 0                                       
[    1.195875] scale horizontal: 4096, vertical: 4096                           
[    1.226856] mstar-mop 1f280a00.mopg: Window dump                             
[    1.226856] enabled: 0                                                       
[    1.226856] yaddr: 0x00000000                                                
[    1.226856] caddr: 0x00000000                                                
[    1.226856] horizontal start: 0, end 0                                       
[    1.226856] vertical start: 0, end 0                                         
[    1.226856] pitch: 0                                                         
[    1.226856] source width: 0, height: 0                                       
[    1.226856] scale horizontal: 4096, vertical: 4096                           
[    1.257849] mstar-mop 1f280a00.mopg: Window dump                             
[    1.257849] enabled: 0                                                       
[    1.257849] yaddr: 0x00000000                                                
[    1.257849] caddr: 0x00000000                                                
[    1.257849] horizontal start: 0, end 0                                       
[    1.257849] vertical start: 0, end 0                                         
[    1.257849] pitch: 0                                                         
[    1.257849] source width: 0, height: 0                                       
[    1.257849] scale horizontal: 4096, vertical: 4096                           
[    1.288829] mstar-mop 1f280a00.mopg: Window dump                             
[    1.288829] enabled: 0                                                       
[    1.288829] yaddr: 0x00000000                                                
[    1.288829] caddr: 0x00000000                                                
[    1.288829] horizontal start: 0, end 0                                       
[    1.288829] vertical start: 0, end 0                                         
[    1.288829] pitch: 0                                                         
[    1.288829] source width: 0, height: 0                                       
[    1.288829] scale horizontal: 4096, vertical: 4096                           
[    1.319826] mstar-mop 1f280a00.mopg: Window dump                             
[    1.319826] enabled: 0                                                       
[    1.319826] yaddr: 0x00000000                                                
[    1.319826] caddr: 0x00000000                                                
[    1.319826] horizontal start: 0, end 0                                       
[    1.319826] vertical start: 0, end 0                                         
[    1.319826] pitch: 0                                                         
[    1.319826] source width: 0, height: 0                                       
[    1.319826] scale horizontal: 4096, vertical: 4096                           
[    1.350805] mstar-mop 1f280a00.mopg: Window dump                             
[    1.350805] enabled: 0                                                       
[    1.350805] yaddr: 0x00000000                                                
[    1.350805] caddr: 0x00000000                                                
[    1.350805] horizontal start: 0, end 0                                       
[    1.350805] vertical start: 0, end 0                                         
[    1.350805] pitch: 0                                                         
[    1.350805] source width: 0, height: 0                                       
[    1.350805] scale horizontal: 4096, vertical: 4096                           
[    1.381795] mstar-mop 1f280a00.mopg: Window dump                             
[    1.381795] enabled: 0                                                       
[    1.381795] yaddr: 0x00000000                                                
[    1.381795] caddr: 0x00000000                                                
[    1.381795] horizontal start: 0, end 0                                       
[    1.381795] vertical start: 0, end 0                                         
[    1.381795] pitch: 0                                                         
[    1.381795] source width: 0, height: 0                                       
[    1.381795] scale horizontal: 4096, vertical: 4096                           
[    1.412776] mstar-mop 1f280a00.mopg: Window dump                             
[    1.412776] enabled: 0                                                       
[    1.412776] yaddr: 0x00000000                                                
[    1.412776] caddr: 0x00000000                                                
[    1.412776] horizontal start: 0, end 0                                       
[    1.412776] vertical start: 0, end 0                                         
[    1.412776] pitch: 0                                                         
[    1.412776] source width: 0, height: 0                                       
[    1.412776] scale horizontal: 4096, vertical: 4096                           
[    1.443763] mstar-mop 1f280a00.mopg: Window dump                             
[    1.443763] enabled: 0                                                       
[    1.443763] yaddr: 0x00000000                                                
[    1.443763] caddr: 0x00000000                                                
[    1.443763] horizontal start: 0, end 0                                       
[    1.443763] vertical start: 0, end 0                                         
[    1.443763] pitch: 0                                                         
[    1.443763] source width: 0, height: 0                                       
[    1.443763] scale horizontal: 4096, vertical: 4096                           
[    1.474749] mstar-mop 1f280a00.mopg: Window dump                             
[    1.474749] enabled: 0                                                       
[    1.474749] yaddr: 0x00000000                                                
[    1.474749] caddr: 0x00000000                                                
[    1.474749] horizontal start: 0, end 0                                       
[    1.474749] vertical start: 0, end 0                                         
[    1.474749] pitch: 0                                                         
[    1.474749] source width: 0, height: 0                                       
[    1.474749] scale horizontal: 4096, vertical: 4096                           
[    1.505734] mstar-mop 1f280a00.mopg: Window dump                             
[    1.505734] enabled: 0                                                       
[    1.505734] yaddr: 0x00000000                                                
[    1.505734] caddr: 0x00000000                                                
[    1.505734] horizontal start: 0, end 0                                       
[    1.505734] vertical start: 0, end 0                                         
[    1.505734] pitch: 0                                                         
[    1.505734] source width: 0, height: 0                                       
[    1.505734] scale horizontal: 4096, vertical: 4096                           
[    1.536944] mstar-mop 1f281000.mops: MStar MOP                               
[    1.536944] global window size; height: 1920, width: 1080                    
[    1.546876] mstar-mop 1f281000.mops: Window dump                             
[    1.546876] enabled: 0                                                       
[    1.546876] yaddr: 0x0f000000                                                
[    1.546876] caddr: 0x82000000                                                
[    1.546876] horizontal start: 0, end 0                                       
[    1.546876] vertical start: 0, end 0                                         
[    1.546876] pitch: 0                                                         
[    1.546876] source width: 0, height: 0                                       
[    1.546876] scale horizontal: 128, vertical: 128                             
[    1.579122] dummy-irq: no IRQ given.  Use irq=N                              
[    1.585556] libphy: Fixed MDIO Bus: probed                                   
[    1.590068] usbcore: registered new interface driver rtl8192cu               
[    1.596005] usbcore: registered new interface driver asix                    
[    1.601458] usbcore: registered new interface driver ax88179_178a            
[    1.607627] usbcore: registered new interface driver cdc_ether               
[    1.613515] usbcore: registered new interface driver rndis_host              
[    1.619479] fotg210_hcd: FOTG210 Host Controller (EHCI) Driver               
[    1.625710] need fusbh200 code here 5600                                     
[    1.629682] getting port 0                                                   
[    1.632523] fotg210-hcd 1f284800.uhc: Faraday USB2.0 Host Controller         
[    1.638976] fotg210-hcd 1f284800.uhc: new USB bus registered, assigned bus n1
[    1.646811] fotg210-hcd 1f284800.uhc: irq 61, io mem 0x1f284800              
[    1.662812] fotg210-hcd 1f284800.uhc: USB 2.0 started, EHCI 1.00             
[    1.669935] hub 1-0:1.0: USB hub found                                       
[    1.673771] hub 1-0:1.0: 1 port detected                                     
[    1.678400] usbcore: registered new interface driver cdc_acm                 
[    1.684089] cdc_acm: USB Abstract Control Model driver for USB modems and ISs
[    1.692193] usbcore: registered new interface driver cdc_wdm                 
[    1.697957] usbcore: registered new interface driver usb-storage             
[    1.704094] usbcore: registered new interface driver usbserial_generic       
[    1.710721] usbserial: USB Serial support registered for generic             
[    1.716815] usbcore: registered new interface driver cp210x                  
[    1.722437] usbserial: USB Serial support registered for cp210x              
[    1.728443] usbcore: registered new interface driver option                  
[    1.734075] usbserial: USB Serial support registered for GSM modem (1-port)  
[    1.741187] usbcore: registered new interface driver usb_serial_simple       
[    1.747796] usbserial: USB Serial support registered for carelink            
[    1.753948] usbserial: USB Serial support registered for zio                 
[    1.759693] usbserial: USB Serial support registered for funsoft             
[    1.765767] usbserial: USB Serial support registered for flashloader         
[    1.772171] usbserial: USB Serial support registered for google              
[    1.778162] usbserial: USB Serial support registered for libtransistor       
[    1.784737] usbserial: USB Serial support registered for vivopay             
[    1.790807] usbserial: USB Serial support registered for moto_modem          
[    1.797140] usbserial: USB Serial support registered for motorola_tetra      
[    1.803803] usbserial: USB Serial support registered for novatel_gps         
[    1.810222] usbserial: USB Serial support registered for hp4x                
[    1.816040] usbserial: USB Serial support registered for suunto              
[    1.822008] usbserial: USB Serial support registered for siemens_mpi         
[    1.828994] i2c_dev: i2c /dev entries driver                                 
[    1.833707] Driver for 1-wire Dallas network protocol.                       
[    1.842055] SPI driver fb_ili9340 has no spi_device_id for ilitek,ili9340    
[    1.849132] SPI driver fb_ili9341 has no spi_device_id for ilitek,ili9341    
[    1.856910] msc313-miu 1f202000.miu: Memory type is DDR2, 4 banks and 10 cols
[    1.865419] msc313-miu 1f202000.miu: trcd: 9, trp: 9, tras: 30, trrd: 7, trt9
[    1.874123] SPI driver st-accel-spi has no spi_device_id for st,lis302dl-spi 
[    1.881253] SPI driver st-accel-spi has no spi_device_id for st,lis3lv02dl-al
[    1.888696] SPI driver st-accel-spi has no spi_device_id for st,lis3dh-accel 
[    1.895787] SPI driver st-accel-spi has no spi_device_id for st,lsm330d-accel
[    1.902948] SPI driver st-accel-spi has no spi_device_id for st,lsm330dl-accl
[    1.910205] SPI driver st-accel-spi has no spi_device_id for st,lsm330dlc-acl
[    1.917553] SPI driver st-accel-spi has no spi_device_id for st,lis331dlh-acl
[    1.924887] SPI driver st-accel-spi has no spi_device_id for st,lsm330-accel 
[    1.931969] SPI driver st-accel-spi has no spi_device_id for st,lsm303agr-acl
[    1.939321] SPI driver st-accel-spi has no spi_device_id for st,lis2dh12-accl
[    1.946581] SPI driver st-accel-spi has no spi_device_id for st,lng2dm-accel 
[    1.953654] SPI driver st-accel-spi has no spi_device_id for st,h3lis331dl-al
[    1.961086] SPI driver st-accel-spi has no spi_device_id for st,lis331dl-accl
[    1.969573] sar: int: 7                                                      
[    1.973056] usbcore: registered new interface driver snd-usb-audio           
[    1.980746] NET: Registered PF_INET6 protocol family                         
[    1.987275] Segment Routing with IPv6                                        
[    1.991010] In-situ OAM (IOAM) with IPv6                                     
[    1.995048] NET: Registered PF_PACKET protocol family                        
[    2.000432] Registering SWP/SWPB emulation handler                           
[    2.005554] Loading compiled-in X.509 certificates                           
[    2.028946] debugfs: Directory '1f001000.isp' with parent 'regmap' already p!
[    2.038197] spi-nand spi0.0: Winbond SPI NAND was found.                     
[    2.043553] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, 4
[    2.051768] Opcode 6b                                                        
[    2.054768] mtdblock: MTD device 'spi0.0' is NAND, please consider using UBI.
[    2.064830] 1 fixed-partitions partitions found on MTD device spi0.0         
[    2.071255] Creating 1 MTD partitions on "spi0.0":                           
[    2.076088] 0x0000002c0000-0x000008000000 : "ubi"                            
[    2.111194] random: fast init done                                           
[    2.206010] mtdblock: MTD device 'ubi' is NAND, please consider using UBI bl.
[    2.216886] libphy: MACB_mii_bus: probed                                     
[    2.221203] phy probe                                                        
[    2.224582] macb 1f2a2000.emac eth0: Cadence MACB rev 0x00000000 at 0x1f343c)
[    2.276588] msc313-rsa 1f224480.rsa: in: fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efe0
[    2.291856] msc313-rsa 1f224480.rsa: out: 00000000000000000000000000000000000
[    2.307843] mstar_pm51: probe of 1f002000.mcu failed with error -2           
[    2.314142] remoteproc remoteproc0: releasing pm51                           
[    2.319925] ubi0: attaching mtd1                                             
[    2.808350] ubi0: scanning is finished                                       
[    2.820723] ubi0: attached mtd1 (name "ubi", size 125 MiB)                   
[    2.826326] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes   
[    2.833235] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048    
[    2.840075] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096  
[    2.847084] ubi0: good PEBs: 1002, bad PEBs: 0, corrupted PEBs: 0            
[    2.853203] ubi0: user volume: 5, internal volumes: 1, max. volumes count: 18
[    2.860461] ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image seq6
[    2.869643] ubi0: available PEBs: 0, total reserved PEBs: 1002, PEBs reserve0
[    2.879010] ubi0: background thread "ubi_bgt0d" started, PID 83              
[    2.885457] block ubiblock0_4: created from ubi0:4(rootfs)                   
[    2.891535] cfg80211: Loading compiled-in X.509 certificates for regulatory e
[    2.900221] msc313_rsa_set_pub_key, 270                                      
[    2.904098] msc313_rsa_max_size                                              
[    2.907281] msc313_rsa_encrypt                                               
[    2.910378] msc313-rsa 1f224480.rsa: out: 00000000000000000000000000000000000
[    2.925684] cfg80211: Problem loading in-kernel X.509 certificate (-22)      
[    2.932475] ALSA device list:                                                
[    3.282500]   No soundcards found.                                           
[    3.682829] platform regulatory.0: Direct firmware load for regulatory.db fa2
[    4.682844] cfg80211: failed to load regulatory.db   

@ddB0515
Copy link
Author

ddB0515 commented Nov 18, 2021

I have tried rootfs as squashfs also but it didn't work as you can see example up is for ubifs that I have added to config

+BR2_TARGET_ROOTFS_UBIFS=y
+BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x1f000
+BR2_TARGET_ROOTFS_UBI=y
+BR2_TARGET_ROOTFS_UBI_SUBSIZE=2048

and uploaded via recovery and load it via ubiupdatevol but still won't boot
all what it does is freeze but interesting part is that from logs you can see it is created

[    2.885457] block ubiblock0_4: created from ubi0:4(rootfs)                   

@fifteenhex
Copy link
Owner

Can you see if you can read out the rootfs you've written in the rescue image?
Comparing the output between the rescue image and where it gets stuck might help too.

@ddB0515
Copy link
Author

ddB0515 commented Nov 18, 2021

So I have managed to update kernel to support ubifs as was not supporting it from your config (maybe to add it to config?)
can make PR later if this succeeded :)

CONFIG_UBIFS_FS=y
CONFIG_UBIFS_FS_ADVANCED_COMPR=y
CONFIG_UBIFS_FS_LZO=y
CONFIG_UBIFS_FS_ZLIB=y
CONFIG_UBIFS_FS_ZSTD=y
CONFIG_UBIFS_ATIME_SUPPORT=y
CONFIG_UBIFS_FS_XATTR=y

and now I can mount it in rescue mode

#ubiattach -m 1
[   17.411702] ubi0: attaching mtd1
[   17.848184] ubi0: scanning is finished
[   17.860278] ubi0: attached mtd1 (name "ubi", size 125 MiB)
[   17.865878] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[   17.872787] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[   17.879630] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[   17.886640] ubi0: good PEBs: 1002, bad PEBs: 0, corrupted PEBs: 0
[   17.892764] ubi0: user volume: 5, internal volumes: 1, max. volumes count: 128
[   17.900039] ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 903731617
[   17.909152] ubi0: available PEBs: 0, total reserved PEBs: 1002, PEBs reserved for bad PEB handling: 20
[   17.918551] ubi0: background thread "ubi_bgt0d" started, PID 164

# mount -t ubifs ubi0:rootfs /mnt/rootfs
[  130.550032] UBIFS (ubi0:4): Mounting in unauthenticated mode
[  130.556122] UBIFS (ubi0:4): background thread "ubifs_bgt0_4" started, PID 175
[  130.660993] UBIFS (ubi0:4): UBIFS: mounted UBI device 0, volume 4, name "rootfs"
[  130.668497] UBIFS (ubi0:4): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[  130.678476] UBIFS (ubi0:4): FS size: 87486464 bytes (83 MiB, 689 LEBs), max 2048 LEBs, journal size 9023488 bytes )
[  130.690293] UBIFS (ubi0:4): reserved for root: 0 bytes (0 KiB)
[  130.696191] UBIFS (ubi0:4): media format: w4/r0 (latest is w5/r0), UUID 7D5B09DD-1F56-4579-87A6-46CD578EA551, small
[  130.709029] UBIFS (ubi0:4): full atime support is enabled.

and full list of mounted dir


# ls -la /mnt/rootfs
total 0
drwxr-xr-x   18 root     root          1312 Nov  6  2021 .
drwxr-xr-x   17 root     root           400 Nov  5  2021 ..
drwxr-xr-x    2 root     root          5024 Nov  6  2021 bin
drwxr-xr-x    4 root     root           608 Nov  6  2021 dev
drwxr-xr-x    7 root     root          1856 Nov  6  2021 etc
drwxr-xr-x    3 root     root           232 Nov  6  2021 home
drwxr-xr-x    2 root     root          1408 Nov  6  2021 lib
lrwxrwxrwx    1 root     root             3 Nov  6  2021 lib32 -> lib
lrwxrwxrwx    1 root     root            11 Nov  6  2021 linuxrc -> bin/busybox
drwxr-xr-x    2 root     root           160 Nov  6  2021 media
drwxr-xr-x    2 root     root           160 Nov  6  2021 mnt
drwxr-xr-x    2 root     root           160 Nov  6  2021 opt
drwxr-xr-x    2 root     root           160 Nov  6  2021 proc
drwx------    2 root     root           160 Nov  6  2021 root
drwxr-xr-x    3 root     root           224 Nov  6  2021 run
drwxr-xr-x    2 root     root          3736 Nov  6  2021 sbin
drwxr-xr-x    2 root     root           160 Nov  6  2021 sys
drwxrwxrwt    2 root     root           160 Nov  6  2021 tmp
drwxr-xr-x    7 root     root           544 Nov  6  2021 usr
drwxr-xr-x    4 root     root           672 Nov  6  2021 var

also unmounting works normally

# umount /mnt/rootfs
[  433.419042] UBIFS (ubi0:4): un-mount UBI device 0
[  433.425109] UBIFS (ubi0:4): background thread "ubifs_bgt0_4" stops

so I'm certain that ubifs image creation is valid and works as it should
But still didn't get or succeeded to get load kernel and rootfs :(
Always freeze and there is not so difference in logs

@fifteenhex
Copy link
Owner

Stick clk_ignore_unused into your bootargs.

@ddB0515
Copy link
Author

ddB0515 commented Nov 19, 2021

OMG that WORKED

SOM2D01 now can boot stand-alone without issues with this

setenv bootargs console=ttyS0,115200 ubi.mtd=1 rootfstype=ubifs root=ubi0:rootfs rw clk_ignore_unused init=linuxrc
setenv loadaddr 0x22000000
setenv bootcmd ubi readvol ${loadaddr} kernel 0x800000; bootm ${loadaddr}
saveenv

Thanks a lot for help but curious why do we need that clk_ignore_unused to get it work?
And I'll write detailed procedure from start to finish (with ubifs)
do you want it as Wiki or should I create new tutorial as md file?

@fifteenhex
Copy link
Owner

fifteenhex commented Nov 19, 2021

Thanks a lot for help but curious why do we need that clk_ignore_unused to get it work?

At the line it was getting stuck the kernel is disabling clocks of hardware it thinks are unused. If a clock is actually being used that can cause the system to lock up. Right now we need that because we don't have a perfect clock driver that knows the complete clock tree and the dependencies. That parameter should be in the bootargs in the devicetree but if you override the bootargs from u-boot it's needed there too.

should I create new tutorial as md file?

Create an MD file so it's part of the repo

@ddB0515
Copy link
Author

ddB0515 commented Nov 21, 2021

Closing as is resolved and will all be documented in md file soon

@ddB0515 ddB0515 closed this as completed Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants