您尚未登录。

楼主 # 2022-08-30 00:45:14

laozhu
会员
注册时间: 2021-08-10
已发帖子: 27
积分: 81.5

求助v3s使用buildroot 2020.02.1后linux启动超过两分钟

如题所示,之前使用buildroot 2017.08版本的时候不会出现此现象。系统打印信息如下:

U-Boot SPL 2017.01-rc2-00057-g32ab1804cd-dirty (Aug 27 2022 - 08:57:15)
DRAM: 64 MiB
Trying to boot from MMC1

U-Boot 2017.01-rc2-00057-g32ab1804cd-dirty (Aug 27 2022 - 08:57:15 -0700) Allwinner Technology

CPU:   Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM:  64 MiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

Setting up a 800x480 lcd console (overscan 0x0)
dotclock: 33000kHz = 33000kHz: (1 * 3MHz * 66) / 6
In:    serial@01c28000
Out:   serial@01c28000
Err:   serial@01c28000


U-Boot 2017.01-rc2-00057-g32ab1804cd-dirty (Aug 27 2022 - 08:57:15 -0700) Allwinner Technology

CPU:   Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM:  64 MiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

Setting up a 800x480 lcd console (overscan 0x0)
dotclock: 33000kHz = 33000kHz: (1 * 3MHz * 66) / 6
In:    serial@01c28000
Out:   serial@01c28000
Err:   serial@01c28000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0
reading zImage
4527656 bytes read in 231 ms (18.7 MiB/s)
reading sun8i-v3s-licheepi-zero-dock.dtb
12589 bytes read in 26 ms (472.7 KiB/s)
## Flattened Device Tree blob at 41800000
   Booting using the fdt blob at 0x41800000
   Loading Device Tree to 42df9000, end 42dff12c ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.2.0-v3s+ (laozhu@ubuntu) (gcc version 7.5.0 (Linaro GCC 7.5-2019.12)) #11 SMP Mon Aug 29 22:45:42 CST 2022
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Zero with Dock
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] cma: Reserved 32 MiB at 0x40c00000
[    0.000000] percpu: Embedded 16 pages/cpu s34508 r8192 d22836 u65536
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 15883
[    0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 earlyprintk rw vt.global_cursor_default=0
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 19680K/64036K available (7168K kernel code, 305K rwdata, 1748K rodata, 1024K init, 254K bss, 11588K reserved, 32768K cma-reserved, 0K highmem)
[    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: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] random: get_random_bytes called from start_kernel+0x2f8/0x484 with crng_init=0
[    0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (virt).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000006] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.000018] Switching to timer-based delay loop, resolution 41ns
[    0.000220] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000455] Console: colour dummy device 80x30
[    0.000511] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[    0.000527] pid_max: default: 32768 minimum: 301
[    0.000688] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000703] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.001501] CPU: Testing write buffer coherency: ok
[    0.002043] /cpus/cpu@0 missing clock-frequency property
[    0.002070] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.002856] Setting up static identity map for 0x40100000 - 0x40100060
[    0.003076] rcu: Hierarchical SRCU implementation.
[    0.003615] smp: Bringing up secondary CPUs ...
[    0.003635] smp: Brought up 1 node, 1 CPU
[    0.003645] SMP: Total of 1 processors activated (48.00 BogoMIPS).
[    0.003652] CPU: All CPU(s) started in SVC mode.
[    0.004772] devtmpfs: initialized
[    0.008378] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.008684] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.008712] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[    0.010214] pinctrl core: initialized pinctrl subsystem
[    0.011360] NET: Registered protocol family 16
[    0.012549] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.013844] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.013863] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.038408] SCSI subsystem initialized
[    0.038591] usbcore: registered new interface driver usbfs
[    0.038650] usbcore: registered new interface driver hub
[    0.038754] usbcore: registered new device driver usb
[    0.038993] mc: Linux media interface: v0.10
[    0.039038] videodev: Linux video capture interface: v2.00
[    0.039665] ion_parse_dt_heap_common: id 4 type 4 name cma align 1000
[    0.040336] Advanced Linux Sound Architecture Driver Initialized.
[    0.041851] clocksource: Switched to clocksource arch_sys_counter
[    0.053568] NET: Registered protocol family 2
[    0.054402] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.054443] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.054469] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.054491] TCP: Hash tables configured (established 1024 bind 1024)
[    0.054642] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.054694] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.055003] NET: Registered protocol family 1
[    0.057543] Initialise system trusted keyrings
[    0.057949] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.097457] Key type asymmetric registered
[    0.097478] Asymmetric key parser 'x509' registered
[    0.097580] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    0.097592] io scheduler mq-deadline registered
[    0.097600] io scheduler kyber registered
[    0.098668] sun4i-usb-phy 1c19400.phy: Couldn't request ID GPIO
[    0.102714] sun8i-v3s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.170051] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.172574] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pb not found, using dummy regulator
[    0.173684] printk: console [ttyS0] disabled
[    0.193996] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 37, base_baud = 1500000) is a U6_16550A
[    0.713406] printk: console [ttyS0] enabled
[    0.744056] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.750592] ehci-platform: EHCI generic platform driver
[    0.756184] ehci-platform 1c1a000.usb: EHCI Host Controller
[    0.761851] ehci-platform 1c1a000.usb: new USB bus registered, assigned bus number 1
[    0.769912] ehci-platform 1c1a000.usb: irq 27, io mem 0x01c1a000
[    0.801868] ehci-platform 1c1a000.usb: USB 2.0 started, EHCI 1.00
[    0.809111] hub 1-0:1.0: USB hub found
[    0.813072] hub 1-0:1.0: 1 port detected
[    0.817697] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.824022] ohci-platform: OHCI generic platform driver
[    0.829579] ohci-platform 1c1a400.usb: Generic Platform OHCI controller
[    0.836301] ohci-platform 1c1a400.usb: new USB bus registered, assigned bus number 2
[    0.844409] ohci-platform 1c1a400.usb: irq 28, io mem 0x01c1a400
[    0.916984] hub 2-0:1.0: USB hub found
[    0.920824] hub 2-0:1.0: 1 port detected
[    0.928184] usbcore: registered new interface driver usb-storage
[    0.935520] input: 1c22800.lradc as /devices/platform/soc/1c22800.lradc/input/input0
[    0.944906] sun6i-rtc 1c20400.rtc: registered as rtc0
[    0.949970] sun6i-rtc 1c20400.rtc: RTC enabled
[    0.954716] i2c /dev entries driver
[    0.959643] input: ns2009_ts as /devices/platform/soc/1c2ac00.i2c/i2c-0/0-0048/input/input1
[    0.969484] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[    0.978252] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pf not found, using dummy regulator
[    1.014888] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[    1.022187] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pg not found, using dummy regulator
[    1.057235] sunxi-mmc 1c10000.mmc: initialized, max. request size: 16384 KB
[    1.065395] usbcore: registered new interface driver usbhid
[    1.070972] usbhid: USB HID core driver
[    1.075055] sunxi-cedar 1c0e000.video-codec: sunxi cedar version 0.01alpha
[    1.082153] sunxi-cedar 1c0e000.video-codec: cedar-ve the get irq is 22
[    1.091772] sun4i-codec 1c22c00.codec: ASoC: codec-analog@01c23000 not registered
[    1.099402] sun4i-codec 1c22c00.codec: Failed to register our card
[    1.106962] Initializing XFRM netlink socket
[    1.111316] NET: Registered protocol family 17
[    1.116494] Registering SWP/SWPB emulation handler
[    1.122590] Loading compiled-in X.509 certificates
[    1.132951] simple-framebuffer 43e89000.framebuffer: framebuffer at 0x43e89000, 0x177000 bytes, mapped to 0x(ptrval)
[    1.143594] simple-framebuffer 43e89000.framebuffer: format=x8r8g8b8, mode=800x480x32, linelength=3200
[    1.159846] Console: switching to colour frame buffer device 100x30
[    1.172380] simple-framebuffer 43e89000.framebuffer: fb0: simplefb registered!
[    1.181155] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.192720] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.198487] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 3
[    1.208065] hub 3-0:1.0: USB hub found
[    1.212132] hub 3-0:1.0: 1 port detected
[    1.216125] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.226690] debugfs: Directory '1c22c00.codec' with parent 'V3s Audio Codec' already present!
[    1.235424] sun4i-codec 1c22c00.codec: ASoC: Failed to create component debugfs directory: -17
[    1.244895] mmc0: new high speed SDHC card at address aaaa
[    1.252417] sun4i-codec 1c22c00.codec: Codec <-> 1c22c00.codec mapping ok
[    1.261195] mmcblk0: mmc0:aaaa SD32G 29.7 GiB
[    1.267609] sun6i-rtc 1c20400.rtc: setting system clock to 1970-01-01T00:50:21 UTC (3021)
[    1.276087] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.286357]  mmcblk0: p1 p2
[    1.293653] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.300310] vcc5v0: disabling
[    1.303350] ALSA device list:
[    1.306319]   #0: V3s Audio Codec
[    1.310389] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.319085] cfg80211: failed to load regulatory.db
[    1.328632] mmc1: new high speed SDIO card at address 0001
[    1.369631] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.377933] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    1.385011] devtmpfs: mounted
[    1.389334] Freeing unused kernel memory: 1024K
[    1.394212] Run /sbin/init as init process
[    1.402033] random: fast init done
[    1.509792] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Saving random seed: [    1.708599] random: dd: uninitialized urandom read (512 bytes read)
OK
[  112.561950] random: crng init done
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
Starting sshd: OK

Welcome to v3s
v3s login:

在语句“Saving random seed: [    1.708599] random: dd: uninitialized urandom read (512 bytes read) OK”后卡了很久,从时间戳上可以看出。我尝试过删除/etc/init.d/S20urandom文件,但问题照旧。

使用的Linux内核版本:LicheePi 5.2.0+
使用的编译工具链:gcc-linaro 7.5 2019.12
buildroot版本:buildroot 2020.02.1

离线

#1 2022-08-30 10:27:24

unturned3
会员
注册时间: 2020-07-01
已发帖子: 271
积分: 300

Re: 求助v3s使用buildroot 2020.02.1后linux启动超过两分钟

你用的是哪个 defconfig?

这应该是 boot time entropy starvation 造成的 https://stackoverflow.com/a/20960019/18061591

我前段时间遇到过,就是开机后熵不足,导致内核无法生成随机数(各种加密算法需要),所以就没法启动 sshd

可以考虑不等待 sshd 服务启动(例如在启动指令的末尾加一个 & 使其在后台中运行),或者试试把内核的 RANDOM_TRUST_BOOTLOADER 打开

离线

楼主 #2 2022-08-30 12:23:26

laozhu
会员
注册时间: 2021-08-10
已发帖子: 27
积分: 81.5

Re: 求助v3s使用buildroot 2020.02.1后linux启动超过两分钟

@unturned3
感谢大佬的回复。我linux kernel使用的deconfig是licheepi_zero_defconfig,buildroot是自己menuconfig的。在我使用的内核LicheePi 5.2.0+中没有RANDOM_TRUST_BOOTLOADER的选项(它提示只有x86等支持该选项),不过我找到了另外的解决方法:在buildroot的menuconfig中打开haveged包安装:
Target Packages->Miscellaneous->haveged就可以解决随机熵不足的问题。

总结问题出现的原因和解决机理:系统启动时需要熵信息,且内核在可用熵较少时会阻塞相应的调用,所以系统启动时可能挂起数分钟至数小时,直至随机子系统充分得到初始化( random: crng init done )。而Haveged使用HAVEGE(HArdware Volatile Entropy Gathering and Expansion)来维护一个1M的随机字节池,当/dev/random中的随机位供应低于设备的低水位时(/proc/sys/kernel/random/entropy_avail),这个随机字节池用于填充/dev/random。

离线

#3 2022-08-30 18:24:15

unturned3
会员
注册时间: 2020-07-01
已发帖子: 271
积分: 300

Re: 求助v3s使用buildroot 2020.02.1后linux启动超过两分钟

哦哦,你用的是 Linux 5.2,那 haveged 可能是比较好的选择了
Linux 5.6 以及更高版本都自带 haveged 和相关的算法。我目前用的是 5.19,开机5秒多也就 crng init done 了

参考:

https://wiki.archlinux.org/title/Haveged
https://github.com/jirka-h/haveged/issues/57#issuecomment-803705461
https://github.com/jirka-h/haveged/commit/297bdf1fc52fc6f59d0495f911d4e594b4d29190

离线

#4 2022-10-18 15:06:42

iamseer
会员
注册时间: 2020-06-06
已发帖子: 69
积分: 46.5

Re: 求助v3s使用buildroot 2020.02.1后linux启动超过两分钟

之前也遇到了这个问题,
这篇文章讲的不错
https://www.cnblogs.com/USTHzhanglu/p/15222498.html

离线

页脚

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

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