您尚未登录。

#2 Re: 全志 SOC » v3s U-boot启动界面分享 » 2020-12-23 17:59:51

酷友们问个开机logo问题

U-boot配置勾选 Enable graphical uboot console on HDMI, LCD or VGA ,内核就启动不了,uboot启动完之后就不动,但是屏幕logo显示正常,
配置里去掉这个选项就能正常启动,但是屏幕背光有亮,不显示logo,这是什么原因啊(Kernel也使能了logo)

ARM architecture  ---> 
      [勾选] Enable graphical uboot console on HDMI, LCD or VGA 

去掉上面这个配置,uboot启动后屏幕有亮,没有logo,系统也能正常启动,启动内核之后,kernel的logo也能正常显示,
正常应该是uboot和kernel启动都有logo显示

#3 全志 SOC » f1c100s的uboot添加以下选项内核启动不了? » 2020-12-22 10:35:22

L_max
回复: 5

TF启动
uboot:u-boot-nano-lcd800480
Linux:linux-nano-5.2-tf

U-boot只要勾选 Enable graphical uboot console on HDMI, LCD or VGA ,内核就启动不了,去掉就能正常启动,这是什么原因啊

ARM architecture  ---> 

      [勾选] Enable graphical uboot console on HDMI, LCD or VGA 

启动logo

U-Boot SPL 2018.01 (Dec 22 2020 - 10:23:57)
DRAM: 32 MiB
Trying to boot from MMC1


U-Boot 2018.01 (Dec 22 2020 - 10:23:57 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

Setting up a 8x272 lcd console (overscan 0x0)
In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0 
reading zImage
4682720 bytes read in 238 ms (18.8 MiB/s)
reading suniv-f1c100s-licheepi-nano.dtb
6545 bytes read in 25 ms (254.9 KiB/s)
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 80e27000, end 80e2b990 ... OK

Starting kernel ...

#4 Re: 全志 SOC » F1C100S U盘速度 » 2020-12-17 17:38:36

用的Linux5.2,闪迪的U盘,读U盘速度在11.98MB/s,写U盘在4.236MB/s,这速度太慢了,想问下怎么样可以提高U盘读写速度
roll  roll  roll

#5 Re: 全志 SOC » f1c100s usb wifi 和 u盘使用(新手求助) » 2020-12-16 11:58:18

buildroot和kernel没加USB和wifi的一些配置之前烧录是可以启动的,烧录修改后的buildroot和kernel之后启动就没反应了,Buildroot就增加了上面的配置,Linux的就加了USB和wifi的一些配置,Uboot没改,

#6 全志 SOC » f1c100s usb wifi 和 u盘使用(新手求助) » 2020-12-16 11:54:17

L_max
回复: 1

请教下f1c100s usb WiFi 和 u盘的使用以及配置

我参照V3s的buildroot和内核Linux配置,烧录之后没反应,v3s上U盘(闪迪U盘)和usbWiFi( MT7601和RTL8188CU)测试都是可用的

Buildroot配置

Buildroot
       Target packages
                 Hardware handling  --->
                          Firmware
                                    [勾选] linux-firmware
                                                    WiFi firmware  --->
                                                                 [勾选] MediaTek MT7601U
                                                             [勾选] Realtek 88xx
                                                                 [勾选] Realtek 81xx

                 Networking applications  --->
                        添加hostapd,iw,wireless tools,openssh,wpa_supplicant(全选)



Linux配置:


Device Drivers  --->
      [勾选] Staging drivers  ---> <勾选>   Realtek RTL8188EU Wireless LAN NIC driver

Device Drivers  --->
      [勾选] Network device support  --->
             [勾选]   Wireless LAN  --->
                     <勾选> Realtek rtlwifi family of devices  --->
                            <勾选>   Realtek RTL8188EE Wireless Network Adapter

Device Drivers  --->
      [勾选] Network device support  --->
            <勾选>   USB Network Adapters  --->
                          <勾选>   USB RTL8150 based ethernet device support


[勾选] Networking support  ---> 
         --   Wireless  ---> 
                    <勾选>   Generic IEEE 802.11 Networking Stack (mac80211)

#7 Re: 全志 SOC » f1c100s USB上电一直在识别Allwinner USB 设备,不启动 » 2020-12-15 16:00:45

raspberryman 说:

sunxi-fel 根本不管是不是烧录进去,也不校验芯片,你看到的进度条是假象。

估计是没有烧录算法,或者要改代码。

这是哪里出问题了,uboot都没进入,我还是重头再来一次吧,醉了

#8 Re: 全志 SOC » f1c100s USB上电一直在识别Allwinner USB 设备,不启动 » 2020-12-15 15:35:29

打算换个spi flash 了,刚好有w25q128JVSQ,不知道能不能用...

#9 Re: 全志 SOC » f1c100s USB上电一直在识别Allwinner USB 设备,不启动 » 2020-12-15 15:33:31

raspberryman 说:

sunxi-fel spiflash-info

这个命令显示什么呢?

能正常烧录,但是USB重新上电不启动,也没串口也没log,USB又检测到Allwinner USB设备

lrz@lrz-pc:~/licheepiNano/spi_flash_nano/myImagefile$ sudo sunxi-fel spiflash-info
Manufacturer: Unknown (0Bh), model: 40h, size: 16777216 bytes.
lrz@lrz-pc:~/licheepiNano/spi_flash_nano/myImagefile$ sudo sunxi-fel -p spiflash-write 0 f1c100s_spiflash_16M.bin
100% [================================================] 17564 kB,   60.8 kB/s 
lrz@lrz-pc:~/licheepiNano/spi_flash_nano/myImagefile$ sudo sunxi-fel spiflash-info

#10 Re: 全志 SOC » 荔枝派nano的SPI-Flash启动 » 2020-12-15 14:57:37

raspberryman 说:
L_max 说:
raspberryman 说:

用对比软件对比,linux用meld,diffuse, windows用beyond compare

dev下有mtdblock设备了,谢谢

什么问题?

重启下就好了

#11 全志 SOC » f1c100s USB上电一直在识别Allwinner USB 设备,不启动 » 2020-12-15 14:55:22

L_max
回复: 6

短接spi flash 的CS和GND,虚拟机下识别到Allwinner USB 设备,断开spi flash 的CS和GND,烧录固件,

100% [================================================] 17564 kB,   60.8 kB/s 

烧录完成后,USB重新上电,未启动,又检测到Allwinner USB 设备,此时spi flash 的CS和GND是断开的,
重新上电,USB一直都是在识别Allwinner USB 设备,一直启动不了,串口终端也没log,有遇到过这种情况吗spi

spiflash是公板自带的xt25f128,不知道是不是把flash烧坏了

#12 Re: 全志 SOC » 荔枝派nano的SPI-Flash启动 » 2020-12-15 10:33:14

raspberryman 说:
L_max 说:
raspberryman 说:

那检查 驱动配置和设备树吧,一定要生成 mtdblock设备才行

spi_flash启动OK了,但是在串口终端进入dev下还是没有mtdblock设备

用对比软件对比,linux用meld,diffuse, windows用beyond compare

dev下有mtdblock设备了,谢谢

#13 Re: 全志 SOC » 荔枝派nano的SPI-Flash启动 » 2020-12-15 09:54:42

raspberryman 说:
L_max 说:
uuid 说:

改用TF卡启动,看下有没有生成 /dev/mtdblockX 分区。

TF卡正常启动,在dev下没有/mtdblockX

ls: /dev/mtdblockX: No such file or directory

那检查 驱动配置和设备树吧,一定要生成 mtdblock设备才行

spi_flash启动OK了,但是在串口终端进入dev下还是没有mtdblock设备

#14 Re: 全志 SOC » 荔枝派nano的SPI-Flash启动 » 2020-12-15 09:49:52

参考大佬LinjieGuo的帖子https://whycan.com/t_3138.html,查看其 menuconfig 配置,发现配置都是有的,还是不清楚自己配置的为啥有问题,可能还是哪里配置错了,忘记把自己的.config贴出来了(内核配置还得自己再配一次)
直接copy大佬的的内核配置文件.config到自己的内核源码中,不修改其它的,重新编译烧录,启动成功了
(大神的linux内核源码链接: https://pan.baidu.com/s/1YpbDNFXn_2QdTh8YIcF_jg 提取码:bc35)

U-Boot SPL 2018.01 (Dec 14 2020 - 17:45:04)
DRAM: 32 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI


U-Boot 2018.01 (Dec 14 2020 - 17:45:04 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected xt25f128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

Setting up a 480x272 lcd console (overscan 0x0)
In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0 
SF: Detected xt25f128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
device 0 offset 0x100000, size 0x4000
SF: 16384 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x400000
SF: 4194304 bytes @ 0x110000 Read: OK
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 80e01000, end 80e05ec7 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.0-licheepi-nano (lrz@lrz-pc) (gcc version 7.5.0 (Linaro GCC 7.5-2019.12)) #13 Tue Dec 15 09:17:24 CST 2020
[    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: 8128
[    0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 22668K/32768K available (6144K kernel code, 213K rwdata, 1416K rodata, 1024K init, 254K bss, 10100K 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 : 0xc2800000 - 0xff800000   ( 976 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0700000   (7136 kB)
[    0.000000]       .init : 0xc0900000 - 0xc0a00000   (1024 kB)
[    0.000000]       .data : 0xc0a00000 - 0xc0a356c0   ( 214 kB)
[    0.000000]        .bss : 0xc0a3ab44 - 0xc0a7a4bc   ( 255 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.000045] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000110] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000644] Console: colour dummy device 80x30
[    0.000735] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070231] pid_max: default: 32768 minimum: 301
[    0.070569] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070616] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.072052] CPU: Testing write buffer coherency: ok
[    0.073708] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076181] devtmpfs: initialized
[    0.082786] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.082852] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.083113] pinctrl core: initialized pinctrl subsystem
[    0.085120] NET: Registered protocol family 16
[    0.086621] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.088499] cpuidle: using governor menu
[    0.113256] SCSI subsystem initialized
[    0.113621] usbcore: registered new interface driver usbfs
[    0.113771] usbcore: registered new interface driver hub
[    0.113970] usbcore: registered new device driver usb
[    0.114380] pps_core: LinuxPPS API ver. 1 registered
[    0.114407] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.114464] PTP clock support registered
[    0.114967] Advanced Linux Sound Architecture Driver Initialized.
[    0.117936] clocksource: Switched to clocksource timer
[    0.144637] NET: Registered protocol family 2
[    0.146008] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.146082] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.146133] TCP: Hash tables configured (established 1024 bind 1024)
[    0.146390] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.146462] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.146898] NET: Registered protocol family 1
[    0.147894] RPC: Registered named UNIX socket transport module.
[    0.148059] RPC: Registered udp transport module.
[    0.148084] RPC: Registered tcp transport module.
[    0.148100] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.149219] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.151027] Initialise system trusted keyrings
[    0.151619] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.168513] NFS: Registering the id_resolver key type
[    0.168597] Key type id_resolver registered
[    0.168620] Key type id_legacy registered
[    0.168738] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.182539] Key type asymmetric registered
[    0.182581] Asymmetric key parser 'x509' registered
[    0.182795] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.182828] io scheduler noop registered
[    0.182846] io scheduler deadline registered
[    0.183607] io scheduler cfq registered (default)
[    0.183643] io scheduler mq-deadline registered
[    0.183660] io scheduler kyber registered
[    0.184697] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[    0.194909] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.365358] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.372334] console [ttyS0] disabled
[    0.392590] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 22, base_baud = 6250000) is a 16550A
[    0.870567] console [ttyS0] enabled
[    0.909978] brd: module loaded
[    0.932442] loop: module loaded
[    0.936317] SCSI Media Changer driver v0.25 
[    0.944259] m25p80 spi0.0: xt25f128 (16384 Kbytes)
[    0.950213] 4 ofpart partitions found on MTD device spi0.0
[    0.955715] Creating 4 MTD partitions on "spi0.0":
[    0.960634] 0x000000000000-0x000000100000 : "u-boot"
[    0.969622] rfd_ftl: no RFD magic found in 'u-boot'
[    0.976702] ftl_cs: FTL header not found.
[    0.982440] 0x000000100000-0x000000110000 : "dtb"
[    0.988590] ftl_cs: FTL header not found.
[    0.994191] 0x000000110000-0x000000510000 : "kernel"
[    1.010586] rfd_ftl: no RFD magic found in 'kernel'
[    1.017691] ftl_cs: FTL header not found.
[    1.023407] 0x000000510000-0x000001000000 : "rootfs"
[    1.056553] rfd_ftl: no RFD magic found in 'rootfs'
[    1.063764] ftl_cs: FTL header not found.
[    1.070068] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.076604] ehci-platform: EHCI generic platform driver
[    1.082212] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.088522] ohci-platform: OHCI generic platform driver
[    1.094116] usbcore: registered new interface driver usb-storage
[    1.101109] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[    1.110153] i2c /dev entries driver
[    1.168063] sunxi-mmc 1c0f000.mmc: base:0xc2959000 irq:18
[    1.175505] usbcore: registered new interface driver usbhid
[    1.181204] usbhid: USB HID core driver
[    1.202825] NET: Registered protocol family 17
[    1.207495] Key type dns_resolver registered
[    1.214177] Loading compiled-in X.509 certificates
[    1.228953] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.240722] ------------[ cut here ]------------
[    1.245419] WARNING: CPU: 0 PID: 3 at drivers/usb/musb/sunxi.c:411 sunxi_musb_ep_offset+0x3c/0x54
[    1.254391] sunxi_musb_ep_offset called with non 0 offset
[    1.259831] Modules linked in:
[    1.262909] CPU: 0 PID: 3 Comm: kworker/0:0 Not tainted 4.14.0-licheepi-nano #13
[    1.270326] Hardware name: Allwinner suniv Family
[    1.275072] Workqueue: events deferred_probe_work_func
[    1.280340] [<c010e5e0>] (unwind_backtrace) from [<c010b730>] (show_stack+0x10/0x14)
[    1.288155] [<c010b730>] (show_stack) from [<c0116674>] (__warn+0xd4/0xfc)
[    1.295034] [<c0116674>] (__warn) from [<c01166d4>] (warn_slowpath_fmt+0x38/0x48)
[    1.302582] [<c01166d4>] (warn_slowpath_fmt) from [<c04949b0>] (sunxi_musb_ep_offset+0x3c/0x54)
[    1.311359] [<c04949b0>] (sunxi_musb_ep_offset) from [<c0488490>] (ep_config_from_hw+0xc4/0x158)
[    1.320201] [<c0488490>] (ep_config_from_hw) from [<c048a104>] (musb_probe+0x8d8/0xbe8)
[    1.328257] [<c048a104>] (musb_probe) from [<c03f5200>] (platform_drv_probe+0x50/0xac)
[    1.336179] [<c03f5200>] (platform_drv_probe) from [<c03f3a14>] (driver_probe_device+0x234/0x2f0)
[    1.345109] [<c03f3a14>] (driver_probe_device) from [<c03f202c>] (bus_for_each_drv+0x48/0x94)
[    1.353683] [<c03f202c>] (bus_for_each_drv) from [<c03f36fc>] (__device_attach+0xac/0x114)
[    1.362001] [<c03f36fc>] (__device_attach) from [<c03f2d04>] (bus_probe_device+0x84/0x8c)
[    1.370230] [<c03f2d04>] (bus_probe_device) from [<c03f1184>] (device_add+0x370/0x58c)
[    1.378197] [<c03f1184>] (device_add) from [<c03f5014>] (platform_device_add+0x100/0x218)
[    1.386377] [<c03f5014>] (platform_device_add) from [<c03f59ec>] (platform_device_register_full+0xec/0x100)
[    1.396167] [<c03f59ec>] (platform_device_register_full) from [<c049460c>] (sunxi_musb_probe+0x244/0x408)
[    1.405778] [<c049460c>] (sunxi_musb_probe) from [<c03f5200>] (platform_drv_probe+0x50/0xac)
[    1.414257] [<c03f5200>] (platform_drv_probe) from [<c03f3a14>] (driver_probe_device+0x234/0x2f0)
[    1.423177] [<c03f3a14>] (driver_probe_device) from [<c03f202c>] (bus_for_each_drv+0x48/0x94)
[    1.431747] [<c03f202c>] (bus_for_each_drv) from [<c03f36fc>] (__device_attach+0xac/0x114)
[    1.440058] [<c03f36fc>] (__device_attach) from [<c03f2d04>] (bus_probe_device+0x84/0x8c)
[    1.448287] [<c03f2d04>] (bus_probe_device) from [<c03f3140>] (deferred_probe_work_func+0x48/0x140)
[    1.457354] [<c03f3140>] (deferred_probe_work_func) from [<c0129ab8>] (process_one_work+0x1d8/0x3ec)
[    1.466537] [<c0129ab8>] (process_one_work) from [<c0129f68>] (worker_thread+0x29c/0x5b8)
[    1.474763] [<c0129f68>] (worker_thread) from [<c012f010>] (kthread+0x120/0x138)
[    1.482212] [<c012f010>] (kthread) from [<c0107e48>] (ret_from_fork+0x14/0x2c)
[    1.489464] ---[ end trace 00d7ca0cbfb5e356 ]---
[    1.494096] musb-sunxi 1c13000.usb: Error unknown readb offset 128
[    1.500418] musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -22
[    1.508270] musb-hdrc: probe of musb-hdrc.1.auto failed with error -22
[    1.516238] ALSA device list:
[    1.519357]   #0: Loopback 1
[    1.598535] random: crng init done
[    5.128784] VFS: Mounted root (jffs2 filesystem) on device 31:3.
[    5.137217] devtmpfs: mounted
[    5.144716] Freeing unused kernel memory: 1024K
Starting logging: OK
Initializing random number generator... done.
Starting network: OK

Welcome to CBD
LicheePiNano login: root
Password: 

#15 Re: 全志 SOC » 荔枝派nano的SPI-Flash启动 » 2020-12-14 16:56:01

uuid 说:

改用TF卡启动,看下有没有生成 /dev/mtdblockX 分区。

TF卡正常启动,在dev下没有/mtdblockX

ls: /dev/mtdblockX: No such file or directory

#16 Re: 全志 SOC » 荔枝派nano的SPI-Flash启动 » 2020-12-14 16:13:26

raspberryman 说:

MTD  BLOCK 选项没有勾?

勾选了

Device Drivers --->  Memory Technology Device (MTD) support
回车进入Memory Technology Device (MTD) support  --->
看着好像MTD有关的选项都给勾选上了

<M>   MTD tests support (DANGEROUS) 
<M>   Command line partition table parsing
<M>   Caching block device access to MTD devices
<*>   Swap on MTD device support

#17 Re: 全志 SOC » 荔枝派nano的SPI-Flash启动 » 2020-12-14 15:48:01

增加了U-boot对spi flash的识别
修改uboot源码下的:driver/mtd/spi_flash_ids.c
增加一行

{"xt25f128",       INFO(0x0b4018, 0x0,  64*1024,     256, SECT_4K)},

U-boot启动OK,但是系统还是启动失败

U-Boot SPL 2018.01 (Dec 14 2020 - 12:03:43)
DRAM: 32 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI


U-Boot 2018.01 (Dec 14 2020 - 12:03:43 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected xt25f128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

Setting up a 480x272 lcd console (overscan 0x0)
In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0 
SF: Detected xt25f128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
device 0 offset 0x100000, size 0x4000
SF: 16384 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x400000
SF: 4194304 bytes @ 0x110000 Read: OK
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 80e01000, end 80e05ec7 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.0-licheepi-nano (lrz@lrz-pc) (gcc version 7.5.0 (Linaro GCC 7.5-2019.12)) #7 Mon Dec 14 15:27:58 CST 2020
[    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: 8128
[    0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 22668K/32768K available (6144K kernel code, 213K rwdata, 1416K rodata, 1024K init, 254K bss, 10100K 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 : 0xc2800000 - 0xff800000   ( 976 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0700000   (7136 kB)
[    0.000000]       .init : 0xc0900000 - 0xc0a00000   (1024 kB)
[    0.000000]       .data : 0xc0a00000 - 0xc0a35600   ( 214 kB)
[    0.000000]        .bss : 0xc0a3aa84 - 0xc0a7a45c   ( 255 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.000046] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000114] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000646] Console: colour dummy device 80x30
[    0.000737] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070238] pid_max: default: 32768 minimum: 301
[    0.070575] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070624] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.072066] CPU: Testing write buffer coherency: ok
[    0.073755] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076247] devtmpfs: initialized
[    0.082836] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.082899] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.083164] pinctrl core: initialized pinctrl subsystem
[    0.085218] NET: Registered protocol family 16
[    0.086718] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.088548] cpuidle: using governor menu
[    0.113642] SCSI subsystem initialized
[    0.114011] usbcore: registered new interface driver usbfs
[    0.114164] usbcore: registered new interface driver hub
[    0.114371] usbcore: registered new device driver usb
[    0.114774] pps_core: LinuxPPS API ver. 1 registered
[    0.114800] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.114858] PTP clock support registered
[    0.115376] Advanced Linux Sound Architecture Driver Initialized.
[    0.118372] clocksource: Switched to clocksource timer
[    0.145645] NET: Registered protocol family 2
[    0.147052] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.147129] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.147180] TCP: Hash tables configured (established 1024 bind 1024)
[    0.147457] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.147516] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.147950] NET: Registered protocol family 1
[    0.149095] RPC: Registered named UNIX socket transport module.
[    0.149135] RPC: Registered udp transport module.
[    0.149151] RPC: Registered tcp transport module.
[    0.149167] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.150268] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.152070] Initialise system trusted keyrings
[    0.152644] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.169635] NFS: Registering the id_resolver key type
[    0.169723] Key type id_resolver registered
[    0.169742] Key type id_legacy registered
[    0.169860] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.183712] Key type asymmetric registered
[    0.183752] Asymmetric key parser 'x509' registered
[    0.183960] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.183990] io scheduler noop registered
[    0.184009] io scheduler deadline registered
[    0.184762] io scheduler cfq registered (default)
[    0.184797] io scheduler mq-deadline registered
[    0.184814] io scheduler kyber registered
[    0.185847] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[    0.195803] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.370736] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.377552] console [ttyS0] disabled
[    0.397807] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 22, base_baud = 6250000) is a 16550A
[    0.875711] console [ttyS0] enabled
[    0.914694] brd: module loaded
[    0.937038] loop: module loaded
[    0.941049] SCSI Media Changer driver v0.25 
[    0.945854] slram: not enough parameters.
[    0.953030] m25p80 spi0.0: xt25f128 (16384 Kbytes)
[    0.959004] 4 ofpart partitions found on MTD device spi0.0
[    0.964506] Creating 4 MTD partitions on "spi0.0":
[    0.969418] 0x000000000000-0x000000100000 : "u-boot"
[    0.975520] 0x000000100000-0x000000110000 : "dtb"
[    0.981434] 0x000000110000-0x000000510000 : "kernel"
[    0.987373] 0x000000510000-0x000001000000 : "rootfs"
[    0.994043] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.000700] ehci-platform: EHCI generic platform driver
[    1.006196] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.012493] ohci-platform: OHCI generic platform driver
[    1.018165] usbcore: registered new interface driver usb-storage
[    1.025142] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[    1.034182] i2c /dev entries driver
[    1.098504] sunxi-mmc 1c0f000.mmc: base:0xc2936000 irq:18
[    1.105970] usbcore: registered new interface driver usbhid
[    1.111670] usbhid: USB HID core driver
[    1.133418] NET: Registered protocol family 17
[    1.138105] Key type dns_resolver registered
[    1.144807] Loading compiled-in X.509 certificates
[    1.159482] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.171155] ------------[ cut here ]------------
[    1.175849] WARNING: CPU: 0 PID: 3 at drivers/usb/musb/sunxi.c:411 sunxi_musb_ep_offset+0x3c/0x54
[    1.184820] sunxi_musb_ep_offset called with non 0 offset
[    1.190267] Modules linked in:
[    1.193345] CPU: 0 PID: 3 Comm: kworker/0:0 Not tainted 4.14.0-licheepi-nano #7
[    1.200676] Hardware name: Allwinner suniv Family
[    1.205418] Workqueue: events deferred_probe_work_func
[    1.210689] [<c010e5e0>] (unwind_backtrace) from [<c010b730>] (show_stack+0x10/0x14)
[    1.218513] [<c010b730>] (show_stack) from [<c0116674>] (__warn+0xd4/0xfc)
[    1.225394] [<c0116674>] (__warn) from [<c01166d4>] (warn_slowpath_fmt+0x38/0x48)
[    1.232939] [<c01166d4>] (warn_slowpath_fmt) from [<c0492350>] (sunxi_musb_ep_offset+0x3c/0x54)
[    1.241707] [<c0492350>] (sunxi_musb_ep_offset) from [<c0485e30>] (ep_config_from_hw+0xc4/0x158)
[    1.250547] [<c0485e30>] (ep_config_from_hw) from [<c0487aa4>] (musb_probe+0x8d8/0xbe8)
[    1.258604] [<c0487aa4>] (musb_probe) from [<c03f5200>] (platform_drv_probe+0x50/0xac)
[    1.266521] [<c03f5200>] (platform_drv_probe) from [<c03f3a14>] (driver_probe_device+0x234/0x2f0)
[    1.275450] [<c03f3a14>] (driver_probe_device) from [<c03f202c>] (bus_for_each_drv+0x48/0x94)
[    1.284023] [<c03f202c>] (bus_for_each_drv) from [<c03f36fc>] (__device_attach+0xac/0x114)
[    1.292337] [<c03f36fc>] (__device_attach) from [<c03f2d04>] (bus_probe_device+0x84/0x8c)
[    1.300565] [<c03f2d04>] (bus_probe_device) from [<c03f1184>] (device_add+0x370/0x58c)
[    1.308530] [<c03f1184>] (device_add) from [<c03f5014>] (platform_device_add+0x100/0x218)
[    1.316709] [<c03f5014>] (platform_device_add) from [<c03f59ec>] (platform_device_register_full+0xec/0x100)
[    1.326497] [<c03f59ec>] (platform_device_register_full) from [<c0491fac>] (sunxi_musb_probe+0x244/0x408)
[    1.336105] [<c0491fac>] (sunxi_musb_probe) from [<c03f5200>] (platform_drv_probe+0x50/0xac)
[    1.344584] [<c03f5200>] (platform_drv_probe) from [<c03f3a14>] (driver_probe_device+0x234/0x2f0)
[    1.353502] [<c03f3a14>] (driver_probe_device) from [<c03f202c>] (bus_for_each_drv+0x48/0x94)
[    1.362072] [<c03f202c>] (bus_for_each_drv) from [<c03f36fc>] (__device_attach+0xac/0x114)
[    1.370385] [<c03f36fc>] (__device_attach) from [<c03f2d04>] (bus_probe_device+0x84/0x8c)
[    1.378621] [<c03f2d04>] (bus_probe_device) from [<c03f3140>] (deferred_probe_work_func+0x48/0x140)
[    1.387686] [<c03f3140>] (deferred_probe_work_func) from [<c0129ab8>] (process_one_work+0x1d8/0x3ec)
[    1.396871] [<c0129ab8>] (process_one_work) from [<c0129f68>] (worker_thread+0x29c/0x5b8)
[    1.405101] [<c0129f68>] (worker_thread) from [<c012f010>] (kthread+0x120/0x138)
[    1.412558] [<c012f010>] (kthread) from [<c0107e48>] (ret_from_fork+0x14/0x2c)
[    1.419808] ---[ end trace cb1dc811f8b9347d ]---
[    1.424439] musb-sunxi 1c13000.usb: Error unknown readb offset 128
[    1.430760] musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -22
[    1.438615] musb-hdrc: probe of musb-hdrc.1.auto failed with error -22
[    1.446661] ALSA device list:
[    1.449772]   #0: Loopback 1
[    1.454065] Waiting for root device /dev/mtdblock3...
[  208.188492] random: crng init done

已有配置

勾选 File systems ‣ Miscellaneous filesystems ‣ Journalling Flash File System v2 (JFFS2) support
勾选Device Driver --->  SPI Support ---> Allwinner A31 SPI controller
取消勾选Device Driver --->  SPI Support ---> Allwinner A10 SoCs SPI controller
勾选 Memory Technology Device (MTD) support  --->   Caching block device access to MTD devices   
勾选 File systems  --->  Miscellaneous filesystems  --->   Journalling Flash File System v2 (JFFS2) support
取消勾选 Memory Technology Device (MTD) support  --->  SPI-NOR device support  --->    Use small 4096 B erase 
勾选Device Driver --->Block devices  ---> Loopback device support

#18 Re: 全志 SOC » 荔枝派nano的SPI-Flash启动 » 2020-12-12 18:28:27

raspberryman 说:

没有启动运行脚本,他就进入命令行了

能稍微说的详细点嘛?不太明白要怎么解决,谢谢大佬。

#19 Re: 全志 SOC » 荔枝派nano的SPI-Flash启动 » 2020-12-12 18:21:26

五、烧录固件
我是在Ubuntu上用sunxi-fel工具烧录的,sunxi-fel工具安装参考荔枝派Nano全流程指南http://nano.lichee.pro/step_by_step/two_sunxi-tools.html
1、拔出TF卡,上电前, flash的CS和GND短接,不然ubuntu下检测不到Allwinner USB设备,这里我要被自己蠢哭了,CS管脚接错了,我之前接在排针上了,spi0的CS管脚是没有用排针引出来的,需要自己拿根杜邦线引出来,这里又被我们的硬件工程师给坑了,我是想把CS和GND接一个拨动开关,焊接的时候硬件工程师把Nano的GND看错了,一定要看清原理图啊!!!(荔枝派公版排针上的管脚和旁边没用排针引出来的管脚需要看仔细是否是接在一起)

未检测到Allwinner USB设备
sudo sunxi-fel spiflash-info
ERROR: Allwinner USB FEL device not found!

2、进入fel就要断开SPI_CE与GND的链接,不然不能读取norflash芯片

 sudo sunxi-fel spiflash-info
No SPI flash detected.

成功检测到Allwinner USB设备,查看版本信息,显示flash信息

sudo sunxi-fel version  
AWUSBFEX soc=00001663(F1C100s) 00000001 ver=0001 44 08 scratchpad=00007e00 00000000 00000000
sudo sunxi-fel spiflash-info
Manufacturer: Unknown (0Bh), model: 40h, size: 16777216 bytes.

3、执行烧录命令烧录,有进度条显示
(虽然进度条从0到100%了,但是不确定有没有烧录成功,请问下怎么样确定烧录成功了呢)

sudo sunxi-fel -p spiflash-write 0 f1c100s_spiflash_16M.bin
100% [================================================] 16777 kB,   79.4 kB/s 

4、断电接上串口,上电启动失败,以下是启动log

U-Boot 2018.01-05679-g013ca457fd-dirty (Nov 20 2020 - 00:57:23 -0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected xt25f128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** 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:  0 
Card did not respond to voltage select!
mmc_init: -95, time 22
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.
=> 
=> 

5、后面重新烧录了一次,还是启动不了

U-Boot 2018.01 (Dec 11 2020 - 11:42:02 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
SF: unrecognized JEDEC id bytes: 0b, 40, 18
*** Warning - spi_flash_probe_bus_cs() failed, using default environment

Setting up a 480x272 lcd console (overscan 0x0)
In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0 
SF: unrecognized JEDEC id bytes: 0b, 40, 18
Failed to initialize SPI flash at 0:0 (error -2)
No SPI flash selected. Please run `sf probe'
No SPI flash selected. Please run `sf probe'
=> 

打算重新再理一下,不知道哪里有问题。。。

#20 Re: 全志 SOC » 荔枝派nano的SPI-Flash启动 » 2020-12-12 18:20:47

四、制作系统镜像
  将解压后的rootfs,suniv-f1c100s-licheepi-nano.dtb,zImage,u-boot-sunxi-with-spl.bin拷贝到一个文件
1、制作文件系统镜像

//板子自带的16M flashs
执行sudo mkfs.jffs2 -s 0x100 -e 0x10000 -p 0xAF0000 -d rootfs/ -o jffs2.img 
会生成jffs2.img
注:
    -p 指的是rootfs占据的总空间:16M-1M-64K-4M=0xAF0000 或者 32M-1M-64K-4M=0x1AF0000
   -s 页大小0x100 256字节
   -e 块大小0x10000 64k
   jffs2.img是生成的文件系统镜像。

2、编写制作镜像脚本:BuildMyImage.sh

#!/bin/sh

dd if=/dev/zero of=f1c100s_spiflash_16M.bin bs=1M count=16 &&\
dd if=u-boot/u-boot-sunxi-with-spl.bin of=f1c100s_spiflash_16M.bin bs=1K conv=notrunc &&\
dd if=linux/arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dtb of=f1c100s_spiflash_16M.bin bs=1K see    k=1024 conv=notrunc &&\
dd if=linux/arch/arm/boot/zImage of=f1c100s_spiflash_16M.bin bs=1K seek=1088 conv=notrunc &&\
mkfs.jffs2 -s 0x100 -e 0x10000 --pad=0xAF0000 -d rootfs/ -o rootfs.jffs2 &&\
dd if=rootfs.jffs2 of=f1c100s_spiflash_16M.bin bs=1k seek=5184 conv=notrunc &&\
sync

注:
    ①生成一个空文件,大小是16MB
    ②将uboot添加到文件开头
    ③将dtb放到1M偏移处
    ④将kernel放到1M+64K偏移处
    ⑤将rootfs放到1M+64K+4M偏移处,偏移大小是seek,单位是KB。


执行脚本完毕后生成镜像文件f1c100s_spiflash_16M.bin

lrz@lrz-pc:~/licheepiNano/spi_flash_nano/myImagefile$ ./BuildMyImage.sh 
记录了16+0 的读入
记录了16+0 的写出
16777216 bytes (17 MB, 16 MiB) copied, 0.0206363 s, 813 MB/s
记录了984+0 的读入
记录了984+0 的写出
1007616 bytes (1.0 MB, 984 KiB) copied, 0.000967329 s, 1.0 GB/s
记录了7+1 的读入
记录了7+1 的写出
7880 bytes (7.9 kB, 7.7 KiB) copied, 0.000119927 s, 65.7 MB/s
记录了3771+1 的读入
记录了3771+1 的写出
3862384 bytes (3.9 MB, 3.7 MiB) copied, 0.00349949 s, 1.1 GB/s
记录了19+1 的读入
记录了19+1 的写出
20252 bytes (20 kB, 20 KiB) copied, 0.000116751 s, 173 MB/s
lrz@lrz-pc:~/licheepiNano/spi_flash_nano/myImagefile$ ls
BuildMyImage.sh           jffs2.img  rootfs.jffs2                     u-boot-sunxi-with-spl.bin
f1c100s_spiflash_16M.bin  rootfs     suniv-f1c100s-licheepi-nano.dtb  zImage

参考https://www.cnblogs.com/linux-37ge/p/12749140.html

#21 全志 SOC » 荔枝派nano的SPI-Flash启动 » 2020-12-12 11:27:54

L_max
回复: 17

荔枝派nano的SPI-Flash启动报错(新手入坑求助,4楼有启动的log)

荔枝派Nano公板
SPI_Flash编译烧录启动
交叉编译工具:gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi
u-boot: nano-lcd800480
Linux:linux-nano-4.14-exp
buildroot:buildroot-2018.11.2
开发环境:ubuntu18.04
TF卡启动是正常得


以下是编译配置以及烧录流程
一、U-boot
修改uboot以适配spi flash
在uboot源码目录下 进入 ./include/configs/,修改 suniv.h

#define CONFIG_BOOTCOMMAND   "sf probe 0 50000000; "                           \
                              "sf read 0x80C00000 0x100000 0x4000; "  \
                              "sf read 0x80008000 0x110000 0x400000; " \
                             "bootz 0x80008000 - 0x80C00000"
 
 #define CONFIG_BOOTARGS "console=ttyS0,115200 panic=5 rootwait " \
                  " mtdparts=spi32766.0:1M(uboot),64k(dtb),4M(kernel),-(rootfs) " \
                  " root=/dev/mtdblock3 rw rootfstype=jffs2 "

Uboot的配置和修改我是参考晕哥的帖子https://whycan.com/t_1623.html

二、Linux
1、Linux配置
勾选 File systems ‣ Miscellaneous filesystems ‣ Journalling Flash File System v2 (JFFS2) support
勾选Device Driver --->  SPI Support ---> Allwinner A31 SPI controller
取消勾选Device Driver --->  SPI Support ---> Allwinner A10 SoCs SPI controller
勾选 Memory Technology Device (MTD) support  --->   Caching block device access to MTD devices   
勾选 File systems  --->  Miscellaneous filesystems  --->   Journalling Flash File System v2 (JFFS2) support
取消勾选 Memory Technology Device (MTD) support  --->  SPI-NOR device support  --->    Use small 4096 B erase

2、修改源码下的 ./drivers/mtd/spi-nor.c

适配spi flash型号
   注释掉以下一行:
    //{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
    在这一行下面增加一项:
    { "xt25f128b", INFO(0x064018, 0, 64 * 1024, 256, SECT_4K) },


3、修改dts以适配spi flash驱动
修改内核源码目录下的 arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts
将原来的&spi0{...}替换为:

&spi0 {
    pinctrl-names = "default";
    pinctrl-0 = <&spi0_pins_a>;
    status = "okay";
    spi-max-frequency = <50000000>;
    flash: w25q128@0 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "winbond,xt25f128b", "jedec,spi-nor";
        reg = <0>;    
        spi-max-frequency = <50000000>;
        partitions {
            compatible = "fixed-partitions";
            #address-cells = <1>;
            #size-cells = <1>;
            partition@0 {
                label = "u-boot";
                reg = <0x000000 0x100000>;
                read-only;
            };
            partition@100000 {
                label = "dtb";
                reg = <0x100000 0x10000>;
                read-only;
            };
            partition@110000 {
                label = "kernel";
                reg = <0x110000 0x400000>;
                read-only;
            };
            partition@510000 {
                label = "rootfs";
                reg = <0x510000 0xAF0000>;
            };
        };
    };
};    

dts修改参考荔枝派Nano全流程指南http://nano.lichee.pro/build_sys/build_flash.html#dts

三、Buildroot
下载Buildroot后解压,从零开始编译
配置 make menuconfig

Target options
  -- Target Architecture (ARM (little endian))
  -- Target Variant arm926t
Toolchain
  -- C library (musl) # 使用musl减小最终体积
System configuration
  -- Use syslinks to /usr .... # 启用/bin, /sbin, /lib的链接
  -- Enable root login # 启用root登录
  -- Run a getty after boot # 启用登录密码输入窗口
  -- remount root filesystem # 重新挂载根文件系统到可读写
  -- Install Timezone info # 安装时区信息。我的程序需要所以就打开了这个玩意
     -- timezone list (asia)
     -- default local time (Asia/Shanghai)
Target Packages
  -- mount/umount # 如果要用overlayfs,那就要用这个挂载

#24 全志 SOC » V3S主线编译教程,TF烧录(新手入坑) » 2020-12-08 15:42:59

L_max
回复: 2

写在前面:新手V3S入坑,为了记录Lichee Zero主线编译,TF卡烧录过程
开发板:Lichee Zero 二代一体开发板
开发环境:Ubuntu18.04
TF卡:闪迪16GTF卡
U-boot:v3s-current
Linux:linux-zero-5.2.y
buildroot:buildroot-2019.11-rc2

一、搭建环境

1、下载安装交叉编译器
wget https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf.tar.xz


https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz

tar xvf  xxxx.tar.xz
mv    xxx    /opt


2、修改环境变量
sudo vim /etc/bash.bashrc
添加
PATH="$PATH:/opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin"

3、使环境变量生效:
source /etc/bash.bashrc

4、查看设置是否生效
arm-linux-gnueabihf-gcc -v



二、u-boot
1、下载u-boot,https://github.com/Lichee-Pi/u-boot/  注意不同分支版本不一样


https://github.com/Lichee-Pi/u-boot/tree/v3s-current
git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-current
#or git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-spi-experimental



2、修改配置,以及编译

①修改u-boot/include/configs/sun8i.h文件 加入:


#define CONFIG_BOOTCOMMAND   "setenv bootm_boot_mode sec; " \
                            "load mmc 0:1 0x41000000 zImage; "  \
                            "load mmc 0:1 0x41800000 sun8i-v3s-licheepi-zero.dtb; " \
                            "bootz 0x41000000 - 0x41800000;"

#define CONFIG_BOOTARGS      "console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 earlyprintk rw  vt.global_cursor_default=0"

注: load mmc 0:1 0x41800000 sun8i-v3s-licheepi-zero.dtb,需要跟kernel下的dts对应

②编译

make ARCH=arm menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 2>&1 | tee build.log

编译完成后,在当前目录下生成了u-boot-sunxi-with-spl.bin,可以烧录到TF卡8K偏移处启动


三、Kernel

1、下载,编译源码:https://github.com/Lichee-Pi/linux

git clone https://github.com/Lichee-Pi/linux.git

cd linux

make ARCH=arm licheepi_zero_defconfig

make ARCH=arm menuconfig

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 INSTALL_MOD_PATH=out modules(可省略)

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 INSTALL_MOD_PATH=out modules_install(可省略)

2、编译完成后,zImage在arch/arm/boot/下,dtb在arch/arm/boot/dts/下
编译完成后,zImage在arch/arm/boot/下,驱动模块在out/下,dtb文件在arch/arm/boot/dts/下,(sun8i-v3s-licheepi-zero-block.dtb)


四、buildroot
1、下载buildroot:https://buildroot.org/downloads/
wget https://buildroot.org/downloads/buildroot-2017.08.tar.gz


tar xvf buildroot-2017.08.tar.gz
cd buildroot-2017.08/

2、配置和编译

make menuconfig

①target options配置

②Toolchain配置
dl下的包需要下载下载可能很慢,可以先下载好放入DL目录下

③System configuretion配置

④编译:make ,#
有时候构建会出现莫名其妙的错误,make clean下

bulidroot编译完成后, 会生成 output/images/rootfs.tar, 此即所需的根文件系统


五、制作TF卡以及写入文件

1、卸载盘符,删除文件,重新分区

32M  Fat16   kernel
xxx    ext4    rootfs


2、磁盘管理工具重新挂载,df 查看,设备在/dev/sdc
/media/lrz/kernel
/media/lrz/rootfs



3、写TF卡

①进入v3s-current目录
sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdc bs=1024 seek=8

②进入linux-zero-5.2.y内核目录
cp arch/arm/boot/zImage /media/lrz/BOOT
cp arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dtb /media/lrz/BOOT
sudo  umount  /dev/sdc1

③进入buildroot-2019.11-rc2目录
sudo tar xvf output/images/rootfs.tar -C /media/lrz/rootfs
sudo  umount  /dev/sdc2


六、上电启动:
可登陆串口终端查看启动log:
默认使用的是UART0
波特率:115200
登录账号root,无密码

页脚

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

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