1.git拉取最新的buildroot-tiny200开发包;
2.编译buildroot;
3.执行flash-mmc-all.sh烧写SD卡;
cat flash-mmc-all.sh
#!/bin/bash
MMC=/dev/sdb
sudo umount "$MMC"1 "$MMC"2 "$MMC"3
sudo chmod 666 /dev/sdb
dd if=output/images/sysimage-sdcard.img of="$MMC" bs=4k
sync
4.插上SD卡,板子上电,console口打印乱码;此时,插上USB线连接PC机,系统立刻正常启动,进入终端交互;
5.问题来了,没有nand,nor,是不是buildroot-tiny200开发包不支持单独SD启动???请大神帮忙解答
下面贴出spl的源码:
bootargs_common=console=ttyS0,115200 earlyprintk rootwait consoleblank=0 net.ifnames=0 biosdevname=0
mmc_kernel=zImage
mmc_fdt=devicetree.dtb
mmc_ubootpart=1
mmc_bootpart=2
mmc_rootpart=3
nand_fdt_offset=0x80000
nand_fdt_length=0x4000
nand_kernel_offset=0x100000
nand_kernel_length=0x700000
nand_rootpart=3
nand_overlaypart=4
sf_fdt_offset=0x70000
sf_fdt_length=0x10000
sf_kernel_offset=0x80000
sf_kernel_length=0x580000
sf_rootpart=3
sf_overlaypart=4
stderr=serial,vga
stdin=serial
stdout=serial,vga
kernel_addr_r=0x80000000
fdt_addr_r=0x80700000
ramdisk_addr_r=0x80708000
bootm_size=0x1700000
boot_slot_0=empty
boot_slot_1=empty
scan_boot_slot_0=if mmc dev 0; then setenv boot_slot_0 mmc0; fi;
scan_boot_slot_1=if mmc dev 1; then setenv boot_slot_1 mmc1; else if sf probe; then setenv boot_slot_1 spi-nor; else if mtd list; then setenv boot_slot_1 spi-nand; fi; fi; fi;
scan_boot_slot=run scan_boot_slot_0; echo "========================="; echo "Boot Device: ${boot_device}"; echo "Boot Slot 0: ${boot_slot_0}"; echo "Boot Slot 1: ${boot_slot_1}"; echo "=========================";
dfu_wait_timeout=1
mmc_dfu_info=setenv dfu_alt_info "all raw 0x0 0x37000;u-boot raw 0x10 0x7f0;boot part ${dfu_mmc_dev} ${mmc_bootpart};rom part ${dfu_mmc_dev} ${mmc_rootpart};devicetree.dtb fat ${dfu_mmc_dev} ${mmc_bootpart};zImage fat ${dfu_mmc_dev} ${mmc_bootpart}"
nand_dfu_info=all raw 0x0 0x8000000;u-boot raw 0x0 0x80000;dtb raw 0x80000 0x20000;kernel raw 0x100000 0x700000;rom raw 0x800000 0x2000000
nor_dfu_info=all raw 0x0 0x1000000;u-boot raw 0x0 0x70000;dtb raw 0x70000 0x10000;kernel raw 0x80000 0x580000;rom raw 0x600000 0x700000
dfu_mmc=mmc dev ${dfu_mmc_dev}; run mmc_dfu_info; dfu 0 mmc ${dfu_mmc_dev} ${dfu_wait_timeout};
dfu_nand=setenv dfu_alt_info "${nand_dfu_info}"; dfu 0 mtd spi-nand0 ${dfu_wait_timeout};
dfu_nor=setenv dfu_alt_info "${nor_dfu_info}"; dfu 0 sf 0:0 ${dfu_wait_timeout};
dfu_boot=if test "${boot_slot_1}" = "spi-nand"; then echo "DFU waiting on SPI-NAND..."; run dfu_nand; fi; if test "${boot_slot_1}" = "spi-nor"; then echo "DFU waiting on SPI-NOR..."; run dfu_nor; fi; if test "${boot_slot_1}" = "mmc1"; then echo "DFU waiting on MMC1..."; setenv dfu_mmc_dev 1; run dfu_mmc; fi; if test "${boot_slot_1}" = "empty" && test "${boot_slot_0}" = "mmc0"; then echo "DFU waiting on MMC0..."; setenv dfu_mmc_dev 0; run dfu_mmc; fi;
flasher_ptr_counter=0x80000000
flasher_ptr_buffer=0x80000004
flasher_size_buffer=0x800000
flasher_nandimage=sysimage-nand.img
flasher_norimage=sysimage-nor.img
flash_nand=size mmc 0:${mmc_bootpart} ${flasher_nandimage}; setexpr size_image ${filesize}; mw ${flasher_ptr_counter} ${size_image}; mtd erase spi-nand0; flasher_offset=0; while itest *${flasher_ptr_counter} > 0; do if itest ${size_image} > ${flasher_size_buffer}; then blocksize=${flasher_size_buffer}; else blocksize=0x${size_image}; fi; setexpr size_image ${size_image} - ${blocksize}; mw ${flasher_ptr_counter} ${size_image}; load mmc 0:${mmc_bootpart} ${flasher_ptr_buffer} ${flasher_nandimage} ${flasher_size_buffer} ${flasher_offset}; mtd write spi-nand0 ${flasher_ptr_buffer} ${flasher_offset} ${flasher_size_buffer}; setexpr flasher_offset ${flasher_offset} + ${blocksize}; done;
flash_nor=size mmc 0:${mmc_bootpart} ${flasher_norimage}; setexpr size_image ${filesize}; mw ${flasher_ptr_counter} ${size_image}; flasher_offset=0; while itest *${flasher_ptr_counter} > 0; do if itest ${size_image} > ${flasher_size_buffer}; then blocksize=${flasher_size_buffer}; else blocksize=0x${size_image}; fi; setexpr size_image ${size_image} - ${blocksize}; mw ${flasher_ptr_counter} ${size_image}; load mmc 0:${mmc_bootpart} ${flasher_ptr_buffer} ${flasher_norimage} ${flasher_size_buffer} ${flasher_offset}; sf update ${flasher_ptr_buffer} ${flasher_offset} ${flasher_size_buffer}; setexpr flasher_offset ${flasher_offset} + ${blocksize}; done;
flasher_boot=if test -e mmc 0:${mmc_bootpart} ${flasher_norimage}; then if test "${boot_slot_1}" = "spi-nor"; then echo "Flashing SPI-NOR from MMC0..."; run flash_nor; run nor_boot; fi; fi; if test -e mmc 0:${mmc_bootpart} ${flasher_nandimage}; then if test "${boot_slot_1}" = "spi-nand"; then echo "Flashing SPI-NAND from MMC0..."; run flash_nand; run nand_boot; fi; fi;
genbootargs=setenv bootargs ${bootargs_common} root=${rootdev} ${overlayfs_config}
fel_boot=echo "Booting from FEL..."; rootdev=/dev/ram0; run genbootargs; bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r};
mmc_boot=mmc dev ${devnum}; echo "Booting from MMC${devnum}..."; rootdev=/dev/mmcblk${devnum}p${mmc_rootpart}; run genbootargs; load mmc ${devnum}:${mmc_bootpart} $kernel_addr_r ${mmc_kernel}; load mmc ${devnum}:${mmc_bootpart} ${fdt_addr_r} ${mmc_fdt}; bootz ${kernel_addr_r} - ${fdt_addr_r};
nor_boot=echo "Booting from SPI-NOR..."; sf probe; sf read ${fdt_addr_r} ${sf_fdt_offset} ${sf_fdt_length}; sf read ${kernel_addr_r} ${sf_kernel_offset} ${sf_kernel_length}; rootdev=/dev/mtdblock${sf_rootpart}; overlayfs_config="overlayfsdev=/dev/mtdblock${sf_overlaypart}"; run genbootargs; bootz ${kernel_addr_r} - ${fdt_addr_r};
nand_boot=echo "Booting from SPI-NAND..."; mtd read spi-nand0 ${fdt_addr_r} ${nand_fdt_offset} ${nand_fdt_length}; mtd read spi-nand0 ${kernel_addr_r} ${nand_kernel_offset} ${nand_kernel_length}; rootdev=/dev/mtdblock${nand_rootpart}; overlayfs_config="overlayfsdev=/dev/mtdblock${nand_overlaypart}"; run genbootargs; bootz ${kernel_addr_r} - ${fdt_addr_r};
nor_nand_boot=if test "${boot_slot_1}" = "spi-nor"; then run nor_boot; fi; if test "${boot_slot_1}" = "spi-nand"; then run nand_boot; fi;
bootcmd_fel=if test "${boot_device}" = "fel"; then run fel_boot; fi;
bootcmd_dfu=if test "${boot_device}" != "mmc0" || test "${boot_slot_1}" = "empty"; then run dfu_boot; fi;
bootcmd_flasher=if test "${boot_device}" = "mmc0"; then run flasher_boot; fi;
bootcmd_mmc0=if test "${boot_device}" = "mmc0"; then devnum=0; run mmc_boot; fi;
bootcmd_mmc1=if test "${boot_device}" = "mmc1"; then devnum=1; run mmc_boot; fi;
bootcmd_spi=if test "${boot_device}" = "spi"; then run nor_nand_boot; fi;
bootcmd_ums=if test "${boot_slot_0}" = "mmc0"; then echo "Emulating SD Reader on MMC0..."; ums 0 mmc 0:0; fi;
boot_targets=fel dfu flasher mmc0 mmc1 spi ums
bootcmd=run scan_boot_slot; for target in ${boot_targets}; do run bootcmd_${target}; done
下面是插上USB_device线,系统正常启动的打印
U-Boot SPL 2020.07 (Nov 01 2020 - 01:02:04 +0800)
DRAM: 64 MiB
Trying to boot from MMC1
U-Boot 2020.07 (Nov 01 2020 - 01:02:04 +0800) Allwinner Technology
CPU: Allwinner F Series (SUNIV)
Model: Allwinner F1C200s Generic Device
DRAM: 64 MiB
MMC: mmc@1c0f000: 0
Setting up a 960x320 lcd console (overscan 0x0)
In: serial
Out: vga
Err: vga
Allwinner mUSB OTG (Peripheral)
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
=========================
Boot Device: mmc0
Boot Slot 0: mmc0
Boot Slot 1: empty
=========================
DFU waiting on MMC0...
switch to partitions #0, OK
mmc0 is current device
musb-hdrc: peripheral reset irq lost!
switch to partitions #0, OK
mmc0 is current device
Booting from MMC0...
4317552 bytes read in 700 ms (5.9 MiB/s)
15845 bytes read in 6 ms (2.5 MiB/s)
## Flattened Device Tree blob at 80700000
Booting using the fdt blob at 0x80700000
Loading Device Tree to 816f9000, end 816ffde4 ... OK
Cannot setup simplefb: node not found
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
....................................正常启动部分省略
下面是进入uboot的打印:
U-Boot SPL 2020.07 (Nov 01 2020 - 01:02:04 +0800)
DRAM: 64 MiB
Trying to boot from MMC1
U-Boot 2020.07 (Nov 01 2020 - 01:02:04 +0800) Allwinner Technology
CPU: Allwinner F Series (SUNIV)
Model: Allwinner F1C200s Generic Device
DRAM: 64 MiB
MMC: mmc@1c0f000: 0
Setting up a 800x480 lcd console (overscan 0x0)
In: serial
Out: vga
Err: vga
Allwinner mUSB OTG (Peripheral)
Hit any key to stop autoboot: 0
=>
=> printenv bootargs_common
bootargs_common=console=ttyS0,115200 earlyprintk rootwait consoleblank=0 net.ifnames=0 biosdevname=0
=> pr
printenv protect
=> printenv bootcmd
bootcmd=run scan_boot_slot; for target in ${boot_targets}; do run bootcmd_${target}; done
=>
离线
请aodzip大神,mango大神,晕哥大神,现身说法,传道授业解惑
离线
长篇大论没看懂, 一句话说清楚吧
问题:buildroot-tiny200开发包不支持单独使用SD启动?
离线
我想要实现:SD卡引导系统启动,不依赖于USB,nand,nor,请路过的大神帮忙!
①linux用dd烧录到TF卡
②windows用win32diskimager烧录到TF卡
这两个方法已经试过了,不能单独引导启动,必须插上USB-device线连接PC;
请看uboot打印中有个“Allwinner mUSB OTG (Peripheral)”
离线
这和插usb没有关系吧,又不涉及到nand或者nor,你串口打印乱码是不是你的设备没有和电脑共地?接上usb之后因为共地所以才显示正常了?你设备树控制个led不接串口应该可以启动吧?测试下咯。
大神,你说得对,接地不好导致的,膜拜!!
离线