您尚未登录。

楼主 #1 2019-10-18 15:02:14

xbgzy
会员
注册时间: 2019-10-07
已发帖子: 19
积分: 19

tf卡启动nano,自己编译的uboot替换后无法启动内核

我用的f1c100s,从tf卡启动,用的镜像包里的dd打包的镜像文件,是可以正常启动内核的,但用我自己编译的uboot烧到8k偏移处就不能启动内核,卡在Starting kernel。uboot编译过程参照荔枝派nano全流程指南做的。
使用镜像包的uboot,内核正常启动:

U-Boot SPL 2018.01-05676-g00188782ee (Apr 08 2018 - 16:10:25)
DRAM: 32 MiB
Trying to boot from MMC1



U-Boot 2018.01-05676-g00188782ee (Apr 08 2018 - 16:10:25 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB

MMC:   SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 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:  2 
 1 
 0 

switch to partitions #0, OK
mmc0 is current device

Scanning mmc 0:1...

Found U-Boot script /boot.scr
reading /boot.scr
280 bytes read in 15 ms (17.6 KiB/s)
## Executing script at 80c50000
reading suniv-f1c100s-licheepi-nano.dtb
8545 bytes read in 26 ms (320.3 KiB/s)
reading zImage

3802240 bytes read in 188 ms (19.3 MiB/s)
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 80e60000, end 80e65160 ... OK

Starting kernel ...


[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (root@biglion-MRC-WX0) (gcc version 7.2.0 (Ubuntu/Linaro 7.2.0-6ubuntu1)) #69 Wed Apr 4 17:47:49 CST 2018

使用我编译的uboot,内核不启动,卡在Starting kernel :

U-Boot SPL 2018.01 (Oct 18 2019 - 13:29:03)
DRAM: 32 MiB
SPL: Unsupported Boot Device!
Trying to boot from MMC1

U-Boot 2018.01 (Oct 18 2019 - 13:29:03 +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 240x320 lcd console (overscan 0x0)

In:    serial
Out:   vga
Err:   vga
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  2 
 1 
 0 

switch to partitions #0, OK
mmc0 is current device

Scanning mmc 0:1...

Found U-Boot script /boot.scr
reading /boot.scr
280 bytes read in 16 ms (16.6 KiB/s)
## Executing script at 80c50000
reading suniv-f1c100s-licheepi-nano.dtb
8545 bytes read in 33 ms (252 KiB/s)
reading zImage

3802240 bytes read in 204 ms (17.8 MiB/s)
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 80e5c000, end 80e61160 ... OK

Starting kernel ...

我只是替换了一下uboot文件,其他都没有动,另外我编译出来的uboot只有540kb左右,而镜像包里的uboot是948kb,查看两者区别,948kb比540kb多出的部分全部是0xFF。想请教一下各位,是不是不能这样直接替换?

离线

#2 2019-10-18 15:14:48

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,245
积分: 9197

Re: tf卡启动nano,自己编译的uboot替换后无法启动内核

看下 u-boot 源码下面的 include/configs/suniv.h

有没有 bootargs, bootcmd 相关的代码。





离线

楼主 #3 2019-10-18 15:24:37

xbgzy
会员
注册时间: 2019-10-07
已发帖子: 19
积分: 19

Re: tf卡启动nano,自己编译的uboot替换后无法启动内核

晕哥 说:

看下 u-boot 源码下面的 include/configs/suniv.h

有没有 bootargs, bootcmd 相关的代码。

晕哥你好,在suniv.h我试过添加bootargs和bootcmd,bootargs内容和boot.scr一样“console=tty0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw”;而且只要我定义了bootcmd编译会报错说有重复定义,现在我自己电脑不在身边,暂时没有办法截图说明。晕哥我请教一下,tf启动bootcmd部分应该怎么定义?

离线

#4 2019-10-18 15:32:02

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,245
积分: 9197

Re: tf卡启动nano,自己编译的uboot替换后无法启动内核

1. 可以在 include/configs/suniv.h 设置 CONFIG_BOOTCOMMAND/ CONFIG_BOOTARGS
    提示重复定义的的话, 可以先 #undef CONFIG_BOOTCOMMAND, 然后再 #define CONFIG_BOOTCOMMAND
    不建议使用这个方法

2. 可以在make menuconfig 里面配置 bootargs/bootcmd

3. boot.scr 可以设置 bootargs/bootcmd





离线

楼主 #5 2019-10-18 16:01:52

xbgzy
会员
注册时间: 2019-10-07
已发帖子: 19
积分: 19

Re: tf卡启动nano,自己编译的uboot替换后无法启动内核

晕哥 说:

1. 可以在 include/configs/suniv.h 设置 CONFIG_BOOTCOMMAND/ CONFIG_BOOTARGS
    提示重复定义的的话, 可以先 #undef CONFIG_BOOTCOMMAND, 然后再 #define CONFIG_BOOTCOMMAND
    不建议使用这个方法

2. 可以在make menuconfig 里面配置 bootargs/bootcmd

3. boot.scr 可以设置 bootargs/bootcmd

嗯,我请教一下,我看你在论坛里有个v3s tf启动盘的帖子,里面有bootargs/bootcmd的配置:

#define CONFIG_BOOTARGS        "console=ttyS0,115200 panic=5 rootwait mtdparts=spi32766.0:1M(uboot)ro,64k(dtb)ro,6M(kernel)ro,-(rootfs) root=/dev/mmcblk0p2 earlyprintk rw"
#define CONFIG_BOOTCOMMAND \
    "setenv bootm_boot_mode sec; " \
    "load mmc 0:1 0x41000000 zImage; " \
    "load mmc 0:1 0x41800000 sun8i-v3s-licheepi-zero-dock.dtb;" \
    "bootz 0x41000000 - 0x41800000; "

如果要用在nano上,我要修改哪些地方呢?

离线

#6 2019-10-18 16:05:51

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,245
积分: 9197

Re: tf卡启动nano,自己编译的uboot替换后无法启动内核

2/3都可以,2不用改代码 只要改配置文件。

3连配置文件都不用改





离线

楼主 #7 2019-10-18 16:11:41

xbgzy
会员
注册时间: 2019-10-07
已发帖子: 19
积分: 19

Re: tf卡启动nano,自己编译的uboot替换后无法启动内核

晕哥 说:

2/3都可以,2不用改代码 只要改配置文件。

3连配置文件都不用改

目前我用的应该是3,tf卡分区的dtb、boot.scr和zImage文件都没有动过,我只是把自己的uboot烧入8k偏移处内核就起不来了。是不是除了保持.scr不变之外,uboot里面还要配置bootargs/bootcmd?

离线

#8 2019-10-18 16:23:08

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,245
积分: 9197

Re: tf卡启动nano,自己编译的uboot替换后无法启动内核

你试一下这个固件: https://whycan.cn/t_2689.html

在这基础上修改 uboot





离线

楼主 #9 2019-10-18 16:33:20

xbgzy
会员
注册时间: 2019-10-07
已发帖子: 19
积分: 19

Re: tf卡启动nano,自己编译的uboot替换后无法启动内核

晕哥 说:

你试一下这个固件: https://whycan.cn/t_2689.html

在这基础上修改 uboot

好的谢谢,我学习一下

离线

页脚

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

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