自制F1C200S demo板(四、TF卡启动)

        思来想去,发现使用SIPFLASH也不是百分百完美,也终于明白为何最小demo板要首推TF卡启动了。

        主要是现在想学Linux驱动,但使用SPIFLASH就需要用uboot和kernel两个同时打包为一个镜像,这样编译和打包都会影响速度。使用TF卡,就可以把三个板块分开,单独操作而互不干扰。

        这里操作步骤需要摸清楚:1、uboot获取,编译,烧录。2、kernel获取,编译,烧录。3、文件系统搭建。

        获取uboot:git clone https://github.com/Lichee-Pi/u-boot -b nano-v2018.01&&cd u-boot

获取时出现的问题:从网上别人博客里是:git clone https://github.com/Lichee-Pi/u-boot.git -b nano-v2018.01&&cd u-boot,发现获取不到。

解决方法:去掉.git后获取正常。

        编译uboot:make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- licheepi_nano_defconfig

                   make ARCH=arm menuconfig

                  make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j12

编译时出现的问题:make: arm-linux-gnueabi-gcc: Command not found。

解决方法:sudo apt install gcc-arm-linux-gnueabi。

编译时出现的问题:unable to execute 'swig': No such file or directory。

解决方法:sudo apt install swig。

编译时出现的问题:scripts/dtc/pylibfdt/libfdt_wrap.c:149:11: fatal error: Python.h: 没有那个文件或目录。

解决方法:1、查看版本:python -V,2、获取对应文件:sudo apt install python2.7-dev。(这里的2.7要修改为和查看的版本相匹配)

        烧录uboot:sudo dd if=u-boot-tf.bin of=/dev/sdb bs=1024 seek=8

                                sudo cp suniv-f1c100s-licheepi-nano.dtb /media/one/UBOOT/

        拷贝镜像文件:sudo cp tf-zImage /media/one/UBOOT/

        拷贝文件系统:sudo tar -xvf rootfs-tf.tar.gz -C /media/one/rootfs/

需要将TF卡分成两个区:uboot fat16 64M 和 rootfs ext4 (TF卡剩余所有空间)。

        查看磁盘:sudo fdisk -l  和 查看挂载:df|grep sd

        以上烧录使用的是Lichee-pi-nano的标准文件,并未使用我编译的文件,可以正常运行,输出启动参数。

        经过测试,当SPIFLASH和TF卡里都有系统时,优先运行TF卡中系统。

在2021年9月16日,终于指导了uboot和Linux等的关联和基本操作了。虽然前面都在串口调试助手上显示了启动信息,但仔细查看,始终没看到运行kernel。今天终于搞明白了,这三大板块放到TF卡中应该正确操作的流程了。

开机后,串口调试助手上会输出信息,但仅仅是输出uboot的信息,会停留在uboot的命令行。需要在这里使用命令行,配置kernel引导参数,从而执行Linux。

也可以按照uboot传递参数 — 荔枝派Nano 全流程指南 documentation  生成一个boot.scr文件,复制到TF卡的第一分区,就能自动运行LINUX,无需再再串口调试助手中输入这些指令。

以下是串口调试助手完整输出信息,红色部分则是要人为发送的启动信息。


[2021-09-16 12:03:07.143] RX:
U-Boot SPL 2018.01-05679-g013ca457fd (Sep 03 2021 - 09:23:32)
DRAM: 64 MiB
Trying to boot from MMC1

[2021-09-16 12:03:07.311] RX:

U-Boot 2018.01-05679-g013ca457fd (Sep 03 2021 - 09:23:32 +0800) Allwinner Technology

DRAM:  64 MiB

[2021-09-16 12:03:07.842] RX:MMC:   SUNXI SD/MMC: 0

[2021-09-16 12:03:07.918] RX:*** Warning - bad CRC, using default environment

In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  2 
[2021-09-16 12:03:08.942] RX: 1 
[2021-09-16 12:03:09.943] RX: 0 

[2021-09-16 12:03:10.006] RX:switch to partitions #0, OK
mmc0 is current device

[2021-09-16 12:03:10.556] RX:Scanning mmc 0:1...

[2021-09-16 12:03:10.705] RX:reading /suniv-f1c100s-licheepi-nano.dtb
7583 bytes read in 21 ms (352.5 KiB/s)

[2021-09-16 12:03:10.773] RX:starting USB...
No controllers found
USB is stopped. Please issue 'usb start' first.
starting USB...
No controllers found
No ethernet found.
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm-sunxi
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default
No ethernet found.
Config file not found
starting USB...
No controllers found
No ethernet found.
No ethernet found.
=> 
[2021-09-16 12:03:12.310] TX:setenv bootargs console=tty0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw

[2021-09-16 12:03:12.313] RX:setenv bootargs console=tty0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw
=> 
=> 
[2021-09-16 12:03:13.539] TX:load mmc 0:1 0x80C00000 suniv-f1c100s-licheepi-nano.dtb

[2021-09-16 12:03:13.544] RX:load mmc 0:1 0x80C00000 suniv-f1c100s-licheepi-nano.dtb
reading suniv-f1c100s-licheepi-nano.dtb
7583 bytes read in 21 ms (352.5 KiB/s)
=> 
=> 
[2021-09-16 12:03:15.421] TX:load mmc 0:1 0x80008000 zImage

[2021-09-16 12:03:15.424] RX:load mmc 0:1 0x80008000 zImage
reading zImage

[2021-09-16 12:03:15.635] RX:3838016 bytes read in 194 ms (18.9 MiB/s)
=> 
=> 
[2021-09-16 12:03:17.540] TX:bootz 0x80008000 - 0x80C00000

[2021-09-16 12:03:17.543] RX:bootz 0x80008000 - 0x80C00000
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 816fb000, end 816ffd9e ... OK

Starting kernel ...


[2021-09-16 12:03:18.737] RX:[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (one@one-VirtualBox) (gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)) #1 Tue Sep 14 17:09:09 CST 2021
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Nano
[    0.000000] Memory policy: Data cache writeback
[    0.000000] random: fast init done
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=tty0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Memory: 55172K/65536K available (6144K kernel code, 236K rwdata, 1388K rodata, 1024K init, 244K bss, 10364K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc4800000 - 0xff800000   ( 944 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 237 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 245 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000044] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000107] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000634] Console: colour dummy device 80x30
[    0.001547] console [tty0] enabled
[    0.001649] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070270] pid_max: default: 32768 minimum: 301
[    0.070605] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070691] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.072128] CPU: Testing write buffer coherency: ok
[    0.073790] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076353] devtmpfs: initialized
[    0.082594] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.082753] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.083054] pinctrl core: initialized pinctrl subsystem
[    0.085012] NET: Registered protocol family 16
[    0.086414] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.088228] cpuidle: using governor menu
[    0.112653] SCSI subsystem initialized
[    0.113054] usbcore: registered new interface driver usbfs
[    0.113256] usbcore: registered new interface driver hub
[    0.113505] usbcore: registered new device driver usb
[    0.113994] pps_core: LinuxPPS API ver. 1 registered
[    0.114073] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.114196] PTP clock support registered
[    0.114675] Advanced Linux Sound Architecture Driver Initialized.
[    0.116219] clocksource: Switched to clocksource timer
[    0.141314] NET: Registered protocol family 2
[    0.142762] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.142912] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.143002] TCP: Hash tables configured (established 1024 bind 1024)
[    0.143302] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.143408] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.143903] NET: Registered protocol family 1
[    0.145154] RPC: Registered named UNIX socket transport module.
[    0.145261] RPC: Registered udp transport module.
[    0.145309] RPC: Registered tcp transport module.
[    0.145352] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.147636] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.149450] Initialise system trusted keyrings
[    0.150062] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.167180] NFS: Registering the id_resolver key type
[    0.167334] Key type id_resolver registered
[    0.167393] Key type id_legacy registered
[    0.180354] Key type asymmetric registered
[    0.180460] Asymmetric key parser 'x509' registered
[    0.180692] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.180785] io scheduler noop registered
[    0.180833] io scheduler deadline registered
[    0.181596] io scheduler cfq registered (default)
[    0.181690] io scheduler mq-deadline registered
[    0.181743] io scheduler kyber registered
[    0.182841] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[    0.192424] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.354497] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.361118] console [ttyS0] disabled
[    0.381429] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 23, base_baud = 6250000) is a 16550A
[    0.852908] console [ttyS0] enabled
[    0.863244] panel-simple panel: panel supply power not found, using dummy regulator
[    0.872677] SCSI Media Changer driver v0.25 
[    0.880398] m25p80 spi0.0: found w25q256, expected w25q128
[    0.886477] m25p80 spi0.0: w25q256 (32768 Kbytes)
[    0.893635] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.900355] ehci-platform: EHCI generic platform driver
[    0.905917] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.912272] ohci-platform: OHCI generic platform driver
[    0.918003] usbcore: registered new interface driver usb-storage
[    0.924980] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[    0.934113] i2c /dev entries driver

[2021-09-16 12:03:19.352] RX:[    0.996353] sunxi-mmc 1c0f000.mmc: base:0x0db647ea irq:19
[    1.003836] usbcore: registered new interface driver usbhid
[    1.009596] usbhid: USB HID core driver
[    1.031128] NET: Registered protocol family 17
[    1.035884] Key type dns_resolver registered
[    1.042602] Loading compiled-in X.509 certificates
[    1.058564] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739498)
[    1.067512] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc073877c)
[    1.075259] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    1.082015] [drm] No driver support for vblank timestamp query.

[2021-09-16 12:03:19.511] RX:[    1.138455] Console: switching to colour frame buffer device 60x34
[    1.140705] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.142989] mmc0: new high speed SDHC card at address 59b4
[    1.144075] mmcblk0: mmc0:59b4 SD    15.0 GiB 
[    1.146386]  mmcblk0: p1 p2
[    1.208313] sun4i-drm display-engine: fb0:  frame buffer device
[    1.227575] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[    1.249110] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.279822] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.298514] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[    1.321574] hub 1-0:1.0: USB hub found
[    1.332130] hub 1-0:1.0: 1 port detected
[    1.344233] using random self ethernet address
[    1.355304] using random host ethernet address
[    1.367912] usb0: HOST MAC 96:a7:62:ad:40:54
[    1.378730] usb0: MAC 32:68:5e:ee:7c:4e
[    1.389004] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[    1.408933] g_cdc gadget: g_cdc ready
[    1.419690] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.449709] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.468828] ALSA device list:
[    1.478044]   #0: Loopback 1
[    1.487901] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.508671] cfg80211: failed to load regulatory.db
[    1.521906] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities

[2021-09-16 12:03:20.009] RX:[    1.653047] EXT4-fs (mmcblk0p2): recovery complete
[    1.669691] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.690011] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    1.710548] devtmpfs: mounted
[    1.724192] Freeing unused kernel memory: 1024K

[2021-09-16 12:03:20.248] RX:[    1.892543] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered

[2021-09-16 12:03:20.361] RX:Starting logging: 
[2021-09-16 12:03:20.403] RX:OK

[2021-09-16 12:03:20.483] RX:Initializing random number generator... 
[2021-09-16 12:03:20.591] RX:done.

[2021-09-16 12:03:20.710] RX:
Welcome to Lichee Pi
Lichee login: 
[2021-09-16 12:03:26.235] TX:root

[2021-09-16 12:03:26.239] RX:root
Password: 
[2021-09-16 12:03:27.220] TX:licheepi

[2021-09-16 12:03:27.224] RX:

[2021-09-16 12:03:27.283] RX:# 

[2021-09-16 12:03:29.020] TX:poweroff

[2021-09-16 12:03:29.025] RX:poweroff

[2021-09-16 12:03:29.148] RX:# 

[2021-09-16 12:03:29.212] RX:Saving random seed... done.
Stopping logging: 
[2021-09-16 12:03:29.275] RX:OK
umount: devtmpfs busy - remounted read-only

[2021-09-16 12:03:29.403] RX:[   11.047017] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
The system is going down NOW!
Sent SIGTERM to all processes

[2021-09-16 12:03:30.425] RX: Sent SIGKILL to all processes
Requesting system poweroff

[2021-09-16 12:03:31.428] RX:[   13.072847] reboot: System halted
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值