0
点赞
收藏
分享

微信扫一扫

D1 哪吒开发板 rt-smart 使用u-boot bootm 引导运行


前言

  • 最近折腾 D1 哪吒开发板 如何运行 rt-smart,今天重新梳理了一下u-boot 引导 rt-smart 的方法,发现 u-boot 可以使用bootm 引导 rt-smart

操作方法

  • rt-smart kernel 编译后,运行 ​​generateimg.sh​​ shell 脚本,生成 rtthread.img 镜像,这个镜像,其实类似于 Linux 的uImage
  • ​generateimg.sh​​ shell 脚本内容如下:

#!/bin/sh
mkimage -A riscv -O linux -T kernel -C none -a 0x45000000 -e 0x45000000 -d rtthread.bin rtthread.img

  • 如果 ​​mkimage​​​ 找不到,ubuntu 安装: ​​apt-get install u-boot-tools​​ 即可

D1 哪吒开发板 rt-smart 使用u-boot bootm 引导运行_sed

  • 把这个 rtthread.img ,替换全志 Tina Linux SDK 中 ​​tina-d1-h/out/d1-h-nezha/boot.img​​ 即可
  • 再使用 ​​pack​​​ 命令打包,打包后的镜像:​​tina-d1-h/out/d1-h-nezha/tina_d1-h-nezha_uart0.img​​​ 烧写到 开发板的spi nand flash中,即可引导运行 ​​rt-smart​

D1 哪吒开发板 rt-smart 使用u-boot bootm 引导运行_rt-smart_02

备注

  • rt-smart 编译并使用 mkimage 打包,生成 rtthread.img,这个镜像就可以直接使用 u-boot bootm 引导
  • 这里 把 rtthread.img 替换 boot.img,并使用 ​​pack​​​ 打包,是为了让全志平台烧写工具​​PhoenixSuit.exe​​ 可以正常烧写
  • 后面研究 u-boot 通过 tftp 引导 rt-smart,这样就省略了 ​​pack​​ 过程

启动信息

  • 以下为开发板上电完整的启动信息

[205]HELLO! BOOT0 is starting!
[208]BOOT0 commit : 88480af
[210]set pll start
[212]fix vccio detect value:0xc0
[215]periph0 has been enabled
[218]set pll end
[220][pmu]: bus read error
[222]board init ok
[224]get_pmu_exist() = -1
[227]DRAM BOOT DRIVE INFO: V0.33
[230]DRAM CLK = 792 MHz
[232]DRAM Type = 3 (2:DDR2,3:DDR3)
[235]DRAMC ZQ value: 0x7b7bfb
[238]DRAM ODT value: 0x42.
[241]ddr_efuse_type: 0x0
[244]DRAM SIZE =1024 M
[246]dram_tpr4:0x0
[247]PLL_DDR_CTRL_REG:0xf8004100
[250]DRAM_CLK_REG:0xc0000000
[253][TIMING DEBUG] MR2= 0x18
[257]DRAM simple test OK.
[260]dram size =1024
[262]spinand UBOOT_START_BLK_NUM 8 UBOOT_LAST_BLK_NUM 32
[267]block from 8 to 32
[325]Check is correct.
[327]dma 0x301a8 int is not used yet
[331]dma 0x301a8 int is free, you do not need to free it again
[336]Entry_name = opensbi
[339]Entry_name = u-boot
[343]Entry_name = dtb
[345]Jump to second Boot.

OpenSBI auto-t113-linux-V0.8-2-g053d088
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|

Platform Name : T-HEAD Xuantie Platform
Platform HART Features : RV64ACDFIMSUVX
Platform Max HARTs : 1
Current Hart : 0
Firmware Base : 0x41fc0400
Firmware Size : 75 KB
Runtime SBI Version : 0.2

MIDELEG : 0x0000000000000222
MEDELEG : 0x000000000000b1ff
PMP0 : 0x0000000041fc0000-0x0000000041fdffff (A)
PMP1 : 0x0000000040000000-0x000000007fffffff (A,R,W,X)
PMP2 : 0x0000000080000000-0x00000000bfffffff (A,R,W,X)
PMP3 : 0x0000000000020000-0x0000000000027fff (A,

U-Boot 2018.05-g24521d6 (Feb 11 2022 - 08:52:39 +0000) Allwinner Technology

[00.430]DRAM: 1 GiB
[00.433]Relocation Offset is: 3dee7000
[00.437]secure enable bit: 0
[00.439]CPU=1008 MHz,PLL6=600 Mhz,AHB=200 Mhz, APB1=100Mhz MBus=300Mhz
[00.446]flash init start
[00.448]workmode = 0,storage type = 0
sspi->base_addr = 0x4025000, the SPI control register:
[VER] 0x4025000 = 0x00010001, [GCR] 0x4025004 = 0x00000083, [TCR] 0x4025008 = 0x00000184
[ICR] 0x4025010 = 0x00000f00, [ISR] 0x4025014 = 0x00000032, [FCR] 0x4025018 = 0x00200020
[FSR] 0x402501c = 0x00000000, [WCR] 0x4025020 = 0x00000000, [CCR] 0x4025024 = 0x00000002
[SDC] 0x4025028 = 0x00002000, [BCR] 0x4025030 = 0x00000000, [TCR] 0x4025034 = 0x00000000
[BCC] 0x4025038 = 0x20000000, [DMA] 0x4025088 = 0x000000e5

[00.495]sunxi-spinand-phy: not detect any munufacture from id table
[00.502]sunxi-spinand-phy: get spi-nand Model from fdt fail
[00.507]sunxi-spinand-phy: get phy info from fdt fail

device nand0 <nand>, # parts = 4
#: name size offset mask_flags
0: boot0 0x00100000 0x00000000 1
1: uboot 0x00300000 0x00100000 1
2: secure_storage 0x00100000 0x00400000 1
3: sys 0x0fb00000 0x00500000 0

active partition: nand0,0 - (boot0) 0x00100000 @ 0x00000000

defaults:
mtdids : nand0=nand
mtdparts: mtdparts=nand:1024k@0(boot0)ro,3072k@1048576(uboot)ro,1024k@4194304(secure_storage)ro,-(sys)
[00.842]ubi0: attaching mtd4
[01.044]ubi0: scanning is finished
[01.052]ubi0: attached mtd4 (name "sys", size 251 MiB)
[01.056]ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 258048 bytes
[01.063]ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 2048
[01.069]ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[01.075]ubi0: good PEBs: 1004, bad PEBs: 0, corrupted PEBs: 0
[01.081]ubi0: user volume: 9, internal volumes: 1, max. volumes count: 128
[01.087]ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0
[01.095]ubi0: available PEBs: 0, total reserved PEBs: 1004, PEBs reserved for bad PEB handling: 40
[01.104]sunxi flash init ok
[01.106]line:703 init_clocks
[01.109]drv_disp_init
request pwm success, pwm2:pwm2:0x2000c00.
[01.126]drv_disp_init finish
[01.129]boot_gui_init:start
[01.132]set disp.dev2_output_type fail. using defval=0
[01.158]boot_gui_init:finish
[01.392]LCD open finish
partno erro : can't find partition bootloader
54 bytes read in 0 ms
[01.451]bmp_name=bootlogo.bmp size 3072054
3072054 bytes read in 65 ms (45.1 MiB/s)
[01.647]Loading Environment from SUNXI_FLASH... OK
[01.669]out of usb burn from boot: not need burn key
[01.674]Item0 (Map) magic is bad
partno erro : can't find partition private
[01.703]update bootcmd
[01.715]change working_fdt 0x7eaa6da0 to 0x7ea86da0
No reserved memory region found in source FDT
[01.742]update dts
noncached_alloc(): addr = 0x7eb1c1c0
noncached_alloc(): addr = 0x7eb44980
noncached_alloc(): addr = 0x7eac8a40
noncached_alloc(): addr = 0x7ef2d040
phy_mode=rgmii, phy_interface=7
gmac: *** using ephy_clk ***
eth0
Warning: eth0 (eth0) using random MAC address - 2e:17:cd:95:95:03

Hit any key to stop autoboot: 0
dsp0:gpio init config fail
dsp0:sharespace config fail
dsp0 version is r528-tina-v1.0.0-release-37-g735b6b4-dirty
DSP0 start ok, img length 254860, booting from 0x400660
[01.832]no vendor_boot partition is found
## Booting kernel from Legacy Image at 45000000 ...
Image Name:
Image Type: RISC-V Linux Kernel Image (uncompressed)
Data Size: 249576 Bytes = 243.7 KiB
Load Address: 45000000
Entry Point: 45000000
Verifying Checksum ... OK
[01.861]
Starting kernel ...

heap: [0x45077bb0 - 0x48277bb0]

\ | /
- RT - Thread Smart Operating System
/ | \ 5.0.0 build Jun 18 2022
2006 - 2020 Copyright by rt-thread team
file system initialization done!
Hello RISC-V
allwinner_d1-h board with rt-smart
msh />main : ok
main : ok

小结

  • scons 生成后的产物,跟 make 生成的产物一样,都是可执行的文件,但是不能直接在 nand flash 上启动,需要通过u-boot,读取到 RAM中执行
  • ​mkimage​​​ 打包后的 镜像文件,在原 固件上增加了 64字节的 ​​header​​ 镜像信息,可以使用 bootm 引导,传递一些 固件相关的信息等

D1 哪吒开发板 rt-smart 使用u-boot bootm 引导运行_d1 哪吒_03

  • 通过以上的操作,全志 Tina Linux SDK 中的代码,如u-boot 基本上不需要更改,​​rootfs​​​ 分区好像rt-smart暂时没有用的,为了减少​​pack​​​ 后的体积,可以 把 ​​rootfs​​​ 这个分区先注释掉,修改方法为:​​tina-d1-h/device/config/chips/d1-h/configs/nezha/sys_partition.fex​​文件,注释掉 rootfs 分区

D1 哪吒开发板 rt-smart 使用u-boot bootm 引导运行_d1 哪吒_04

  • windows 下 使用 全志平台烧写工具​​PhoenixSuit.exe​​​ 进行烧写,这里烧写到 spi nand flash 中,方法为 打开 ​​PhoenixSuit.exe​​​,选择 烧写的文件,如:​​tina_d1-h-nezha_uart0.img​​​,此时开发板断电,按住【FEL】按键不放,USB 线插入 【OTG】的那个 USB 口,烧写工具:​​PhoenixSuit.exe​​ 会自动进入烧写状态,此时就可以松开【FEL】按键

D1 哪吒开发板 rt-smart 使用u-boot bootm 引导运行_开发板_05

  • 按住【FEL】按键,并且插入 USB 【OTG】后,进入烧写模式

D1 哪吒开发板 rt-smart 使用u-boot bootm 引导运行_Image_06

  • 此时松开【FEL】按键,等待烧写完成,烧写过程,串口有打印信息



举报

相关推荐

0 条评论