Linux Kernel stops initialization at random: crng init done
Hi I have a cva6 design, I am not using SPI or ethernet. the OpenSBI + u-boot are working and now I am trying to port the Linux Kernel. I use OpenOCD + GDB to boot. The DTS file is this:
/dts-v1/;
/ {
#address-cells = <0x02>;
#size-cells = <0x02>;
compatible = "eth,ariane-bare-dev";
model = "eth,ariane-bare";
chosen {
stdout-path = "/soc/uart@10000000:115200";
};
cpus {
#address-cells = <0x01>;
#size-cells = <0x00>;
timebase-frequency = <0x17d7840>;
cpu@0 {
clock-frequency = <0x2faf080>;
device_type = "cpu";
reg = <0x00>;
status = "okay";
compatible = "eth, ariane", "riscv";
riscv,isa = "rv64imafdc";
mmu-type = "riscv,sv39";
tlb-split;
interrupt-controller {
#interrupt-cells = <0x01>;
interrupt-controller;
compatible = "riscv,cpu-intc";
phandle = <0x01>;
};
};
};
memory@80000000 {
device_type = "memory";
reg = <0x0000 0x80000000 0x00 0x40000000>;
};
soc {
#address-cells = <0x02>;
#size-cells = <0x02>;
compatible = "eth,ariane-bare-soc", "simple-bus";
ranges;
clint@2000000 {
compatible = "riscv,clint0";
interrupts-extended = <0x01 0x03 0x01 0x07>;
reg = <0x00 0x2000000 0x0 0x10000>;
reg-names = "control";
};
interrupt-controller@c000000 {
compatible = "riscv,plic0";
interrupt-controller;
#interrupt-cells = <0x01>;
interrupts-extended = <0x01 0x0b 0x01 0x09>;
reg = <0x00 0xc000000 0x00 0x40000000>;
riscv,max-priority = <0x07>;
riscv,ndev = <0x01>;
phandle = <0x02>;
};
uart@10000000 {
compatible = "ns16750", "ns16550";
reg = <0x00 0x10000000 0x00 0x1000>;
clock-frequency = <0x2faf080>;
current-speed = <0x1c200>;
interrupt-parent = <0x02>;
interrupts = <0x01>;
reg-shift = <0x02>;
reg-io-width = <0x04>;
};
};
};
I have placed the uImage at 0xa0000000 (0xa0000000 to 0xa098ba9e) using GDB restore command (writes a (binary) file to memory). Then I boot the OpenSBI and u-boot and it boots the image. I use the bootm a0000000 - $(fdtcontroladdr)" to boot the image. Also the UIMAGE_LOAD_ADDRESS and UIMAGE_ENTRY_POINT are 0x80200000. The problem is that the kernel initialization stops at random: crng init done
This is the output during boot
U-Boot 2021.07-rc4-g920075ecfa-dirty (Oct 05 2023 - 15:14:31 +0300)
CPU: rv64imafdc
DRAM: 1 GiB
MMC:
Loading Environment from nowhere... OK
In: uart@10000000
Out: uart@10000000
Err: uart@10000000
Net: No ethernet found.
Hit any key to stop autoboot: 0
## Booting kernel from Legacy Image at a0000000 ...
Image Name: CV64A6Linux
Image Type: RISC-V Linux Kernel Image (gzip compressed)
Data Size: 10009182 Bytes = 9.5 MiB
Load Address: 80200000
Entry Point: 80200000
Verifying Checksum ... OK
## Flattened Device Tree blob at bffe0750
Booting using the fdt blob at 0xbffe0750
Uncompressing Kernel Image
Using Device Tree in place at 00000000bffe0750, end 00000000bffe4da4
Starting kernel ...
[ 0.000000] Linux version 5.10.7 (dimitriosa@carvouno3.ics.forth.gr) (riscv64-buildroot-linux-gnu-gcc.br_real (Buildroot 2021.08) 10.3.0, GNU ld (GNU Binutils) 2.36.1) #43 SMP Thu Oct 5 15:15:14 EEST 2023
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] efi: UEFI not found.
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000bfffffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x00000000bfffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x00000000bfffffff]
[ 0.000000] software IO TLB: mapped [mem 0x00000000bb1e0000-0x00000000bf1e0000] (64MB)
[ 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] SBI v0.2 HSM extension detected
[ 0.000000] riscv: ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: Embedded 16 pages/cpu s25048 r8192 d32296 u65536
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 258055
[ 0.000000] Kernel command line: earlyprintk
[ 0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[ 0.000000] Sorting __ex_table...
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 945184K/1046528K available (4544K kernel code, 4213K rwdata, 2048K rodata, 184K init, 328K bss, 101344K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU event tracing is enabled.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 64 local interrupts mapped
[ 0.000000] plic: interrupt-controller@c000000: mapped 1 interrupts with 1 handlers for 2 contexts.
[ 0.000000] random: get_random_bytes called from start_kernel+0x2a2/0x410 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.000703] sched_clock: 64 bits at 25MHz, resolution 40ns, wraps every 4398046511100ns
[ 0.416611] printk: console [hvc0] enabled
[ 0.425853] Calibrating delay loop (skipped), value calculated using timer frequency.. 50.00 BogoMIPS (lpj=250000)
[ 0.446297] pid_max: default: 32768 minimum: 301
[ 0.474595] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[ 0.490724] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[ 0.684930] rcu: Hierarchical SRCU implementation.
[ 0.723842] EFI services will not be available.
[ 0.749166] smp: Bringing up secondary CPUs ...
[ 0.759162] smp: Brought up 1 node, 1 CPU
[ 0.807168] devtmpfs: initialized
[ 0.943443] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.961550] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[ 1.018142] NET: Registered protocol family 16
[ 2.788080] usbcore: registered new interface driver usbfs
[ 2.806168] usbcore: registered new interface driver hub
[ 2.822354] usbcore: registered new device driver usb
[ 2.949118] clocksource: Switched to clocksource riscv_clocksource
[ 3.126919] NET: Registered protocol family 2
[ 3.187811] tcp_listen_portaddr_hash hash table entries: 512 (order: 1, 8192 bytes, linear)
[ 3.207598] TCP established hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 3.232318] TCP bind hash table entries: 8192 (order: 5, 131072 bytes, linear)
[ 3.264580] TCP: Hash tables configured (established 8192 bind 8192)
[ 3.302236] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 3.319141] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 3.351783] NET: Registered protocol family 1
[ 3.448121] RPC: Registered named UNIX socket transport module.
[ 3.460391] RPC: Registered udp transport module.
[ 3.470736] RPC: Registered tcp transport module.
[ 3.481033] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 29.998706] workingset: timestamp_bits=62 max_order=18 bucket_order=0
[ 31.917424] NFS: Registering the id_resolver key type
[ 31.930431] Key type id_resolver registered
[ 31.940197] Key type id_legacy registered
[ 31.971311] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 34.127326] io scheduler mq-deadline registered
[ 34.137653] io scheduler kyber registered
[ 41.220260] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 41.458414] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 1, base_baud = 3125000) is a TI16750
[ 0.000000] Linux version 5.10.7 (dimitriosa@carvouno3.ics.forth.gr) (riscv64-buildroot-linux-gnu-gcc.br_real (Buildroot 2021.08) 10.3.0, GNU ld (GNU Binutils) 2.36.1) #43 SMP Thu Oct 5 15:15:14 EEST 2023
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] efi: UEFI not found.
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000bfffffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x00000000bfffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x00000000bfffffff]
[ 0.000000] software IO TLB: mapped [mem 0x00000000bb1e0000-0x00000000bf1e0000] (64MB)
[ 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] SBI v0.2 HSM extension detected
[ 0.000000] riscv: ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: Embedded 16 pages/cpu s25048 r8192 d32296 u65536
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 258055
[ 0.000000] Kernel command line: earlyprintk
[ 0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[ 0.000000] Sorting __ex_table...
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 945184K/1046528K available (4544K kernel code, 4213K rwdata, 2048K rodata, 184K init, 328K bss, 101344K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU event tracing is enabled.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 64 local interrupts mapped
[ 0.000000] plic: interrupt-controller@c000000: mapped 1 interrupts with 1 handlers for 2 contexts.
[ 0.000000] random: get_random_bytes called from start_kernel+0x2a2/0x410 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.000703] sched_clock: 64 bits at 25MHz, resolution 40ns, wraps every 4398046511100ns
[ 0.416611] printk: console [hvc0] enabled
[ 0.425853] Calibrating delay loop (skipped), value calculated using timer frequency.. 50.00 BogoMIPS (lpj=250000)
[ 0.446297] pid_max: default: 32768 minimum: 301
[ 0.474595] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[ 0.490724] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
[ 0.684930] rcu: Hierarchical SRCU implementation.
[ 0.723842] EFI services will not be available.
[ 0.749166] smp: Bringing up secondary CPUs ...
[ 0.759162] smp: Brought up 1 node, 1 CPU
[ 0.807168] devtmpfs: initialized
[ 0.943443] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.961550] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[ 1.018142] NET: Registered protocol family 16
[ 2.788080] usbcore: registered new interface driver usbfs
[ 2.806168] usbcore: registered new interface driver hub
[ 2.822354] usbcore: registered new device driver usb
[ 2.949118] clocksource: Switched to clocksource riscv_clocksource
[ 3.126919] NET: Registered protocol family 2
[ 3.187811] tcp_listen_portaddr_hash hash table entries: 512 (order: 1, 8192 bytes, linear)
[ 3.207598] TCP established hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 3.232318] TCP bind hash table entries: 8192 (order: 5, 131072 bytes, linear)
[ 3.264580] TCP: Hash tables configured (established 8192 bind 8192)
[ 3.302236] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 3.319141] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 3.351783] NET: Registered protocol family 1
[ 3.448121] RPC: Registered named UNIX socket transport module.
[ 3.460391] RPC: Registered udp transport module.
[ 3.470736] RPC: Registered tcp transport module.
[ 3.481033] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 29.998706] workingset: timestamp_bits=62 max_order=18 bucket_order=0
[ 31.917424] NFS: Registering the id_resolver key type
[ 31.930431] Key type id_resolver registered
[ 31.940197] Key type id_legacy registered
[ 31.971311] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 34.127326] io scheduler mq-deadline registered
[ 34.137653] io scheduler kyber registered
[ 41.220260] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 41.458414] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 1, base_baud = 3125000) is a TI16750
[ 42.145559] printk: console [ttyS0] enabled
[ 42.145559] printk: console [ttyS0] enabled
[ 42.355841] libphy: Fixed MDIO Bus: probed
[ 42.355841] libphy: Fixed MDIO Bus: probed
[ 42.469604] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 42.469604] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 42.556954] usbcore: registered new interface driver usbhid
[ 42.556954] usbcore: registered new interface driver usbhid
[ 42.575851] usbhid: USB HID core driver
[ 42.575851] usbhid: USB HID core driver
[ 42.735824] NET: Registered protocol family 10
[ 42.735824] NET: Registered protocol family 10
[ 42.835522] Segment Routing with IPv6
[ 42.835522] Segment Routing with IPv6
[ 42.853287] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 42.853287] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 42.957518] NET: Registered protocol family 17
[ 42.957518] NET: Registered protocol family 17
[ 43.002516] Key type dns_resolver registered
[ 43.002516] Key type dns_resolver registered
[ 43.166242] Freeing unused kernel memory: 184K
[ 43.166242] Freeing unused kernel memory: 184K
[ 43.189748] Run /init as init process
[ 43.189748] Run /init as init process
[ 63.925773] random: dd: uninitialized urandom read (512 bytes read)
[ 63.925773] random: dd: uninitialized urandom read (512 bytes read)
[ 77.198244] random: crng init done
[ 77.198244] random: crng init done
Why is this happening?