@setq
我从官方的 mars-debian 中 copy 了一份设备树过来,同时参考这个官方 debian 镜像,往我的 NixOS 镜像里补充了 /extlinux/extlinux.conf
中的一些参数,现在系统能通过 extlinux 进入到 starting kernel 阶段了,但是在跑 /init
时会报错:
[ 1.686969] Run /init as init process
[ 2.014949] device-mapper: ioctl: 4.48.0-ioctl (2023-03-01) initialised: dm-devel@redhat.com
[ 4.310922] random: crng init done
[ 11.891647] amba 16008000.sec_dma: deferred probe pending
[ 11.897669] platform 13040000.gpio: deferred probe pending
[ 11.903725] platform 10000000.serial: deferred probe pending
[ 44.178799] /dev/disk/by-label/NIXOS_SD: Can't open blockdev
我的存储卡很明确是有 NIXOS_SD
这个分区的,它是 SD 卡的第三个分区,就很奇怪。
另外前面有几个 deferred
的报错会卡一下,貌似是识别有问题了。
详细日志如下:
U-Boot SPL 2021.10 (May 31 2023 - 16:54:00 +0800)
DDR version: dc2e84f0.
Trying to boot from SPI
OpenSBI v1.2
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|___/_____|
| |
|_|
Platform Name : Milk-V Mars
Platform Features : medeleg
Platform HART Count : 5
Platform IPI Device : aclint-mswi
Platform Timer Device : aclint-mtimer @ 4000000Hz
Platform Console Device : uart8250
Platform HSM Device : ---
Platform PMU Device : ---
Platform Reboot Device : pm-reset
Platform Shutdown Device : pm-reset
Platform Suspend Device : ---
Firmware Base : 0x40000000
Firmware Size : 392 KB
Firmware RW Offset : 0x40000
Runtime SBI Version : 1.0
Domain0 Name : root
Domain0 Boot HART : 1
Domain0 HARTs : 0*,1*,2*,3*,4*
Domain0 Region00 : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: ()
Domain0 Region01 : 0x0000000040000000-0x000000004003ffff M: (R,X) S/U: ()
Domain0 Region02 : 0x0000000040040000-0x000000004007ffff M: (R,W) S/U: ()
Domain0 Region03 : 0x0000000000000000-0xffffffffffffffff M: (R,W,X) S/U: (R,W,X)
Domain0 Next Address : 0x0000000040200000
Domain0 Next Arg1 : 0x0000000042200000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Domain0 SysSuspend : yes
Boot HART ID : 1
Boot HART Domain : root
Boot HART Priv Version : v1.11
Boot HART Base ISA : rv64imafdcbx
Boot HART ISA Extensions : none
Boot HART PMP Count : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count : 2
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109
U-Boot 2021.10 (Jul 22 2023 - 09:37:08 +0000)
CPU: rv64imacu
Model: Milk-V Mars
DRAM: 4 GiB
MMC: sdio0@16010000: 0, sdio1@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, B
*** Warning - bad CRC, using default environment
StarFive EEPROM format v2
--------EEPROM INFO--------
Vendor : MILK-V
Product full SN: MARS-V11-2326-D004E000-00000010
data version: 0x2
PCB revision: 0xc1
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:75:77
--------EEPROM INFO--------
In: serial
Out: serial
Err: serial
Model: Milk-V Mars
Net: eth0: ethernet@16030000, eth1: ethernet@16040000
switch to partitions #0, OK
mmc1 is current device
found device 1
bootmode flash device 1
Can't set block device
Failed to load '/boot/uEnv.txt'
Hit any key to stop autoboot: 0
Can't set block device
Importing environment from mmc1 ...
## Info: input data size = 1682 = 0x692
## Error: "boot2" not defined
Can't set block device
## Warning: defaulting to text format
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:3...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
961 bytes read in 12 ms (78.1 KiB/s)
1: NixOS - Default
Retrieving file: /boot/extlinux/../nixos/pnr520499z4zd0sdy15zhyi8jfxxh8m5-initrd-linux-riscv64-unknown-ld
15054024 bytes read in 716 ms (20.1 MiB/s)
Retrieving file: /boot/extlinux/../nixos/d9rvcpwr83b6bwidagy4qcsnf6kzg3xp-linux-riscv64-unknown-linux-gne
24658432 bytes read in 809 ms (29.1 MiB/s)
append: init=/nix/store/5vfwv3sf4knm8c7brrpnbv42n30kq63a-nixos-system-nixos-23.11.20230724.fa02b5c/init 0
Retrieving file: /boot/extlinux/../nixos/d9rvcpwr83b6bwidagy4qcsnf6kzg3xp-linux-riscv64-unknown-linux-gnb
50259 bytes read in 21 ms (2.3 MiB/s)
## Flattened Device Tree blob at 46000000
Booting using the fdt blob at 0x46000000
Using Device Tree in place at 0000000046000000, end 000000004600f452
Starting kernel ...
clk u2_dw_i2c_clk_core already disabled
clk u2_dw_i2c_clk_apb already disabled
clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
[ 0.000000] Linux version 6.4.0 (nixbld@localhost) (riscv64-unknown-linux-gnu-gcc (GCC) 12.3.0, GNU l0
[ 0.000000] Machine model: Milk-V Mars
[ 0.000000] earlycon: uart0 at MMIO32 0x0000000010000000 (options '115200')
[ 0.000000] printk: bootconsole [uart0] enabled
[ 0.000000] efi: UEFI not found.
[ 0.000000] Reserved memory: created CMA memory pool at 0x0000000080000000, size 512 MiB
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[ 0.000000] OF: reserved mem: 0x0000000080000000..0x000000009fffffff (524288 KiB) map reusable linux,a
[ 0.000000] OF: reserved mem: 0x0000000040000000..0x000000004007ffff (512 KiB) nomap non-reusable ope0
[ 0.000000] OF: reserved mem: 0x00000000c0110000..0x00000000c01fffff (960 KiB) nomap non-reusable e240
[ 0.000000] OF: reserved mem: 0x00000000f0000000..0x00000000f1fffffe (32767 KiB) map non-reusable xrp0
[ 0.000000] NUMA: No NUMA configuration found
[ 0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000013fffffff]
[ 0.000000] NUMA: NODE_DATA [mem 0x13ffb3180-0x13ffb4fff]
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000040000000-0x00000000ffffffff]
[ 0.000000] Normal [mem 0x0000000100000000-0x000000013fffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000040000000-0x000000004007ffff]
[ 0.000000] node 0: [mem 0x0000000040080000-0x00000000c010ffff]
[ 0.000000] node 0: [mem 0x00000000c0110000-0x00000000c01fffff]
[ 0.000000] node 0: [mem 0x00000000c0200000-0x000000013fffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000013fffffff]
[ 0.000000] SBI specification v1.0 detected
[ 0.000000] SBI implementation ID=0x1 Version=0x10002
[ 0.000000] SBI TIME extension detected
[ 0.000000] SBI IPI extension detected
[ 0.000000] SBI RFENCE extension detected
[ 0.000000] SBI SRST extension detected
[ 0.000000] SBI HSM extension detected
[ 0.000000] CPU with hartid=0 is not available
[ 0.000000] CPU with hartid=0 is not available
[ 0.000000] CPU with hartid=0 is not available
[ 0.000000] CPU with hartid=0 is not available
[ 0.000000] riscv: base ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: cpu 0 has no node -1 or node-local memory
[ 0.000000] percpu: Embedded 29 pages/cpu s79672 r8192 d30920 u118784
[ 0.000000] Kernel command line: init=/nix/store/5vfwv3sf4knm8c7brrpnbv42n30kq63a-nixos-system-nixos-0
[ 0.000000] Unknown kernel command line parameters "stmmaceth=chain_mode:1 selinux=0", will be passed.
[ 0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[ 0.000000] Fallback order for Node 0: 0
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 1032192
[ 0.000000] Policy zone: Normal
[ 0.000000] mem auto-init: stack:all(zero), heap alloc:off, heap free:off
[ 0.000000] software IO TLB: area num 4.
[ 0.000000] software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] fixmap : 0xffffffc6fea00000 - 0xffffffc6ff000000 (6144 kB)
[ 0.000000] pci io : 0xffffffc6ff000000 - 0xffffffc700000000 ( 16 MB)
[ 0.000000] vmemmap : 0xffffffc700000000 - 0xffffffc800000000 (4096 MB)
[ 0.000000] vmalloc : 0xffffffc800000000 - 0xffffffd800000000 ( 64 GB)
[ 0.000000] modules : 0xffffffff01805000 - 0xffffffff80000000 (2023 MB)
[ 0.000000] lowmem : 0xffffffd800000000 - 0xffffffd900000000 (4096 MB)
[ 0.000000] kernel : 0xffffffff80000000 - 0xffffffffffffffff (2047 MB)
[ 0.000000] Memory: 3422720K/4194304K available (8380K kernel code, 5205K rwdata, 6144K rodata, 2490K)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] ftrace: allocating 30168 entries in 118 pages
[ 0.000000] ftrace: allocated 118 pages with 5 groups
[ 0.000000] trace event string verifier disabled
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=4.
[ 0.000000] rcu: RCU debug extended QS entry/exit.
[ 0.000000] Rude variant of Tasks RCU enabled.
[ 0.000000] Tracing variant of Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] CPU with hartid=0 is not available
[ 0.000000] riscv-intc: unable to find hart id for /cpus/cpu@0/interrupt-controller
[ 0.000000] riscv-intc: 64 local interrupts mapped
[ 0.000000] plic: plic@c000000: mapped 136 interrupts with 4 handlers for 9 contexts.
[ 0.000000] riscv: providing IPIs using SBI IPI extension
[ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[ 0.000000] riscv-timer: riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1]
[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idls
[ 0.000001] sched_clock: 64 bits at 4MHz, resolution 250ns, wraps every 2199023255500ns
[ 0.009283] Console: colour dummy device 80x25
[ 0.014194] printk: console [tty0] enabled
[ 0.019946] Calibrating delay loop (skipped), value calculated using timer frequency.. 8.00 BogoMIPS )
[ 0.031156] pid_max: default: 32768 minimum: 301
[ 0.036733] LSM: initializing lsm=capability,landlock,yama,integrity
[ 0.043848] landlock: Up and running.
[ 0.047885] Yama: becoming mindful.
[ 0.052084] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 0.060303] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 0.072684] cblist_init_generic: Setting adjustable number of callback queues.
[ 0.080665] cblist_init_generic: Setting shift to 2 and lim to 1.
[ 0.087545] cblist_init_generic: Setting shift to 2 and lim to 1.
[ 0.094398] riscv: ELF compat mode unsupported
[ 0.094408] ASID allocator disabled (0 bits)
[ 0.104157] rcu: Hierarchical SRCU implementation.
[ 0.109437] rcu: Max phase no-delay instances is 1000.
[ 0.116042] EFI services will not be available.
[ 0.121561] smp: Bringing up secondary CPUs ...
[ 0.129588] smp: Brought up 1 node, 4 CPUs
[ 0.136023] devtmpfs: initialized
[ 0.157364] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100s
[ 0.168142] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[ 0.197305] pinctrl core: initialized pinctrl subsystem
[ 0.205407] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[ 0.212999] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic allocations
[ 0.220874] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[ 0.229697] audit: initializing netlink subsys (disabled)
[ 0.235936] audit: type=2000 audit(0.144:1): state=initialized audit_enabled=0 res=1
[ 0.236473] thermal_sys: Registered thermal governor 'step_wise'
[ 0.244515] cpuidle: using governor ladder
[ 0.255654] cpuidle: using governor menu
[ 0.269082] platform soc: Fixed dependency cycle(s) with /soc/plic@c000000
[ 0.293875] platform soc:dsi-output: Fixed dependency cycle(s) with /soc/dc8200@29400000/port/endpoin2
[ 0.304860] platform 295d0000.mipi: Fixed dependency cycle(s) with /soc/dsi-output/ports/port@1/endpot
[ 0.315812] platform 29590000.hdmi: Fixed dependency cycle(s) with /soc/dc8200@29400000/port/endpoint1
[ 0.353206] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages
[ 0.360692] HugeTLB: 16380 KiB vmemmap can be freed for a 1.00 GiB page
[ 0.367973] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
[ 0.375442] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page
[ 0.384856] fbcon: Taking over console
[ 0.389298] iommu: Default domain type: Translated
[ 0.394676] iommu: DMA domain TLB invalidation policy: strict mode
[ 0.403642] vgaarb: loaded
[ 0.406891] clocksource: Switched to clocksource riscv_clocksource
[ 0.490431] VFS: Disk quotas dquot_6.6.0
[ 0.494900] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 0.516390] NET: Registered PF_INET protocol family
[ 0.522576] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
[ 0.537354] tcp_listen_portaddr_hash hash table entries: 2048 (order: 4, 65536 bytes, linear)
[ 0.546867] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.555564] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
[ 0.564781] TCP bind hash table entries: 32768 (order: 9, 2097152 bytes, linear)
[ 0.576375] TCP: Hash tables configured (established 32768 bind 32768)
[ 0.584690] MPTCP token hash table entries: 4096 (order: 5, 196608 bytes, linear)
[ 0.593272] UDP hash table entries: 2048 (order: 5, 196608 bytes, linear)
[ 0.601017] UDP-Lite hash table entries: 2048 (order: 5, 196608 bytes, linear)
[ 0.609583] NET: Registered PF_UNIX/PF_LOCAL protocol family
[ 0.615901] NET: Registered PF_XDP protocol family
[ 0.621201] PCI: CLS 0 bytes, default 64
[ 0.625816] Trying to unpack rootfs image as initramfs...
[ 0.627329] Initialise system trusted keyrings
[ 0.637004] workingset: timestamp_bits=44 max_order=20 bucket_order=0
[ 0.644220] zbud: loaded
[ 0.651761] Key type asymmetric registered
[ 0.656303] Asymmetric key parser 'x509' registered
[ 0.661818] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[ 0.670308] io scheduler mq-deadline registered
[ 0.675326] io scheduler kyber registered
[ 0.764565] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.779114] riscv-pmu-sbi: SBI PMU extension is available
[ 0.785113] riscv-pmu-sbi: 16 firmware and 4 hardware counters
[ 0.791550] riscv-pmu-sbi: Perf sampling/filtering is not supported as sscof extension is not availabe
[ 0.803308] drop_monitor: Initializing network drop monitor service
[ 0.850688] NET: Registered PF_INET6 protocol family
[ 1.572625] Freeing initrd memory: 14700K
[ 1.579665] Segment Routing with IPv6
[ 1.583804] In-situ OAM (IOAM) with IPv6
[ 1.603739] registered taskstats version 1
[ 1.608592] Loading compiled-in X.509 certificates
[ 1.627409] debug_vm_pgtable: [debug_vm_pgtable ]: Validating architecture page table helpers
[ 1.638095] Key type .fscrypt registered
[ 1.642529] Key type fscrypt-provisioning registered
[ 1.652076] clk: Disabling unused clocks
[ 1.667542] Freeing unused kernel image (initmem) memory: 2488K
[ 1.686969] Run /init as init process
[ 2.014949] device-mapper: ioctl: 4.48.0-ioctl (2023-03-01) initialised: dm-devel@redhat.com
[ 4.310922] random: crng init done
[ 11.891647] amba 16008000.sec_dma: deferred probe pending
[ 11.897669] platform 13040000.gpio: deferred probe pending
[ 11.903725] platform 10000000.serial: deferred probe pending
[ 44.178799] /dev/disk/by-label/NIXOS_SD: Can't open blockdev
使用的 /extlinux/extlinux.conf
配置内容如下:
› lsblk | grep sdb
sdb 8:16 1 58.2G 0 disk
├─sdb1 8:17 1 2M 0 part
├─sdb2 8:18 1 4M 0 part
└─sdb3 8:19 1 58.2G 0 part /run/media/ryan/NIXOS_SD
› cd /run/media/ryan/NIXOS_SD/
› cat boot/extlinux/extlinux.conf
# Generated file, all changes will be lost on nixos-rebuild!
# Change this to e.g. nixos-42 to temporarily boot to an older configuration.
DEFAULT nixos-default
MENU TITLE ------------------------------------------------------------
TIMEOUT 50
LABEL nixos-default
MENU LABEL NixOS - Default
LINUX ../nixos/d9rvcpwr83b6bwidagy4qcsnf6kzg3xp-linux-riscv64-unknown-linux-gnu-6.4.0-starfive-visionfive2-Image
INITRD ../nixos/pnr520499z4zd0sdy15zhyi8jfxxh8m5-initrd-linux-riscv64-unknown-linux-gnu-6.4.0-starfive-visionfive2-initrd
APPEND init=/nix/store/5vfwv3sf4knm8c7brrpnbv42n30kq63a-nixos-system-nixos-23.11.20230724.fa02b5c/init loglevel=7 root=UUID=44444444-4444-4444-8888-888888888888 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0 net.ifnames=0
FDT ../nixos/d9rvcpwr83b6bwidagy4qcsnf6kzg3xp-linux-riscv64-unknown-linux-gnu-6.4.0-starfive-visionfive2-dtbs/starfive/jh7110-starfive-visionfive-2-v1.3b.dtb