您尚未登录。

#1 Re: 全志 SOC » v3s/s3的H264编码 » 2020-08-22 19:39:40

Rainbow-Pi的sdk是支持spinand的,用的MX35LF1GE4AB。

这几天使用华嵌的S3核心板尝试跑Rainbow-Pi的sdk,但是烧录不上(打包出img来后用tf卡烧录的方式),这个板子是用的emmc,用Rainbow-Pi的sdk没有在上面跑起来,然后把华嵌的S3核心板上emmc替换成MX35LF1GE4AB,也是烧录不上。
然后又尝试去搞一下tina,看到里面有一个r11跟s3 、v3s差不多,都是f35吧,试了一下也是烧录不上。

有哪位大侠用过s3跑官方sdk的么。

下面是华嵌的S3核心板上emmc替换成MX35LF1GE4AB,使用tf卡烧录时的log:

HELLO! BOOT0 is starting!
boot0 version : 4.0.0
boot0 commit : 5bde7999aad829824ac6b80a49dad0a502609447
 
fel flag  = 0x00000000
rtc[0] value = 0x00000000
rtc[1] value = 0x00000000
rtc[2] value = 0x00000000
rtc[3] value = 0x00000000
rtc[4] value = 0x00000000
rtc[5] value = 0x00000000
rtc[6] value = 0x00000000
rtc[7] value = 0x00000000
DRAM DRIVE INFO: V0.7
DRAM Type = 3 (2:DDR2,3:DDR3,6:LPDDR2,7:LPDDR3)
DRAM CLK = 408 MHz
DRAM zq value: 000039bb
DRAM size = 128 MB
dram size =128
card boot number = 0
card no is 0
sdcard 0 line count 4
[mmc]: mmc driver ver 2014-12-10 21:20:39
[mmc]: ***Try SD card 0***
[mmc]: SD/MMC Card: 4bit, capacity: 3840MB
[mmc]: vendor: Man 00000000 Snr 12800003
[mmc]: product: APPSD
[mmc]: revision: 0.0
[mmc]: ***SD/MMC 0 init OK!!!***
sdcard 0 init ok
The size of uboot is 000ac000.
sum=aa12155c
src_sum=aa12155c
Succeed in loading uboot from sdmmc flash.
Ready to disable icache.
Jump to secend Boot.
[      0.306]

U-Boot 2011.09-rc1-00000-g5bde799-dirty (Jun 18 2020 - 09:44:02) Allwinner Technology 

[      0.315]version: 1.1.0
[      0.318]uboot commit : 5bde7999aad829824ac6b80a49dad0a502609447
 
[      0.328]pmbus:   ready
not set main pmu id
axp_probe error
[      0.334]PMU: pll1 408 Mhz,PLL6=600 Mhz
AXI=204 Mhz,AHB=204 Mhz, APB1=102 Mhz 
set power on vol to default
dcdc2_vol = 1200
axp set dcdc2_vol to 1200 failed
dcdc3_vol = 3300
axp set dcdc3_vol to 3300 failed
aldo2_vol = 2500
axp set aldo2_vol to 2500 failed
aldo3_vol = 3000
axp set aldo3_vol to 3000 failed
ldo1_vol = 3300
axp set ldo1_vol to 3300 failed
ldo2_vol = 3000
axp set ldo2_vol to 3000 failed
ldo3_vol = 2800
axp set ldo3_vol to 2800 failed
ldo4_vol = 1800
axp set ldo4_vol to 1800 failed
find power_sply to end
vbus exist
no battery, limit to dc
dram_para_set start
dram_para_set end
[      0.468]DRAM:  128 MiB
relocation Offset is: 0709c000
save config for small mem_size 
Not Found clk pll_de in script 
Not Found clk pll_video1 in script 
Not Found clk pll_video in script 
Not Found clk pll_periph0 in script 
DRV_DISP_Init end
[      0.576]fetch script data boot_disp.output_disp fail
[      0.581]fetch script data boot_disp.output_type fail
[      0.586]fetch script data boot_disp.output_mode fail
[      0.591]fetch script data boot_disp.auto_hpd fail
[      0.596]lcd0_para.lcd_used=0
[disk_read_fs] no the partition
error: open disp_rsl.fex, maybe it is not exist
disp0 device type(0) enable
workmode = 17
storage type = 1
NAND_UbootProbe start
NB1 : enter phy init
NandHwInit: Start Nand Hardware initializing .....
uboot:nand version: 2 25 20150917 1145 
Reg 0x01c20848: 0x3333
Reg 0x01c2085c: 0x55
Reg 0x01c20864: 0x10
uboot nand_request_tx_dma: reqest genernal dma for nand success, 0x47a319b0
request general tx dma channel ok!
uboot nand_request_tx_dma: reqest genernal dma for nand success, 0x47a319cc
request general rx dma channel ok!
SPI nand ID: 0 0
_SearchNandArchi fail
[ERR]NandHwInit: SCN_AnalyzeNandSystem() failed!
NandHwInit: End Nand Hardware initializing ..... FAIL!
NB1 : nand phy init fail
NB1 : enter phy Exit
nand release dma:47a319b0
nand release dma:0
NAND_UbootProbe end: 0xffffffff
try nand fail                                                                                      
[      0.674][mmc]: mmc driver ver 2015-04-13 14:50:00                                             
err: gpio count < =0 ,gpio_count is: 0                                                             
[      0.683][mmc]: get sdc_phy_wipe fail.                                                         
[      0.686][mmc]: get sdc0 sdc_erase fail.                                                       
[      0.690][mmc]: get sdc_2xmode fail  used =  0
[      0.695][mmc]: get sdc_ddrmode fail  used =  0
[      0.700][mmc]: get sdc_f_max fail,use default  50000000Hz
[      0.705][mmc]: get card_line fail,use default card_line 4
[      0.711][mmc]: get sdc_ex_dly_used fail,use default
[      0.716][mmc]: SUNXI SD/MMC: 2
[      2.718][mmc]: mmc 2,update clk failed
[      2.721][mmc]: [mmc]: mmc 2  update clock failed
[      2.727][mmc]: mmc 2 Found fatal err,so no send cmd
[      2.732][mmc]: go idle failed
[      2.735][mmc]: mmc go idle error
[      2.738][mmc]: erase_grp_size:0x0WrBlk * 0x0 = 0x0 Byte
[      2.744][mmc]: secure_feature 0x0
[      2.747][mmc]: secure_removal_type  0x0
MMC init failed
In:    serial
Out:   serial
Err:   serial
--------fastboot partitions--------
mbr not exist
Net:   eth0Warning: failed to set MAC address

[      2.765]Hit any key to stop autoboot:  0 
work mode=0x11
run card sprite
try sprite_led_gpio config
[      2.775]sunxi sprite begin
sunxi sprite error: unable to get firmware start position
sunxi sprite firmware probe fail
sunxi#

#2 Re: 全志 SOC » v3s/s3的H264编码 » 2020-08-12 08:18:39

哇酷小二 说:

感谢楼主分享,期待更新, 并求行车记录仪购买链接.

问了一下店家,已经没有板子了。应该是拆机的散件。

#3 全志 SOC » v3s/s3的H264编码 » 2020-08-11 11:32:51

JinC
回复: 18

零、目的
  搞一下v3s或者s3的H264硬件编解码

一、硬件
1.1 V3S方案
1.1.1 主板
    在x宝上搞了一块v3s的行车记录仪的板子,当时买的是20块钱板子+7块钱邮费,现在降价了 15块钱+7块钱邮费,真的是挺便宜的,
    这里称之为小篮板吧。这个算是标准的v3s官方行车记录仪板子了。
    但是没有这个小蓝板的原理图,下面用逆向跟万用表来搞一下基本的原理图。
   
    引出打印串口看一下启动log,可以看出来用的是camdroid sdk,ar0330 mipi摄像头。
    把小蓝板上的spi norflash拆下来,型号是ic25lp128,用编程器读出里面的8MByte的bin,
    然后截取0x32000~0x39FFF这段保存成sys_config.bin,
    再用sunxi-tools工具里面的bin2fex把sys_config.bin转成sys_config.fex,这个就是板子的实际引脚了,再用万用表验证一下几个关键的点就可以了。   
    没有引出网口来,直接飞线简单的引一下就行。

1.1.2.摄像头
    通过打印跟逆向出来的sys_config.fex看到上面这块板子用是mipi摄像头ar0330,一搜太贵了,得换一个!
    因为mipi的摄像头要用isp配置参数,就找了一下Tina SDK里面看到有现成的ov9732的isp配置(具体isp参数要跟着摄像头、lens来调)
    ov9732是720p方案,30块吧。

1.1.3.lcd
    sys_config.fex里面看到是t27p06,serial RGB,在x宝上买一2.7寸320*240,25块+25邮费,真黑!
    我看DOPI开源摄像头(HI3516/HI3518),里面用的2.4的好像也是可以的,20+10。
          
1.1.4.spinand
    把小蓝板的spi nor换成spi nand, MX35LF1GE4AB, x宝上的散件,6.3块,买了4片包邮
   
    整体飞完线的样子就是这样了:15+7+30+25+25+ 6.3*4
       小篮板
       喇叭、麦克、液晶、摄像头、网口、调试串口

1.2 S3方案:
          华嵌的S3核心板,没有底板,之前搞过一个飞线板子调双网口。等搞完v3s的方案后再来搞吧。

二、SDK及参考资料
2.1 SDK
  晕哥帖子里的 编译索智(Sochip) S3 SDK (zeta) 的37楼有对camdroid zeta 海豚派这几个里面编解码库的对比
  手头上一个官方的camdroid SDK, 里面的摄像头、264编解码、rendor都有,就是有点复杂。
  没有海豚派的sdk、没有S3 的 Zeta sdk,也就没有研究这两个。

  我直接用了一个叫彩虹派的rainbow-pi-sdk的(晕哥帖子有介绍过这个板子),同时把小蓝板的spi nor换成spi nand, MX35LF1GE4AB, x宝上的散件,6.3块。
2.2例子及资料
  这个rainbow-pi-sdk里面没有编解码的例子,但是有编解码的库,

  编解码的例子的话网上搜到一个https://gitee.com/kinglaw/Zeta_Linux_Samples,其实就是Zeta的例子,只看demo_CaptureToEncoding

  资料参考晕哥帖子里提到的【社区逆向出来的编解码器资料】: https://github.com/allwinner-zh/media-codec
  只看media-codec/sunxi-cedarx/doc/ 下的 Video Decoder API.pdf / Video Encoder API.pdf也就够了

三、调试说明
3.1摄像头ov9732
   没有啥好改的,配上了驱动基本没问题,
   使用rainbow-pi-sdk里面自带的app/demo-camera例子就能实现preview(摄像头直接显示到lcd),验证一下摄像头好用,(或者自己用v4l2写一个例子保存yuv文件也行)
   注意lcd比较小,而且这个例子时用yuv软转rgb然后显示到lcd的
   摄像头isp就先不调了。

3.2H264编码
  Zeta_Linux_Samples/demo_CaptureToEncoding,修改一下编出264,主要是看一下sps、pps、i、p,为后面mediastreamer写适配库用。

待续...

#4 Re: 全志 SOC » 荔枝派zero/小智极客S3/V3s使用sunxi-fel 借 u-boot 启动 Linux系统, 无需 spi flash / TF 卡 » 2020-03-12 17:34:21

回复一下前面buildroot编出来转rootfs.cpio.gz.uImage不能启动的问题:
这里重新配一下buildroot,里面Filesystem images ---> 选中cpio the root filesystem (for use as an initial RAM filesystem) 并且 Compression method 选择(gzip)
重新编译完后在buildroot的 out/images/目录下直接有rootfs.cpio.gz
然后用这个文件来加头 mkimage -A arm -T ramdisk -C none -n uInitrd -d ../rootfs.cpio.gz  ../rootfs.cpio.gz.uImage
这样就能正常挂了。
去output/target目录里面手动打cpio再加头出来的rootfs.cpio.gz.uImage没发启动起来。

五、烧写sdnand
接楼上接着进行分区和烧写sdnand
5.0看一下sdnand的信息
我没找到sdnand的数据手册,进入uboot看一下mmcinfo,顺便把mmc擦一下
同3.1.2中方法一样只运行uboot
    sudo ../sunxi-tools/sunxi-fel -p uboot u-boot-sunxi-with-spl.bin.S3 write
进入uboot后
    => mmc list
    SUNXI SD/MMC: 1
    SUNXI SD/MMC: 0 (SD)
    => mmc dev 0
    switch to partitions #0, OK
    mmc0 is current device
    =>
    => mmcinfo 
    Device: SUNXI SD/MMC
    Manufacturer ID: d5
    OEM: 5344
    Name: E1601
    Tran Speed: 50000000
    Rd Block Len: 512
    SD version 1.10
    High Capacity: No
    Capacity: 120.9 MiB
    Bus Width: 1-bit
    Erase Group Size: 512 Bytes
    => mmc erase 0 40000

5.1建分区
按4.4中下载运行全部镜像
我这里是在开发板上直接用命令进行分区,这个pc上fdisk分区有点区别

# fdisk  /dev/mmcblk2
The number of cylinders for this disk is set to 3868.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p
Disk /dev/mmcblk2: 120 MB, 126746624 bytes, 247552 sectors
3868 cylinders, 4 heads, 16 sectors/track
Units: cylinders of 64 * 512 = 32768 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type

Command (m for help): u
Changing display/entry units to sectors

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First sector (16-247551, default 16): 2048
Last sector or +size or +sizeM or +sizeK (2048-247551, default 247551): 18431

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First sector (16-247551, default 16): 18432
Last sector or +size or +sizeM or +sizeK (18432-247551, default 247551): Using default value 247551

Command (m for help): p
Disk /dev/mmcblk2: 120 MB, 126746624 bytes, 247552 sectors
3868 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk2p1    32,0,1      287,3,16          2048      18431      16384 8192K 83 Linux
/dev/mmcblk2p2    288,0,1     1023,3,16        18432     247551     229120  111M 83 Linux

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): L

 0 Empty                  1b Hidden Win95 FAT32     9f BSD/OS                
 1 FAT12                  1c Hidden W95 FAT32 (LBA) a0 Thinkpad hibernation  
 4 FAT16 <32M             1e Hidden W95 FAT16 (LBA) a5 FreeBSD               
 5 Extended               3c Part.Magic recovery    a6 OpenBSD               
 6 FAT16                  41 PPC PReP Boot          a8 Darwin UFS            
 7 HPFS/NTFS              42 SFS                    a9 NetBSD                
 a OS/2 Boot Manager      63 GNU HURD or SysV       ab Darwin boot           
 b Win95 FAT32            80 Old Minix              b7 BSDI fs               
 c Win95 FAT32 (LBA)      81 Minix / old Linux      b8 BSDI swap             
 e Win95 FAT16 (LBA)      82 Linux swap             be Solaris boot          
 f Win95 Ext'd (LBA)      83 Linux                  eb BeOS fs               
11 Hidden FAT12           84 OS/2 hidden C: drive   ee EFI GPT               
12 Compaq diagnostics     85 Linux extended         ef EFI (FAT-12/16/32)    
14 Hidden FAT16 <32M      86 NTFS volume set        f0 Linux/PA-RISC boot    
16 Hidden FAT16           87 NTFS volume set        f2 DOS secondary         
17 Hidden HPFS/NTFS       8e Linux LVM              fd Linux raid autodetect 
Hex code (type L to list codes): b
Changed system type of partition 1 to b (Win95 FAT32)

Command (m for help): p
Disk /dev/mmcblk2: 120 MB, 126746624 bytes, 247552 sectors
3868 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk2p1    32,0,1      287,3,16          2048      18431      16384 8192K  b Win95 FAT32
/dev/mmcblk2p2    288,0,1     1023,3,16        18432     247551     229120  111M 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table
[  402.950685]  mmcblk2: p1 p2
# sync 
# 

说明一下这里在开发板子中直接使用命令见分区与在宿主机上fdsik是有差距的.
分区说明:
    最头上1M用来放uboot,由于这款SDNAND的sector szie是512字节,所以第一个分区前预留1Mbyte/512byte=2048个sector

    然后第一个分区定为8M,这样他的结束就是2048+8Mbyte/512byte  -1 = 18431,
    这里我用+8M没成功,因为开发板上的fdisk貌似是绝对偏移,不是相对的

    第二个分区就是剩下的所有sector,也就是从18432开始到结束,

5.2建文件系统
继续在开发版上有命令

# mk
mkdir     mkdosfs   mke2fs    mkfifo    mknod     mkpasswd  mkswap    mktemp
# mk
-sh: mk: not found
# mkdosfs --help
BusyBox v1.27.2 (2020-03-11 16:31:30 CST) multi-call binary.

Usage: mkdosfs [-v] [-n LABEL] BLOCKDEV [KBYTES]

Make a FAT32 filesystem

        -v      Verbose
        -n LBL  Volume label
# mkdosfs -n 'boot' /dev/mmcblk2p
mmcblk2p1  mmcblk2p2
# mkdosfs -n 'boot' /dev/mmcblk2p1
# mkdosfs -n 'boot' /dev/mmcblk2p1^C
# mke2fs --help
BusyBox v1.27.2 (2020-03-11 16:31:30 CST) multi-call binary.

Usage: mke2fs [-Fn] [-b BLK_SIZE] [-i INODE_RATIO] [-I INODE_SIZE] [-m RESERVED_PERCENT] [-L LABEL] BLOCKDEV [KBYTES]

        -b BLK_SIZE     Block size, bytes
        -F              Force
        -i RATIO        Max number of files is filesystem_size / RATIO
        -I BYTES        Inode size (min 128)
        -L LBL          Volume label
        -m PERCENT      Percent of blocks to reserve for admin
        -n              Dry run
# mke2fs -L 'root' /dev/mmcblk2p2 
Filesystem label=root[  727.997914] random: mke2fs: uninitialized urandom read (16 bytes read)

OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (l[  728.006343] random: mke2fs: uninitialized urandom read (16 bytes read)
og=0)
29040 inodes, 115955 blocks
5797 blocks (5%) reserved for the super user
First data block=1
Maximum filesystem blocks=262144
15 block groups
8192 blocks per group, 8192 fragments per group
1936 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729
[  729.292446] random: crng init done
# 

5.3挂载烧录
在开发班上

# modprobe g_mass_storage file=/dev/mmcblk2 removable=1
[  744.235652] Mass Storage Function, version: 2009/09/11
[  744.240814] LUN: removable file: (no medium)
[  744.245441] LUN: removable file: /dev/mmcblk2
[  744.249800] Number of LUNs=1
[  744.275659] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[  744.282638] g_mass_storage gadget: userspace failed to provide iSerialNumber
[  744.289816] g_mass_storage gadget: g_mass_storage ready
# [  744.787406] g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage

这是时候就能看到ubuntu下能够挂出两个盘 boot 与root
在ubuntun电脑上

$ sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdc bs=1k seek=8
记录了408+1 的读入
记录了408+1 的写出
418642 bytes (419 kB, 409 KiB) copied, 0.0421526 s, 9.9 MB/s
$ cp zImage sun8i-s3-hqembed.dtb /media/pc189/boot/
$ sudo tar xvf rootfs.tar  -C /media/pc189/root/

注意这里的u-boot-sunxi-with-spl.bin为重新编译的bootcmd为使用mmc,bootargs挂载/dev/mmcblk2p2为root 的uboot

至此烧完重启设备正常

#5 Re: 全志 SOC » 荔枝派zero/小智极客S3/V3s使用sunxi-fel 借 u-boot 启动 Linux系统, 无需 spi flash / TF 卡 » 2020-03-12 10:21:10

零、目的
华嵌的S3核心板烧系统到sdnand
使用晕哥的 <<荔枝派zero/小智极客S3/V3s使用sunxi-fel 借 u-boot 启动 Linux系统, 无需 spi flash / TF 卡 by 晕哥>>,直接挂SD_NAND为U盘然后烧录

一、硬件
  华嵌的S3核心板,没有底板,直接核心板上飞线引出5v GND USB+ USB- 调试口UART0
  这块核心板区别于其他开发板 SD NAND是挂在在mmc2上的(PC口sdc2)
   
二、SDK及固件
  华嵌群网盘里提供的uboot(就是 git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-spi-experimental 基础上修改) 及5.1.0的内核

  晕哥帖子里的 v3s_s3_fel_autorun_linux_uart0_pb8_pb9_201905018_spinand_OK.7z

三、分析说明
3.1使用v3s_s3_fel_autorun_linux_uart0_pb8_pb9_201905018_spinand_OK.7z
  3.1.1完整下载
    解压完后利用Run_S3_XiaoZhi.bat里面的命令来下载启动系统,这里及以下我全都是在ubuntu中进行的所以直接用sunxi-tools源码编译后sunxi-fel命令来下载的
   

sudo ../sunxi-tools/sunxi-fel -p uboot u-boot-sunxi-with-spl.bin.S3 write 0x41000000 zImage write 0x41800000 sun8i-v3s-licheepi-zero-dock.dtb.PG9 write 0x41900000 boot_fel_initrd.scr write 0x41A00000 rootfs.cpio.gz.uImage

    串口上的启动信息如下(截取重要的部分):
   

	starting USB...
	No controllers found
	Hit any key to stop autoboot:  0 
	(FEL boot)
	## Executing script at 41900000
	## Loading init Ramdisk from Legacy Image at 41a00000 ...
	   Image Name:   uInitrd
	   Image Type:   ARM Linux RAMDisk Image (uncompressed)
	   Data Size:    2099576 Bytes = 2 MiB
	   Load Address: 00000000
	   Entry Point:  00000000
	   Verifying Checksum ... OK
	## Flattened Device Tree blob at 41800000
	   Booting using the fdt blob at 0x41800000
	   Loading Ramdisk to 42bff000, end 42dff978 ... OK
	   Loading Device Tree to 42bf8000, end 42bfe707 ... OK

	Starting kernel ...
	....
	Initializing random number generator... done.
	Starting network: OK
	[    3.519445] Mass Storage Function, version: 2009/09/11
	[    3.524617] LUN: removable file: (no medium)
	[    3.562885] lun0: unable to open backing file: /dev/mtdblock0
	[    3.568974] g_mass_storage musb-hdrc.1.auto: failed to start g_mass_storage: -2
	[    3.596488] Mass Storage Function, version: 2009/09/11
	[    3.601792] LUN: removable file: (no medium)
	[    3.619020] lun0: unable to open backing file: /dev/mtdblock0
	[    3.624936] g_mass_storage musb-hdrc.1.auto: failed to start g_mass_storage: -2
	modprobe: can't load module g_mass_storage (kernel/drivers/usb/gadget/legacy/g_mass_storage.ko): unknown symbol in module, or unknown parameter

	Welcome to Buildroot
	buildroot login: root
	Password: 
	# ls /dev/m*
	/dev/mem               /dev/memory_bandwidth
	# cat  /etc/init.d/S90mmc0_as_udisk.sh 
	#modprobe g_mass_storage file=/dev/mmcblk0 removable=1
	modprobe g_mass_storage file=/dev/mtdblock0 removable=1
	# 
	

    我们看到登录进入后没有加载mmc2驱动识别sdnand,这样自己手动加载g_mass_storage重指定file也没用

   3.1.2只下载uboot来看一下env
    sudo ../sunxi-tools/sunxi-fel -p uboot u-boot-sunxi-with-spl.bin.S3 write

   

	=> printenv 
	arch=arm
	baudrate=115200
	board=sunxi
	board_name=sunxi
	boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
	boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_i
	boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
	boot_net_usb_start=usb start
	boot_prefixes=/ /boot/
	boot_script_dhcp=boot.scr.uimg
	boot_scripts=boot.scr.uimg boot.scr
	boot_targets=fel mmc0 usb0 pxe dhcp 
	[color=#FF0000]bootcmd=run distro_bootcmd[/color]
	bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; if test ;
	bootcmd_fel=if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then echo '(FEL boot)'; source ${fel_scriptaddr}; fi
	bootcmd_mmc0=setenv devnum 0; run mmc_boot
	bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
	bootcmd_usb0=setenv devnum 0; run usb_boot
	bootdelay=2
	bootm_size=0x2e00000
	console=ttyS0,115200
	cpu=armv7
	dfu_alt_info_ram=kernel ram 0x41000000 0x800000;fdt ram 0x41800000 0x100000;ramdisk ram 0x41B00000 0x1000000
	distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
	efi_dtb_prefixes=/ /dtb/ /dtb/current/
	fdt_addr_r=0x41800000
	fdtcontroladdr=47b562a8
	fdtfile=sun8i-v3s-licheepi-zero.dtb
	fel_booted=1
	kernel_addr_r=0x41000000
	load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
	mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
	preboot=usb start
	pxefile_addr_r=0x41A00000
	ramdisk_addr_r=0x41B00000
	scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_de;
	scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devpliste
	scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; fe
	scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.i
	scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot e
	scriptaddr=0x41900000
	serial#=12c000014a919244
	soc=sunxi
	stderr=serial@01c28000
	stdin=serial@01c28000
	stdout=serial@01c28000
	usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi

	Environment size: 4054/32764 bytes
	=> 
	

   
    注意这里的bootcmd=run distro_bootcmd 以及没有设定bootargs
    然后再看看里面的scriptaddr、fdt_addr_r等几个地址,理解一下boot_fel_initrd.cmd和Run_S3_XiaoZhi.bat这里面几个地址

3.2使用华嵌提供的SDK
    v3s_s3_fel_autorun_linux_uart0_pb8_pb9_201905018_spinand_OK.7z中的boot_fel_initrd.cmd中会设定bootargs,
    所以首先将华嵌给的uboot中sun8i.h里面#define CONFIG_BOOTARGS       "console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk2p2 rw earlyprintk"这句屏蔽
    顺便再理解一下uboot的修改记录:dts里面的关闭spi0打开mmc2并且配好mmc2的管脚、配置文件中配上CONFIG_MMC_SUNXI_SLOT_EXTRA=2

    利用SDK中编出u-boot-sunxi-with-spl.bin、sun8i-s3-hqembed-050ips.dtb、zImage

    结合楼上提问buildroot编译出来的rootfs用不了,这里使用v3s_s3_fel_autorun_linux_uart0_pb8_pb9_201905018_spinand_OK.7z中的
    rootfs.cpio.gz.uImage再加上里面的boot_fel_initrd.scr

    这样就拼凑完了要用的镜像文件,然后同样的下载
   

sudo ../sunxi-tools/sunxi-fel -p uboot u-boot-sunxi-with-spl.bin write 0x41000000 zImage write 0x41800000 sun8i-s3-hqembed-050ips.dtb write 0x41900000 boot_fel_initrd.scr write 0x41A00000 rootfs.cpio.gz.uImage

    看一下启动信息:
   

	...
	starting USB...
	No controllers found
	Hit any key to stop autoboot:  0 
	switch to partitions #0, OK
	mmc1 is current device
	MMC: no card present
	** Bad device mmc 0 **
	MMC: no card present
	** Bad device mmc 0 **
	## Flattened Device Tree blob at 41800000
	   Booting using the fdt blob at 0x41800000
	   Loading Device Tree to 42df9000, end 42dff707 ... OK

	Starting kernel ...
	.....
	[    0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/ram0 rdinit=/linuxrc rw earlyprintk
	....
	[    1.599704] cfg80211: failed to load regulatory.db
	[    1.605126] Waiting for root device /dev/ram0...
	[    1.617593] mmc2: host does not support reading read-only switch, assuming write-enable
	[    1.625824] mmc2: new high speed SD card at address 00c3
	[    1.632978] mmcblk2: mmc2:00c3 E1601 121 MiB 
	[    1.639478]  mmcblk2: p1
	

    我们可以看到bootargs传的对,内核起来后mmc2上也认出了sdnand, 但是卡在了Waiting for root device /dev/ram0...上进行不下去

四、修改
  4.1修改uboot

    此时对比一下3.1与3.2中uboot引导内核时候的打印信息及env,需要修改bootcmd
    将华嵌给的uboot中sun8i.h里面
   
    #define CONFIG_BOOTCOMMAND    "mmc dev 1;fatload mmc 0 $fdt_addr_r $fdtfile;fatload mmc 0 $kernel_addr_r zImage;bootz $kernel_addr_r - $fdt_addr_r"
   

    修改为
   
    #define CONFIG_BOOTCOMMAND    "run distro_bootcmd"
   

   
    别忘了将uboot中sun8i.h里面#define CONFIG_BOOTARGS       "console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk2p2 rw earlyprintk"这句屏蔽

    然后重编出u-boot-sunxi-with-spl.bin,
    再配上3.2中编出的sun8i-s3-hqembed-050ips.dtb、zImage
    v3s_s3_fel_autorun_linux_uart0_pb8_pb9_201905018_spinand_OK.7z中的rootfs.cpio.gz.uImage与boot_fel_initrd.scr

    重新下载运行,看到能正常启动和登录,但有两个问题
   
    mmc2上没有挂载sdnand  ---> 解决见4.2
    modprobe: can't change directory to '5.1.0': No such file or directory 内核版本与rootfs中里面的ko不匹配---> 解决见4.3
   

   
   4.2挂载sdnand
    看一下3.2中当
        CONFIG_BOOTCOMMAND    "mmc dev 1;fatload mmc 0 $fdt_addr_r $fdtfile;fatload mmc 0 $kernel_addr_r zImage;bootz $kernel_addr_r - $fdt_addr_r"
    时能够正常挂载sdnand

    所以修改boot_fel_initrd.cmd,在bootz 0x41000000 0x41A00000 0x41800000前一行mmc dev 1
    然后再mkimage -C none -A arm -T script -d boot_fel_initrd.cmd boot_fel_initrd.cmd.scr 出新的scrpit文件

   4.3重新制作rootfs.cpio.gz.uImage
    用晕哥的v3s_s3_fel_autorun_linux_uart0_pb8_pb9_201905018_spinand_OK.7z中的rootfs.cpio.gz.uImage来逆向

     rootfs.cpio.gz.uImage正向打包的是这样
          cd /opt/buildroot-2018.08.2/output/target
          find . | cpio -o -Hnewc |gzip -9 > ../rootfs.cpio.gz
          mkimage -A arm -T ramdisk -C none -n uInitrd -d ../rootfs.cpio.gz  ../rootfs.cpio.gz.uImage
    逆向:
          mkimage其实就是在原来的文件头上加了0x40个字节的特定头让uboot能引导识别,
          所以先把rootfs.cpio.gz.uImage重命名成bin文件,用随便能编辑bin文件的工具打开,去掉头上的0x40长度的头,再重名文件成rootfs.cpio.gz
          然后gunzip rootfs.cpio.gz出来rootfs.cpio文件,
          再sudo cpio -idmv <rootfs.cpio出来rootfs所有文件
          对这个rootfs补上/dev/concloe /dev/null
          sudo mknod -m 666 console c 5 1
          sudo mknod -m 666 null c 1 3
          这样就提出来了一个完整的rootfs

    替换内核模块:
       删除上面rootfs/lib/modules里面原来的两个内核文件夹,把自己编译的华嵌5.1.0内核模块替换过来

    先屏蔽/etc/init.d/S90mmc0_as_udisk.sh 里面的驱动加载,方便后面调试
    再正向打包生成新的rootfs.cpio.gz.uImage
             
   4.4usb模式
    使用上面
        4.1的u-boot-sunxi-with-spl.bin、
        4.2中的boot_fel_initrd.cmd.scr、
        4.3中的rootfs.cpio.gz.uImage、
        3.2中华嵌5.1.0内核源码编出来的sun8i-s3-hqembed-050ips.dtb与zImage

    下载运行,能识别到sdnand,挂成了/dev/mmcblk2,然后手动
     modprobe g_mass_storage file=/dev/mmcblk2 removable=1
    但是ubuntu电脑上没有任何反应,
    看一下内核sun8i-s3-hqembed-050ips.dts中
    &usb_otg {
    //dr_mode = "otg";
    dr_mode = "host";
    //dr_mode = "peripheral";
    status = "okay";
    };
    我们这里需要usb device模式,将其修改为
    &usb_otg {
    //dr_mode = "otg";
    //dr_mode = "host";
    dr_mode = "peripheral";
    status = "okay";
    };
   
    再重新下载,运行,至此能够在电脑上显示sdnand盘了。

下面就可以用命令来分区和烧写sdnand了

#6 Re: 全志 SOC » 荔枝派zero/小智极客S3/V3s使用sunxi-fel 借 u-boot 启动 Linux系统, 无需 spi flash / TF 卡 » 2020-03-11 16:46:34

晕哥,我用buildroot-2018.02.10编译出rootfs再转换成rootfs.cpio.gz.uImage,替代 v3s_s3_fel_autorun_linux_uart0_pb8_pb9_201905018_spinand_OK.7z里面的rootfs.cpio.gz.uImage,但是内核启动完后就卡住了,用你原来的就可以正常使用。使用的是华嵌的S3核心板。
制作initramfs时buildroot需要什么特殊配置么。

  1.854836] vcc5v0: disabling
[    1.857810] ALSA device list:
[    1.860777]   #0: V3s Audio Codec
[    1.864661] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.873277] cfg80211: failed to load regulatory.db
[    1.879464] Freeing unused kernel memory: 1024K
[    1.884713] Run /linuxrc as init process
[    1.892990] mmc2: host does not support reading read-only switch, assuming write-enable
[    1.906697] mmc2: new high speed SD card at address 00c3
[    1.923229] mmcblk2: mmc2:00c3 E1601 121 MiB
[    1.936051]  mmcblk2: p1

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn