milkv-duo启动流程分析:手动构建boot.sd

这篇具有很好参考价值的文章主要介绍了milkv-duo启动流程分析:手动构建boot.sd。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

目录
  • 上电测试
  • 制作boot.sd
    • 编译Linux内核
    • multi.its

上电测试

在上一篇,我们构建了fip.bin。让我们继续用以前的boot.sd。我们插上电源,

U-Boot 2021.10 (Oct 15 2023 - 14:17:51 +0800)cvitek_cv180x

DRAM:  63.3 MiB
gd->relocaddr=0x82435000. offset=0x2235000
MMC:   cv-sd@4310000: 0
Loading Environment from <NULL>... OK
In:    serial
Out:   serial
Err:   serial
Net:
Warning: ethernet@4070000 (eth0) using random MAC address - 56:01:b8:60:16:bc
eth0: ethernet@4070000
cv180x_c906#

并没有进入linux系统。这是因为我们没有设置好bootargs。手动输入

set bootargs root=/dev/mmcblk0p2 rootwait rw console=ttyS0,115200 earlycon=sbi loglevel=9 riscv.fwsz=0x80000
printenv # 验证bootargs是否设置好
mmc dev 0
fatload mmc 0 0x81400000 boot.sd
bootm 0x81400000#config-cv1800b_milkv_duo_sd

此时,成功加载linux内核。输出如下:

cv180x_c906# set bootargs root=/dev/mmcblk0p2 rootwait rw console=ttyS0,115200 earlycon=sbi loglevel=9 riscv.fwsz=0x80000
cv180x_c906# printenv
baudrate=115200
bootargs=root=/dev/mmcblk0p2 rootwait rw console=ttyS0,115200 earlycon=sbi loglevel=9 riscv.fwsz=0x80000
bootdelay=1
fdtcontroladdr=81beee70
gatewayip=192.168.0.11
ipaddr=192.168.0.3
netmask=255.255.255.0
serverip=192.168.56.101
stderr=serial
stdin=serial
stdout=serial

Environment size: 287/131068 bytes
cv180x_c906# mmc dev 0
switch to partitions #0, OK
mmc0 is current device
cv180x_c906# fatload mmc 0 0x81400000 boot.sd
2748016 bytes read in 123 ms (21.3 MiB/s)
cv180x_c906# bootm 0x81400000#config-cv1800b_milkv_duo_sd
## Loading kernel from FIT Image at 81400000 ...
   Using 'config-cv1800b_milkv_duo_sd' configuration
   Trying 'kernel-1' kernel subimage
   Verifying Hash Integrity ... crc32+ OK
## Loading fdt from FIT Image at 81400000 ...
   Using 'config-cv1800b_milkv_duo_sd' configuration
   Trying 'fdt-cv1800b_milkv_duo_sd' fdt subimage
   Verifying Hash Integrity ... sha256+ OK
   Booting using the fdt blob at 0x81699d8c
   Uncompressing Kernel Image
   Decompressing 6128640 bytes used 1022ms
   Loading Device Tree to 0000000081be5000, end 0000000081becb80 ... OK

Starting kernel ...

[    0.000000] Linux version 5.10.4-tag- (ubuntu@linux) (riscv64-unknown-linux-musl-gcc (Xuantie-900 linux-5.10.4 musl gcc Toolchain V2.6.1 B-20220906) 10.2.0, GNU ld (GNU Binutils) 2.35) #1 PREEMPT Fri Sep 8 17:23:15 CST 2023
[    0.000000] earlycon: sbi0 at I/O port 0x0 (options '')
[    0.000000] printk: bootconsole [sbi0] enabled
[    0.000000] efi: UEFI not found.
[    0.000000] Ion: Ion memory setup at 0x0000000082473000 size 26 MiB
[    0.000000] OF: reserved mem: initialized node ion, compatible id ion-region
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000080000000-0x0000000083f3ffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080000000-0x0000000083f3ffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x0000000083f3ffff]
[    0.000000] On node 0 totalpages: 16192
[    0.000000]   DMA32 zone: 222 pages used for memmap
[    0.000000]   DMA32 zone: 0 pages reserved
[    0.000000]   DMA32 zone: 16192 pages, LIFO batch:3
[    0.000000] SBI specification v0.3 detected
[    0.000000] SBI implementation ID=0x1 Version=0x9
[    0.000000] SBI v0.2 TIME extension detected
[    0.000000] SBI v0.2 IPI extension detected
[    0.000000] SBI v0.2 RFENCE extension detected
[    0.000000] riscv: ISA extensions acdfimsuv
[    0.000000] riscv: ELF capabilities acdfimv
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 15970
[    0.000000] Kernel command line: root=/dev/mmcblk0p2 rootwait rw console=ttyS0,115200 earlycon=sbi loglevel=9 riscv.fwsz=0x80000
[    0.000000] Dentry cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.000000] Sorting __ex_table...
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 29360K/64768K available (3671K kernel code, 457K rwdata, 1651K rodata, 144K init, 195K bss, 35408K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000]  Trampoline variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] riscv-intc: 64 local interrupts mapped
[    0.000000] plic: interrupt-controller@70000000: mapped 101 interrupts with 1 handlers for 2 contexts.
[    0.000000] random: get_random_bytes called from start_kernel+0x2e0/0x41c with crng_init=0
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x5c40939b5, max_idle_ns: 440795202646 ns
[    0.000009] sched_clock: 64 bits at 25MHz, resolution 40ns, wraps every 4398046511100ns
[    0.008426] Calibrating delay loop (skipped), value calculated using timer frequency.. 50.00 BogoMIPS (lpj=100000)
[    0.019130] pid_max: default: 4096 minimum: 301
[    0.024024] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.031443] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.041123] ASID allocator initialised with 65536 entries
[    0.046851] rcu: Hierarchical SRCU implementation.
[    0.052224] EFI services will not be available.
[    0.057315] devtmpfs: initialized
[    0.066811] early_time_log: do_initcalls: 213042185us
[    0.072655] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.082707] futex hash table entries: 16 (order: -4, 384 bytes, linear)
[    0.089676] pinctrl core: initialized pinctrl subsystem
[    0.095592] NET: Registered protocol family 16
[    0.100657] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
[    0.107988] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.116886] thermal_sys: Registered thermal governor 'step_wise'
[    0.132712] OF: /gpio@03020000/gpio-controller@0: could not find phandle
[    0.145927] OF: /gpio@03021000/gpio-controller@1: could not find phandle
[    0.152921] OF: /gpio@03022000/gpio-controller@2: could not find phandle
[    0.159909] OF: /gpio@03023000/gpio-controller@3: could not find phandle
[    0.166896] OF: /gpio@05021000/gpio-controller@4: could not find phandle
[    0.175708] clk reset: nr_reset=64 resource_size=8
[    0.181298] get audio clk=24576000
[    0.184841] cvitek-i2s-subsys 4108000.i2s_subsys: Set clk_sdma_aud0~3 to 24576000
[    0.205583] dw_dmac 4330000.dma: CVITEK DMA Controller, 8 channels, probe done!
[    0.213990] SCSI subsystem initialized
[    0.218421] usbcore: registered new interface driver usbfs
[    0.224202] usbcore: registered new interface driver hub
[    0.229820] usbcore: registered new device driver usb
[    0.238579] Ion: ion_parse_dt_heap_common: id 0 type 2 name carveout align 1000
[    0.246526] Ion: rmem_ion_device_init: heap carveout base 0x0000000082473000 size 0x0000000001acd000 dev (____ptrval____)
[    0.257809] ion_carveout_heap_create, size=0x1acd000
[    0.263119] cvi_get_rtos_ion_size, rtos ion_size get:0x0
[    0.398492] platform carveout: [ion] add heap id 0, type 2, base 0x82473000, size 0x1acd000
[    0.407494] Advanced Linux Sound Architecture Driver Initialized.
[    0.415155] clocksource: Switched to clocksource riscv_clocksource
[    0.423753] NET: Registered protocol family 2
[    0.429400] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.438104] TCP established hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.445895] TCP bind hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.453168] TCP: Hash tables configured (established 512 bind 512)
[    0.459775] UDP hash table entries: 128 (order: 0, 4096 bytes, linear)
[    0.466543] UDP-Lite hash table entries: 128 (order: 0, 4096 bytes, linear)
[    0.474011] NET: Registered protocol family 1
[    0.479224] RPC: Registered named UNIX socket transport module.
[    0.485337] RPC: Registered udp transport module.
[    0.490220] RPC: Registered tcp transport module.
[    0.495154] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.504431] Initialise system trusted keyrings
[    0.509347] workingset: timestamp_bits=62 max_order=13 bucket_order=0
[    0.524247] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.531525] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.538720] Key type asymmetric registered
[    0.542935] Asymmetric key parser 'x509' registered
[    0.554266] Serial: 8250/16550 driver, 5 ports, IRQ sharing disabled
[    0.562885] printk: console [ttyS0] disabled
[    0.567417] 4140000.serial: ttyS0 at MMIO 0x4140000 (irq = 15, base_baud = 15[    0.576454] printk: console [ttyS0] enabled
[    0.576454] printk: console [ttyS0] enabled
[    0.585055] printk: bootconsole [sbi0] disabled
[    0.585055] printk: bootconsole [sbi0] disabled
[    0.595433] 41c0000.serial: ttyS4 at MMIO 0x41c0000 (irq = 16, base_baud = 1562500) is a 16550A
[    0.608002] cvi-spif 10000000.cvi-spif: unrecognized JEDEC id bytes: 00 00 00 00 00 00
[    0.616235] cvi-spif 10000000.cvi-spif: device scan failed
[    0.621961] cvi-spif 10000000.cvi-spif: unable to setup flash chip
[    0.635279] libphy: Fixed MDIO Bus: probed
[    0.640124] bm-dwmac 4070000.ethernet: IRQ eth_wake_irq not found
[    0.646491] bm-dwmac 4070000.ethernet: IRQ eth_lpi not found
[    0.652473] bm-dwmac 4070000.ethernet: Hash table entries set to unexpected value 0
[    0.660549] bm-dwmac 4070000.ethernet: no reset control found
[    0.666794] bm-dwmac 4070000.ethernet: User ID: 0x10, Synopsys ID: 0x37
[    0.673715] bm-dwmac 4070000.ethernet:       DWMAC1000
[    0.678616] bm-dwmac 4070000.ethernet: DMA HW capability register supported
[    0.685834] bm-dwmac 4070000.ethernet: RX Checksum Offload Engine supported
[    0.693053] bm-dwmac 4070000.ethernet: COE Type 2
[    0.697941] bm-dwmac 4070000.ethernet: TX Checksum insertion supported
[    0.704712] bm-dwmac 4070000.ethernet: Normal descriptors
[    0.710317] bm-dwmac 4070000.ethernet: Ring mode enabled
[    0.715834] bm-dwmac 4070000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    0.723595] bm-dwmac 4070000.ethernet: device MAC address 56:01:b8:60:16:bc
[    0.758313] libphy: stmmac: probed
[    0.763720] bm-dwmac 4070000.ethernet: Cannot get clk_500m_eth!
[    0.769982] bm-dwmac 4070000.ethernet: Cannot get gate_clk_axi4!
[    0.777363] dwc2 4340000.usb: axi clk installed
[    0.782155] dwc2 4340000.usb: apb clk installed
[    0.786903] dwc2 4340000.usb: 125m clk installed
[    0.791711] dwc2 4340000.usb: 33k clk installed
[    0.796423] dwc2 4340000.usb: 12m clk installed
[    0.801230] dwc2 4340000.usb: EPs: 8, dedicated fifos, 3072 entries in SPRAM
[    0.809139] dwc2 4340000.usb: DWC OTG Controller
[    0.814015] dwc2 4340000.usb: new USB bus registered, assigned bus number 1
[    0.821287] dwc2 4340000.usb: irq 36, io mem 0x04340000
[    0.827744] hub 1-0:1.0: USB hub found
[    0.831771] hub 1-0:1.0: 1 port detected
[    0.837606] usbcore: registered new interface driver usb-storage
[    0.844292] i2c /dev entries driver
[    0.850052] sdhci: Secure Digital Host Controller Interface driver
[    0.856505] sdhci: Copyright(c) Pierre Ossman
[    0.861032] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.867205] cvi:sdhci_cvi_probe
[    0.915179] mmc0: SDHCI controller on 4310000.cv-sd [4310000.cv-sd] using ADMA 64-bit
[    0.923348] cvi_proc_init cvi_host 0x(____ptrval____)
[    0.929361] usbcore: registered new interface driver usbhid
[    0.939183] usbhid: USB HID core driver
[    0.945143] cvitek-i2s 4100000.i2s: cvi_i2s_probe
[    0.955416] cvitek-i2s 4130000.i2s: cvi_i2s_probe
[    0.961140] cviteka-adc sound_adc: cviteka_adc_probe, dev name=sound_adc
[    0.968253] cviteka-adc sound_adc: cviteka_adc_probe start devm_snd_soc_register_card
[    0.976859] cvitekaadc 300a100.adc: cvitekaadc_probe
[    0.987836] cviteka-dac sound_dac: cviteka_dac_probe, dev name=sound_dac
[    0.995305] cvitekadac 300a000.dac: cvitekadac_probe
[    1.000899] cvitekadac_probe gpio_is_valid mute_pin_l
[    1.006798] NET: Registered protocol family 17
[    1.011688] Loading compiled-in X.509 certificates
[    1.054102] cviteka-adc sound_adc: cviteka_adc_probe, dev name=sound_adc
[    1.067170] cviteka-adc sound_adc: cviteka_adc_probe start devm_snd_soc_register_card
[    1.075319] mmc0: new high speed SDHC card at address b36a
[    1.087409] mmcblk0: mmc0:b36a SDABC 14.7 GiB
[    1.092645] cviteka-dac sound_dac: cviteka_dac_probe, dev name=sound_dac
[    1.102016]  mmcblk0: p1 p2 p3
[    1.112630] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.123713] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.130791] cfg80211: failed to load regulatory.db
[    1.136015] ALSA device list:
[    1.139519] dw-apb-uart 4140000.serial: forbid DMA for kernel console
[    1.171230] random: fast init done
[    1.934313] EXT4-fs (mmcblk0p2): warning: maximal mount count reached, running e2fsck is recommended
[    1.945590] EXT4-fs (mmcblk0p2): recovery complete
[    1.951468] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.959947] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    1.967336] devtmpfs: mounted
[    1.970578] Freeing unused kernel memory: 144K
[    1.975218] Kernel memory protection not selected by kernel config.
[    1.981737] Run /sbin/init as init process
[    1.986002]   with arguments:
[    1.989097]     /sbin/init
[    1.991923]   with environment:
[    1.995197]     HOME=/
[    1.997639]     TERM=linux
[    2.000464] early_time_log: run_init_process: 214975847us
INIT: version  booting
INIT: No inittab.d directory found
[    2.163881] EXT4-fs (mmcblk0p2): re-mounted. Opts: errors=remount-ro
INIT: Entering runlevel: 3
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Seeding 2048 bits without crediting
Saving 2048 bits of non-creditable seed for next boot
Starting network: OK
Starting dhcpcd...
dhcpcd-10.0.1 starting
[    2.735438] random: dhcpcd: uninitialized urandom read (112 bytes read)
DUID 00:01:00:01:c7:92:bc:82:9a:7d:37:16:00:d6
dhcp_vendor: Invalid argument
forked to background, child pid 148
[    2.917729] bm-dwmac 4070000.ethernet eth0: PHY [stmmac-0:00] driver [Generic PHY] (irq=POLL)
[    2.943246] dwmac1000: Master AXI performs any burst length
Starting ntpd: [    2.951530] bm-dwmac 4070000.ethernet eth0: No Safety Features support found
[    2.962794] bm-dwmac 4070000.ethernet eth0: IEEE 1588-2002 Timestamp supported
[    2.972006] bm-dwmac 4070000.ethernet eth0: configuring for phy/rmii link mode
OK
Starting dropbear sshd: OK
Starting dnsmasq: [    8.231807] random: dnsmasq: uninitialized urandom read (128 bytes read)
[    8.238854] random: dnsmasq: uninitialized urandom read (48 bytes read)
OK
init mpp system...
Starting app...

Welcome to Milk-V
milkv-duo login: [    8.548591] using random self ethernet address
[    8.553351] using random host ethernet address
[    8.559771] dwc2 4340000.usb: new device is high-speed
[    8.672669] usb0: HOST MAC 42:df:56:b5:0c:15
[    8.683692] usb0: MAC fa:94:99:e0:c3:8a
[    8.691332] dwc2 4340000.usb: bound driver configfs-gadget
[    8.919691] dwc2 4340000.usb: new device is high-speed
[    8.953863] dwc2 4340000.usb: new address 32

制作boot.sd

编译Linux内核

首先先把defconfig复制过去。修改向量指令的设置。

CONFIG_VECTOR=n
CONFIG_VECTOR_0_7=n

终端执行

cp build/boards/cv180x/cv1800b_milkv_duo_sd/linux/cvitek_cv1800b_milkv_duo_sd_defconfig linux_5.10/.config
export ARCH=riscv
export CROSS_COMPILE=riscv64-buildroot-linux-musl-
make menuconfig
make -j64

遇到报错

riscv64-unknown-linux-gnu-gcc: error: unrecognized command-line option '-mno-ldd'
riscv64-unknown-linux-gnu-gcc: error: unrecognized command-line option '-mno-ldd'
make[1]: *** [scripts/Makefile.build:279: scripts/mod/empty.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [scripts/Makefile.build:117: scripts/mod/devicetable-offsets.s] Error 1
make: *** [Makefile:1205: prepare0] Error 2

找到linux_5.10/arch/riscv/Makefile,删掉:

# workaround for C906 ldd performance issue
ifeq ($(CONFIG_ARCH_CVITEK),y)
	KBUILD_CFLAGS += -mno-ldd
endif

又遇到报错:

./arch/riscv/include/asm/vdso/gettimeofday.h: Assembler messages:
./arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01', extension `zicsr' required
./arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01', extension `zicsr' required
make[1]: *** [scripts/Makefile.build:279: arch/riscv/kernel/vdso/vgettimeofday.o] Error 1
make: *** [arch/riscv/Makefile:103: vdso_prepare] Error 2

修改上一个makefile:

# ISA string setting
riscv-march-cflags-$(CONFIG_ARCH_RV32I)		:= rv32ima
riscv-march-cflags-$(CONFIG_ARCH_RV64I)		:= rv64ima
riscv-march-cflags-$(CONFIG_RISCV_ISA_C)	:= $(riscv-march-cflags-y)c

riscv-march-aflags-$(CONFIG_ARCH_RV32I)		:= rv32ima
riscv-march-aflags-$(CONFIG_ARCH_RV64I)		:= rv64ima
riscv-march-aflags-$(CONFIG_FPU)		:= $(riscv-march-aflags-y)fd
riscv-march-aflags-$(CONFIG_RISCV_ISA_C)	:= $(riscv-march-aflags-y)c
riscv-march-aflags-$(CONFIG_VECTOR_1_0)		:= $(riscv-march-aflags-y)v
riscv-march-aflags-$(CONFIG_VECTOR_0_7)		:= $(riscv-march-aflags-y)v0p7
riscv-march-aflags-$(CONFIG_RISCV_ISA_THEAD)	:= $(riscv-march-aflags-y)xthead

riscv-march-cflags-y	:= $(riscv-march-cflags-y)_zicsr_zifencei
riscv-march-aflags-y	:= $(riscv-march-aflags-y)_zicsr_zifencei

此时,内核成功编译。

GEN     modules.builtin
  LD      .tmp_vmlinux.kallsyms1
  KSYMS   .tmp_vmlinux.kallsyms1.S
  AS      .tmp_vmlinux.kallsyms1.S
  LD      .tmp_vmlinux.kallsyms2
  KSYMS   .tmp_vmlinux.kallsyms2.S
  AS      .tmp_vmlinux.kallsyms2.S
  LD      vmlinux
  SYSMAP  System.map
  MODPOST Module.symvers
  OBJCOPY arch/riscv/boot/Image
  CC [M]  drivers/staging/fbtft/fb_ssd1306.mod.o
  CC [M]  drivers/thermal/cv180x_thermal.mod.o
  CC [M]  drivers/video/fbdev/core/cfbcopyarea.mod.o
  CC [M]  drivers/video/fbdev/core/cfbfillrect.mod.o
  CC [M]  drivers/video/fbdev/core/cfbimgblt.mod.o
  CC [M]  fs/efivarfs/efivarfs.mod.o
  GZIP    arch/riscv/boot/Image.gz
  LD [M]  drivers/staging/fbtft/fb_ssd1306.ko
  LD [M]  drivers/video/fbdev/core/cfbfillrect.ko
  LD [M]  drivers/thermal/cv180x_thermal.ko
  LD [M]  fs/efivarfs/efivarfs.ko
  LD [M]  drivers/video/fbdev/core/cfbcopyarea.ko
  LD [M]  drivers/video/fbdev/core/cfbimgblt.ko
  Kernel: arch/riscv/boot/Image.gz is ready

multi.its

编译好内核后,我们得到了gzip压缩过的内核映像Image.gz。要生成boot.sd,前置条件是multi.its,因为有命令:

$(COMMON_TOOLS_PATH)/prebuild/mkimage -f ${RAMDISK_PATH}/${RAMDISK_OUTPUT_FOLDER}/multi.its -k $(RAMDISK_PATH)/keys -r $(OUTPUT_DIR)/ramboot.itb

正是通过mkimage命令,才生成了boot.sd文件。

有这样一个文件ramdisk/configs/cv180x/multi.its,但是这个文件并不能给我们提供任何有用的信息。我们从RT-Thread的源码中找到了对于我们来说有用的描述:

/*
 * U-Boot uImage source file with multiple kernels, ramdisks and FDT blobs
 */
/dts-v1/;
/ {
  description = "Various kernels, ramdisks and FDT blobs";
  #address-cells = <2>;
  images {
    kernel-1 {
      description = "cvitek kernel";
      data = /incbin/("./Image.gz");
      type = "kernel";
      arch = "riscv";
      os = "linux";
      compression = "gzip";
      load = <0x0 0x80200000>;
      entry = <0x0 0x80200000>;
      hash-2 {
        algo = "crc32";
      };
    };
    /*FDT*/
    fdt-cv1800b_milkv_duo_sd {
        description = "cvitek device tree - cv1800b_milkv_duo_sd";
        data = /incbin/("./cv1800b_milkv_duo_sd.dtb");
        type = "flat_dt";
        arch = "riscv";
        compression = "none";
        hash-1 {
            algo = "sha256";
        };
    };
  };
  /*CFG*/
    configurations {   
        config-cv1800b_milkv_duo_sd {
            description = "boot cvitek system with board cv1800b_milkv_duo_sd";
            kernel = "kernel-1";
            fdt = "fdt-cv1800b_milkv_duo_sd";
        };
    };
};

此时,我们只需要在目录下准备好Image.gzcv1800b_milkv_duo_sd.dtb,就可以生成boot.sd了。

$ mkimage -f multi.its boot.sd
FIT description: Various kernels, ramdisks and FDT blobs
Created:         Mon Oct 16 14:34:14 2023
 Image 0 (kernel-1)
  Description:  cvitek kernel
  Created:      Mon Oct 16 14:34:14 2023
  Type:         Kernel Image
  Compression:  gzip compressed
  Data Size:    3631893 Bytes = 3546.77 KiB = 3.46 MiB
  Architecture: RISC-V
  OS:           Linux
  Load Address: 0x80200000
  Entry Point:  0x80200000
  Hash algo:    crc32
  Hash value:   4db6697f
 Image 1 (fdt-cv1800b_milkv_duo_sd)
  Description:  cvitek device tree - cv1800b_milkv_duo_sd
  Created:      Mon Oct 16 14:34:14 2023
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    23473 Bytes = 22.92 KiB = 0.02 MiB
  Architecture: RISC-V
  Hash algo:    sha256
  Hash value:   227f94b627feee0b26eef20a03f15a00bd9facbe99c2e7d366cbcac7089aaa94
 Configuration 0 (config-cv1800b_milkv_duo_sd)
  Description:  boot cvitek system with board cv1800b_milkv_duo_sd
  Kernel:       kernel-1
  FDT:          fdt-cv1800b_milkv_duo_sd
$ ls
bl2.bin  chip_conf.bin             ddr_param.bin  fiptool.py      Image.gz   u-boot.bin
boot.sd  cv1800b_milkv_duo_sd.dtb  fip.bin        fw_dynamic.bin  multi.its

成功生成boot.sd文章来源地址https://www.toymoban.com/news/detail-710754.html

到了这里,关于milkv-duo启动流程分析:手动构建boot.sd的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 三分钟了解Spring Boot 的启动流程

    👏作者简介:大家好,我是冰点,从业11年,目前在物流独角兽企业从事技术方面工作, 🍂博主正在努力完成2023计划中:以梦为马,扬帆起航,2023追梦人 📝联系方式:iceicepip,加我进群,大家一起学习,一起进步👀 背景:最近有位开发同学说面试被问到Spring Boot 的启动

    2024年02月08日
    浏览(47)
  • Spring Boot程序的打包与运行:构建高效部署流程

    引言 在现代应用开发中,高效的打包和部署流程对于项目的开发、测试和上线至关重要。Spring Boot作为一种快速开发框架,提供了方便的打包工具和内嵌式的Web服务器,使得打包和运行变得更加简单。本文将研究在Spring Boot应用中如何进行打包,帮助开发者构建高效的部署流

    2024年01月20日
    浏览(41)
  • 全网最清楚的:Spring Boot 启动流程讲解

    Spring Boot 启动流程 简介 步骤 加载配置 创建应用程序上下文 执行自动配置 启动应用程序 处理请求 源码层说明 扩展 自定义注解以及自定义注解实现中有bean,与启动流程什么有关 Bean扫描 注解处理 Spring Boot 的启动流程 充分利用了 Spring 框架的强大功能,同时又为开发者提供

    2024年02月07日
    浏览(47)
  • Spring Boot 3.x 系列【51】启动流程 | 最后阶段

    有道无术,术尚可求,有术无道,止于术。 本系列Spring Boot版本3.1.0 源码地址:https://gitee.com/pearl-organization/study-spring-boot3 终于启动流程到了最后一个阶段,这里主要是打印启动完成日志、调用监听器、运行 Runners 等 。

    2024年02月15日
    浏览(44)
  • 还不懂 Spring Boot 启动流程的,看这一篇就够了!

    通常,我们只需为一个类添加@SpringBootApplication注解,然后再添加一个main方法,其内固定的写法为SpringApplication.run(Application.class, args)。由此,便可启动Spring Boot服务。 具体而言,Spring Boot的启动流程包括以下几个步骤: 载入 Spring Boot 应用的启动类 根据启动类所在的包路径扫

    2024年02月05日
    浏览(44)
  • Spring Boot 3.x 系列【49】启动流程 | 创建、准备应用上下文

    有道无术,术尚可求,有术无道,止于术。 本系列Spring Boot版本3.1.0 源码地址:https://gitee.com/pearl-organization/study-spring-boot3

    2024年02月14日
    浏览(41)
  • Spring Boot启动源码分析

    版本:spring-boot-starter-parent版本为2.3.0 Spring Boot项目的启动入口是一个main方法,因此我们从该方法入手即可 跟踪run方法 这里分两步debug: new SpringApplication( primarySources ) 执行run()方法 deduceFromClasspath推断应用程序类型 该方法根据是否存在指定路径的类来推断应用程序类型。有

    2024年02月07日
    浏览(50)
  • spring boot启动原理分析

    springboot启动类中有两个关键的地方 1.@SpringBootApplication 注解 2.SpringApplication.run 方法 SpringBootApplication 注解分析 SpringBootApplication 注解由三大注解构成, SpringBootConfiguration 、 EnableAutoConfiguration 、 ComponentScan 。 SpringBootConfiguration 中其实主要就是包装了Configuration注解 EnableAutoConf

    2024年02月11日
    浏览(45)
  • Spring Boot 启动注解分析

    虽然我们在日常开发中,Spring Boot 使用非常多,算是目前 Java 开发领域一个标配了,但是小伙伴们仔细想想自己的面试经历,和 Spring Boot 相关的面试题都有哪些?个人感觉应该是比较少的,Spring Boot 本质上还是曾经 SSM 那一套,只是通过各种 starter 简化了配置而已,其他都是

    2024年02月13日
    浏览(42)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包