szemzoa / awboot

small linux bootloader for Allwinner T113-S3 and V851s
73 stars 34 forks source link

v851s can't start the Kernel #37

Closed voloviq closed 1 week ago

voloviq commented 1 month ago

Hello,

I have a small request and question about awboot and the Linux Kernel.

I compiled the awboot branch next and uploaded the code into Allwinner V851s Yuzuki board.

The awboot started well but the Linux Kernel won't start.

[D] periph0 has been enabled
[D] sunxi clock init end
[D] cpu clk reg (#0x500): 0x3000301

[I] AWBoot r6749 starting...
[D] DRAM BOOT DRIVE INFO: V0.24
[D] DRAM CLK = 528 MHz
[D] DRAM Type = 2 (2:DDR2,3:DDR3)                                                        
[D] DRAMC read ODT off                                                                   
[D] ZQ value = 0x2f                                                                      
[D] single rank and full DQ                                                              
[D] rank 0 row = 13                                                                      
[D] para->dram_para1 = 0xd2
[D] rank 0 bank = 4 
[D] para->dram_para1 = 0xd2
[D] rank 0 page size = 2 KB 
[D] para->dram_para1 = 0xd2
[D] DRAM ODT off
[D] DRAM: size = 64MB
[D] DRAM: simple test OK
[I] DRAM size: 64MB
[D] CLK: CPU CLK_reg=0x3000301
[D] CLK: CPU PLL=PLL_CPU FREQ=1200MHz
[D] CLK: PLL_peri (2X)=1200MHz, (1X)=600MHz, (800M)=800MHz                                                                                
[D] CLK: PLL_ddr=1056MHz                                                                                                                  
[I] SMHC: sdhci0 controller v50400 initialized                                                                                            
[D] SMHC: capacity 15.9GB                                                                                                                 
[I] SHMC: SD card detected                                                                                                                
[D] SDMMC: speedtest 512KB in 68ms at 7710KB/S                                                                                            
[D] EXT2FS: found on partition 0                                                                                                          
[D] EXT2FS mount success                                                                                                                  
[D] EXT2FS: mount OK                                                                                                                      
[I] EXT2FS: read /boot/sun8i-v851s-lizard.dtb addr=41000000                                                                               
[I] EXT2FS: read /boot/zImage addr=43000000                                                                                               
[D] EXT2FS: unmount OK                                                                                                                    
[D] EXT2FS: done in 1046ms                                                                                                                
[I] setup bootargs: mem=64M cma=4M root=/dev/mmcblk0p1 init=/sbin/init console=ttyS0,115200 console=/dev/tty0 rootwait                    
[I] booting linux... 

I use the official Linux Kernel 6.6.40 tarball with You patch. The Kernel compiled well. Maybe You have some idea what can be wrong. Can You also share Your defconfig for the Kernel, please?

Thanks for any advise. BR Michał

szemzoa commented 1 month ago

Hi,

Maybe you use another serial port, not the ttyS0? Try to add an early serial console to your bootargs on your proper uart, something like: earlyprintk=sunxi-uart,0x02500800 (for ttyS2, 0x02500000 for ttyS0)

linux-6.9.0.config.txt

voloviq commented 1 month ago

I modified You patch to uncomment and of course comment current records

+               stdout-path = "serial0:115200n8";
+/*             stdout-path = "serial2:115200n8"; */
+               bootargs = "mem=64M cma=4M root=/dev/mmcblk0p2 init=/sbin/init console=ttyS0,115200 earlyprintk=sunxi-uart,0x02500000 rootwait clk_ignore_unused";

but still kernel not start.

I will try later today recompile the Kernel with Your config. I let You know.

PS. I have a board with console on the UART0.

Thanks for now BR Michał

voloviq commented 1 month ago

Hi,

Unfortunately, nothing helps, nothing on the serial port and the Heartbeat LED doesn't work either. I also go back to fat partition instead of ext2 but also without success.

I believe there must be something in 'abwoot' branch 'next'. Did You check it on real hardware? There is something I need to change in 'awboot' code, maybe I forgot to define something?

Can You suggest me something ?

Thanks for any help. BR Michał

szemzoa commented 1 month ago

I can test it on the next week

voloviq commented 1 month ago

Perfect, thanks.

szemzoa commented 1 month ago

Hi,

I cloned the next branch straight from github, compiled, downloaded the latest kernel, patched (there are a few errors as I see, the ccu-v853.h is there twice, and the pwm isnt compiled, so I disabled that) and tried to boot from spi-nand and ext2fs, boot are OK.

spi-nand [1], ext2fs [2].

[1]: [I] AWBoot r6747 starting... [D] DRAM BOOT DRIVE INFO: V0.24 [D] DRAM CLK = 528 MHz [D] DRAM Type = 2 (2:DDR2,3:DDR3) [D] DRAMC read ODT off [D] ZQ value = 0x2f [D] single rank and full DQ [D] rank 0 row = 13 [D] para->dram_para1 = 0xd2 [D] rank 0 bank = 4 [D] para->dram_para1 = 0xd2 [D] rank 0 page size = 2 KB [D] para->dram_para1 = 0xd2 [D] DRAM ODT off [D] DRAM: size = 64MB [D] DRAM: simple test OK [I] DRAM size: 64MB [D] CLK: CPU CLK_reg=0x3000301 [D] CLK: CPU PLL=PLL_CPU FREQ=1200MHz [D] CLK: PLL_peri (2X)=1200MHz, (1X)=600MHz, (800M)=800MHz [D] CLK: PLL_ddr=1056MHz [D] DMA: init [D] DMA: test OK in 27ms [D] SPI: init [D] SPI: set clock asked=75MHz actual=75MHz mclk=300MHz [D] SPI-NAND: enable Quad mode [I] SPI-NAND: FS35SQA001G detected [D] SPI-NAND: dt blob: Copy from 0x00020000 to 0x41000000 size:0x000050fa [I] SPI-NAND: read dt blob of size 20730 at 16.00MB/S [D] SPI-NAND: Image: Copy from 0x00040000 to 0x43000000 size:0x004c16f0 [I] SPI-NAND: read Image of size 4986608 at 17.00MB/S [I] setup bootargs: mem=64M cma=4M root=/dev/mmcblk0p1 init=/sbin/init console=ttyS2,115200 console=/dev/tty0 rootwait [I] booting linux... [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 6.10.2 (root@devel) (arm-linux-gnueabihf-gcc (Linaro GCC 6.3-2017.05) 6.3.1 20170404, GNU ld (Linaro_Binutils-2017.05) 2.27.0.20161019) #1 SMP PREEMPT Tue Jul 30 11:58:51 CEST 2024 [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=50c5387d [ 0.000000] CPU: div instructions available: patching division code [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] OF: fdt: Machine model: Yuzuki-lizard [ 0.000000] Memory policy: Data cache writealloc [ 0.000000] OF: reserved mem: 0x43efd000..0x43efdfff (4 KiB) nomap non-reusable riscv_vring0@43efd000 [ 0.000000] OF: reserved mem: 0x43efe000..0x43efefff (4 KiB) nomap non-reusable riscv_vring1@43efe000 [ 0.000000] OF: reserved mem: 0x43eff000..0x43efffff (4 KiB) nomap non-reusable riscv_buffer0@43eff000 [ 0.000000] Reserved memory: created DMA memory pool at 0x43f00000, size 1 MiB [ 0.000000] OF: reserved mem: initialized node riscv0@43f00000, compatible id shared-dma-pool [ 0.000000] OF: reserved mem: 0x43f00000..0x43ffffff (1024 KiB) nomap non-reusable riscv0@43f00000 [ 0.000000] cma: Reserved 4 MiB at 0x43a00000 on node -1 [ 0.000000] Zone ranges: [ 0.000000] Normal [mem 0x0000000040000000-0x0000000043efcfff] [ 0.000000] HighMem [mem 0x0000000043efd000-0x0000000043ffffff] [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000040000000-0x0000000043efcfff] [ 0.000000] node 0: [mem 0x0000000043efd000-0x0000000043ffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x0000000043ffffff] [ 0.000000] percpu: Embedded 11 pages/cpu s16148 r8192 d20716 u45056 [ 0.000000] Kernel command line: mem=64M cma=4M root=/dev/mmcblk0p1 init=/sbin/init console=ttyS2,115200 console=/dev/tty0 rootwait

[2]: [I] AWBoot r6748 starting... [D] DRAM BOOT DRIVE INFO: V0.24 [D] DRAM CLK = 528 MHz [D] DRAM Type = 2 (2:DDR2,3:DDR3) [D] DRAMC read ODT off [D] ZQ value = 0x12f [D] single rank and full DQ [D] rank 0 row = 13 [D] para->dram_para1 = 0xd2 [D] rank 0 bank = 4 [D] para->dram_para1 = 0xd2 [D] rank 0 page size = 2 KB [D] para->dram_para1 = 0xd2 [D] DRAM ODT off [D] DRAM: size = 64MB [D] DRAM: simple test OK [I] DRAM size: 64MB [D] CLK: CPU CLK_reg=0x3000301 [D] CLK: CPU PLL=PLL_CPU FREQ=1200MHz [D] CLK: PLL_peri (2X)=1200MHz, (1X)=600MHz, (800M)=800MHz [D] CLK: PLL_ddr=1056MHz [I] SMHC: sdhci0 controller v50400 initialized [D] SMHC: capacity 15.9GB [I] SHMC: SD card detected [D] SDMMC: speedtest 512KB in 70ms at 7489KB/S [D] EXT2FS: found on partition 0 [D] EXT2FS mount success [D] EXT2FS: mount OK [I] EXT2FS: read /boot/sun8i-v851s-lizard.dtb addr=41000000 [I] EXT2FS: read /boot/zImage addr=43000000 [D] EXT2FS: unmount OK [D] EXT2FS: done in 703ms [I] setup bootargs: mem=64M cma=4M root=/dev/mmcblk0p1 init=/sbin/init console=ttyS2,115200 console=/dev/tty0 rootwait [I] booting linux... [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 6.10.2 (root@devel) (arm-linux-gnueabihf-gcc (Linaro GCC 6.3-2017.05) 6.3.1 20170404, GNU ld (Linaro_Binutils-2017.05) 2.27.0.20161019) #1 SMP PREEMPT Tue Jul 30 11:58:51 CEST 2024 [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=50c5387d [ 0.000000] CPU: div instructions available: patching division code [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] OF: fdt: Machine model: Yuzuki-lizard [ 0.000000] Memory policy: Data cache writealloc [ 0.000000] OF: reserved mem: 0x43efd000..0x43efdfff (4 KiB) nomap non-reusable riscv_vring0@43efd000 [ 0.000000] OF: reserved mem: 0x43efe000..0x43efefff (4 KiB) nomap non-reusable riscv_vring1@43efe000 [ 0.000000] OF: reserved mem: 0x43eff000..0x43efffff (4 KiB) nomap non-reusable riscv_buffer0@43eff000 [ 0.000000] Reserved memory: created DMA memory pool at 0x43f00000, size 1 MiB [ 0.000000] OF: reserved mem: initialized node riscv0@43f00000, compatible id shared-dma-pool [ 0.000000] OF: reserved mem: 0x43f00000..0x43ffffff (1024 KiB) nomap non-reusable riscv0@43f00000 [ 0.000000] cma: Reserved 4 MiB at 0x43a00000 on node -1 [ 0.000000] Zone ranges: [ 0.000000] Normal [mem 0x0000000040000000-0x0000000043efcfff] [ 0.000000] HighMem [mem 0x0000000043efd000-0x0000000043ffffff] [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000040000000-0x0000000043efcfff] [ 0.000000] node 0: [mem 0x0000000043efd000-0x0000000043ffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x0000000043ffffff] [ 0.000000] percpu: Embedded 11 pages/cpu s16148 r8192 d20716 u45056 [ 0.000000] Kernel command line: mem=64M cma=4M root=/dev/mmcblk0p1 init=/sbin/init console=ttyS2,115200 console=/dev/tty0 rootwait

voloviq commented 1 month ago

Many thanks,

The GCC compiler version I used may be wrong. I see in Your log that You use GCC 6.3 I used GCC 12. This may be an issue. I try the older version.

Once again many thanks.

BR Michal

voloviq commented 4 weeks ago

Unfortunately it isn't gcc problem. Maybe my compilation syntax is wrong.

make -j8 ARCH=arm CROSS_COMPILE=/home/mw/toolchains/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- LOADADDR=0x80008000 dtbs zImage modules

Can You please try my compiled zImage and dtb.

v851s-lizard.zip

szemzoa commented 4 weeks ago

v851-linux.zip

No, I compile the kernel like this: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j11

ps: This is a ext2/4 fs version on the first partition (mmcblk0p1), kernel and dtb on ext2fs in the /boot/ folder.

voloviq commented 3 weeks ago

Unfortunately, I can't break this topic.

Based on the awboot next branch plus my patch for Yocto I publicated the meta layer. If You have some time please compile a write to sd-card. At the present moment, I have no idea what can be wrong.

Link to meta layer git@github.com:voloviq/meta-yuzukilizard-v851s.git

my final log

[I] AWBoot r6776 starting...
[D] DRAM BOOT DRIVE INFO: V0.24
[D] DRAM CLK = 528 MHz
[D] DRAM Type = 2 (2:DDR2,3:DDR3)
[D] DRAMC read ODT off
[D] ZQ value = 0x12f
[D] single rank and full DQ
[D] rank 0 row = 13 
[D] para->dram_para1 = 0xd2
[D] rank 0 bank = 4 
[D] para->dram_para1 = 0xd2
[D] rank 0 page size = 2 KB 
[D] para->dram_para1 = 0xd2
[D] DRAM ODT off
[D] DRAM: size = 64MB
[D] DRAM: simple test OK
[I] DRAM size: 64MB
[D] CLK: CPU CLK_reg=0x3000301
[D] CLK: CPU PLL=PLL_CPU FREQ=1200MHz
[D] CLK: PLL_peri (2X)=1200MHz, (1X)=600MHz, (800M)=800MHz
[D] CLK: PLL_ddr=1056MHz
[I] SMHC: sdhci0 controller v50400 initialized
[D] SMHC: capacity 16.0GB
[I] SHMC: SD card detected
[D] SDMMC: speedtest 512KB in 73ms at 7182KB/S
[I] FATFS: cache: 16777216 bytes in 512 chunks
[D] FATFS: mount OK
[I] FATFS: read sun8i-v851s-lizard.dtb addr=41000000
[D] FATFS: read in 7ms at 1.93MB/S
[I] FATFS: read zImage addr=43000000
[D] FATFS: read in 1000ms at 4.77MB/S
[D] FATFS: unmount OK
[D] FATFS: done in 1041ms
[I] setup bootargs: mem=64M cma=4M root=/dev/mmcblk0p2 init=/sbin/init console=ttyS0,115200 console=/dev/tty0 rootwait
[I] booting linux...

That's all - no LED heartbeat blinking and no log on UART0.

voloviq commented 2 weeks ago

Can You provide me a link to kernel You use during compilation?

PS. Do You have only one partition I mean zImage and dtb is located in /boot of main rootfs?

Thanks

szemzoa commented 2 weeks ago

I use the official latest 'vanilla' kernel from kernel.org, with the patches here for v851s, nothing fancy. I use the PE12/13 pins (uart2) for debug purposes, because I use usb-ethernet converter on USB, with alpine linux.

https://pastebin.com/TAbJzKwf

I have uploaded (a working for me TM:) compiled kernel and DTB, what should work for you too with unmodified awboot settings for yuzuki-lizard board. You seems to modified the bootargs for uart0 (console=ttyS0,115200). Did you tried the unmodified awboot with my compiled kernel and DTB on yuzuki-lizard board with a TTL-USB adapter connected to PE12/13?

Are we still talking about awboot here?

voloviq commented 1 week ago

Hi András ,

I resolved problem. The problem lie in hardware. I needed reduce CPU speed from 1.2GH to 0.9G. Now all of my kernels work well. In my opinion You get a better CPU which support 1.2GHz.

//xxx#define CONFIG_CPU_FREQ 1200000000
#define CONFIG_CPU_FREQ 900000000

I think issue can be closed.

szemzoa commented 1 week ago

Hi,

Great news, and good catch! I'll modify the default settings back to 900MHz, so others will not run into this problem. Glad to hear you have a working setup now!