szemzoa / awboot

small linux bootloader for Allwinner T113-S3 and V851s
72 stars 33 forks source link

Loading from sd card is extremely slow. #21

Open angelovAlex opened 1 year ago

angelovAlex commented 1 year ago

Followed the instructions of how to load from sd card. Speed test seems to be fast but actual reading is very slow. Takes about 20-30 seconds to start kernel.


[D] DRAM BOOT DRIVE INFO: V0.24
[D] DRAM CLK = 792 MHz
[D] DRAM Type = 3 (2:DDR2,3:DDR3)
[D] DRAMC read ODT off
[D] ZQ value = 0x12e
[D] DDR efuse: 0xa
[D] chip id efuse: 0x6000
[D] single rank and full DQ
[D] DDR efuse: 0xa
[D] chip id efuse: 0x6000
[D] rank 0 row = 13 
[D] para->dram_para1 = 0x10d2
[D] rank 0 bank = 8 
[D] para->dram_para1 = 0x10d2
[D] rank 0 page size = 2 KB 
[D] para->dram_para1 = 0x10d2
[D] DRAM ODT value: 0x42
[D] DDR efuse: 0xa
[D] chip id efuse: 0x6000
[D] DRAM: size = 128MB
[D] DRAM: simple test OK
[I] SMHC: sdhci0 controller v50310 initialized
[D] SMHC: capacity 8.1GB
[I] SHMC: SD card detected
[D] SDMMC: speedtest 512KB in 28ms at 18724KB/S
[D] FATFS: mount OK
[I] FATFS: read sunxi.dtb addr=44000000
[D] FATFS: read in 1344ms at 0.04MB/S
[I] FATFS: read zImage addr=44800000
[D] FATFS: read in 18634ms at 0.21MB/S
[D] FATFS: unmount OK
[D] FATFS: done in 21252ms
[I] booting linux...
[    0.000000] Booting Linux on physical CPU 0x0```
fpoussin commented 1 year ago

It's probably caused by your filesystem fragmentation or total files size. Comment this to disable caching: https://github.com/szemzoa/awboot/blob/6ea4ae4ad7a558ad952fefee1942e260aea1a69f/board.h#L13

You can also try a smaller value like 8.

olegk0 commented 1 year ago

same problem increasing the frequency of MMC helped a little in board.c .clock = MMC_CLK_50M, to .clock = MMC_CLK_150M,

now [D] SDMMC: speedtest 512KB in 12ms at 43690KB/S [D] FATFS: read in 8085ms at 0.67MB/S

after disable CONFIG_FATFS_CACHE_SIZE and .clock = MMC_CLK_150M, [D] FATFS: read in 454ms at 11.97MB/S

disable CONFIG_FATFS_CACHE_SIZE and .clock = MMC_CLK_50M, [D] FATFS: read in 607ms at 8.95MB/S

fpoussin commented 1 year ago

You'll have to fine-tune the cache size based on file size if you want the best performance, otherwise just leave it disabled. I might make it dynamic based on the file size at some point.

dave4445 commented 8 months ago

FYI: https://github.com/szemzoa/awboot/pull/34