【问题标题】:ARM stucks at "Starting kernel image ..." sometimes [closed]ARM有时会卡在“正在启动内核映像......”[关闭]
【发布时间】:2016-07-07 08:08:01
【问题描述】:

在开始时,我想宣布它是部分成功的故事。 :-)

背景:为了个人的自我开发,我萌生了完成semi-LFS程序为我的ARM Cubieboard2搭建Linux的想法。为什么是半成品?因为我的不耐烦让我想到了从已经构建的 Fedora 23 映像中获取一些组件。

因此,程序或多或少如下:

第 0 阶段

Crosstool-ng 已用于构建交叉编译工具链。 (这一步的细节我们略过。老实说,使用 gcc-arm-linux-gnu、gcc-c++-arm-linux-gnu 和 binutils-arm-linux-gnu 包时的结果是一样的。)

第一阶段

MMC卡配置如下

步骤 1

sudo dd if=/dev/zero of=${card} bs=1M count=1

第二步

sudo sfdisk ${card} < sdb.gpt.prt

sdb.gpt.prt 内容在哪里

label: gpt
device: /dev/sdb
size=256MiB,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4,name=boot
size=2GiB,type=69dad710-2ce4-4e3c-b16c-21a1d49abed3,name=root
size=2GiB,type=0657fd6d-a4ab-43c4-84e5-0933c84b4f4f,name=swap
type=933ac7e1-2eb4-4f13-b844-0e14e2aef915,name=home

第三步

echo -e "x\ns\n56\nv\nw\ny" | sudo gdisk ${card}

第四步

sudo mkfs.ext4 -qF -L "boot" ${card}${p}1
sudo mkfs.ext4 -qF -L "root" ${card}${p}2
sudo mkswap        -L "swap" ${card}${p}3
sudo mkfs.ext4 -qF -L "home" ${card}${p}4

第 5 步

sudo mount ${card}${p}1 /mnt/cbxboot
sudo mount ${card}${p}2 /mnt/cbxroot

第 6 步

sudo sync
sudo blockdev --flushbufs ${card}${p}1
sudo blockdev --flushbufs ${card}${p}2

第二阶段

U-Boot 已经编译完成

步骤 1

最近的分支已经从 git://git.denx.de/u-boot 签出

第二步

Bootloader + SPL 已构建如下

export KBUILD_OUTPUT=/tmp/bld/arm/cbx/u-boot
mkdir -p $KBUILD_OUTPUT
export ARCH=arm
export CROSS_COMPILE=arm-unknown-linux-gnueabihf-
make Cubieboard2_defconfig
make all

因此 u-boot-sunxi-with-spl.bin 已生成。

警告: SEMI 从下方开始。

第三阶段

Fedora 23 镜像已下载并挂载

步骤 1

原始图像文件已下载

第二步

图片已解压

unxz -v Fedora-Minimal-armhfp-23-10-sda.raw.xz

第三步

引导和根文件系统已挂载

sudo mkdir /mnt/loopfedboot && sudo mkdir /mnt/loopfedroot
sudo mount -o ro,loop,offset=1048576 Fedora-Minimal-armhfp-23-10-sda.raw /mnt/loopfedboot
sudo mount -o ro,loop,offset=556793856 Fedora-Minimal-armhfp-23-10-sda.raw /mnt/loopfedroot

第四阶段

Bootloader + SPL 已记录在 MMC 上

sudo dd if=u-boot-sunxi-with-spl.bin of=${card} bs=1024 seek=8

第五阶段

Fedora 启动分区已复制修改

步骤 1

cd /mnt && sudo cp -frT --preserve=all ./loopfedboot ./cbxboot

第二步

sudo sed --in-place=*.nboot.bak -e "\%root=UUID=[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}% s/[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/$(sudo blkid -c /dev/null -s UUID -o value ${card}${p}2)/" /mnt/cbxboot/extlinux/extlinux.conf

第 6 阶段

Fedora 根分区已复制修改

步骤 1

cd /mnt && sudo cp -frT --preserve=all ./loopfedroot ./cbxroot

第二步

sudo sed --in-place=*.nboot.bak -e "\%/boot% s%[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}%$(sudo blkid -c /dev/null -s UUID -o value ${card}${p}1)%" /mnt/cbxroot/etc/fstab
sudo sed --in-place=*.nroot.bak -e "\%[[:space:]]/[[:space:]]% s%[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}%$(sudo blkid -c /dev/null -s UUID -o value ${card}${p}2)%" /mnt/cbxroot/etc/fstab
sudo sed --in-place=*.nswap.bak -e "\%[[:space:]]swap[[:space:]]% s%[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}%$(sudo blkid -c /dev/null -s UUID -o value ${card}${p}3)%" /mnt/cbxroot/etc/fstab

中间结果

现在,使用插槽中的 MMC 卡启动 Cubieboard 后,系统会挂起并显示著名的“正在启动内核映像...”消息。

但是,这并不是故事的结局。正如我一开始提到的,一个实验结果证明是成功的。也就是说,我尝试使用 Fedora 23 即提供的救援 initramfs 映像。 extlinux.conf 与

label Fedora-Minimal-armhfp-23-10 (Initramfs Rescue only)"
    kernel /vmlinuz-4.2.3-300.fc23.armv7hl
    append ...
    fdtdir /dtb-4.2.3-300.fc23.armv7hl/
    initrd /initramfs-0-rescue-afe50178a2e84c8daa250c0980bfe6f8.img

带来了成功!

我试图分析有希望的结果的根本原因。我问自己的问题是“这两张图片有什么区别?”

sudo zcat initramfs-4.2.3-300.fc23-armv7hl.img | cpio -it > /tmp/normal.txt
sudo zcat initramfs-0-rescue-afe50178a2e84c8daa250c0980bfe6f8.img | cpio -it > /tmp/rescue.txt
diff -ay --suppress-common rescue.txt normal.txt | sed -s "s/[[:space:]]<//"

产生以下输出:

usr/bin/free                             
usr/bin/more                             
usr/bin/scp                          
usr/bin/ssh                          
usr/lib/libcrypt-2.22.so                     
usr/lib/libcrypt.so.1                        
usr/lib/libfipscheck.so.1                    
usr/lib/libfipscheck.so.1.2.1                    
usr/lib/libfreebl3.so                        
usr/lib/liblber-2.4.so.2                     
usr/lib/liblber-2.4.so.2.10.3                    
usr/lib/libldap-2.4.so.2                     
usr/lib/libldap-2.4.so.2.10.3                    
usr/lib/libnspr4.so                      
usr/lib/libnss3.so                       
usr/lib/libnssutil3.so                       
usr/lib/libplc4.so                       
usr/lib/libplds4.so                      
usr/lib/libsasl2.so.3                        
usr/lib/libsasl2.so.3.0.0                    
usr/lib/libsmime3.so                         
usr/lib/libssl3.so                       
usr/lib/libutil-2.22.so                      
usr/lib/libutil.so.1    

还有

mkdir /tmp/cbxinitramfs_normal  && cd /tmp/cbxinitramfs_normal
zcat /mnt/cbxboot/initramfs-4.2.3-300.fc23-armv7hl.img | cpio -i -d -H newc --no-absolute-filenames
mkdir /tmp/cbxinitramfs_rescue  && cd /tmp/cbxinitramfs_rescue
zcat /mnt/cbxboot/initramfs-0-rescue-afe50178a2e84c8daa250c0980bfe6f8.img | cpio -i -d -H newc --no-absolute-filenames
diff -r /tmp/cbxinitramfs_rescue /tmp/cbxinitramfs_normal

产生以下结果:

Only in initramfs_rescue/bin: free
Only in initramfs_rescue/bin: more
Only in initramfs_rescue/bin: scp
Only in initramfs_rescue/bin: ssh
Binary files initramfs_rescue/etc/ld.so.cache and initramfs_normal/etc/ld.so.cache differs
diff -r initramfs_rescue/lib/dracut/build-parameter.txt initramfs_normal/lib/dracut/build-parameter.txt
1c1
< --no-hostonly -a 'rescue'
---
> -f
diff -r initramfs_rescue/lib/dracut/modules.txt initramfs_normal/lib/dracut/modules.txt
4d3
< rescue
Only in initramfs_rescue/lib: libcrypt-2.22.so
Only in initramfs_rescue/lib: libcrypt.so.1
Only in initramfs_rescue/lib: libfipscheck.so.1
Only in initramfs_rescue/lib: libfipscheck.so.1.2.1
Only in initramfs_rescue/lib: libfreebl3.so
Only in initramfs_rescue/lib: liblber-2.4.so.2
Only in initramfs_rescue/lib: liblber-2.4.so.2.10.3
Only in initramfs_rescue/lib: libldap-2.4.so.2
Only in initramfs_rescue/lib: libldap-2.4.so.2.10.3
Only in initramfs_rescue/lib: libnspr4.so
Only in initramfs_rescue/lib: libnss3.so
Only in initramfs_rescue/lib: libnssutil3.so
Only in initramfs_rescue/lib: libplc4.so
Only in initramfs_rescue/lib: libplds4.so
Only in initramfs_rescue/lib: libsasl2.so.3
Only in initramfs_rescue/lib: libsasl2.so.3.0.0
Only in initramfs_rescue/lib: libsmime3.so
Only in initramfs_rescue/lib: libssl3.so
Only in initramfs_rescue/lib: libutil-2.22.so
Only in initramfs_rescue/lib: libutil.so.1
Only in initramfs_rescue/usr/bin: free
Only in initramfs_rescue/usr/bin: more
Only in initramfs_rescue/usr/bin: scp
Only in initramfs_rescue/usr/bin: ssh
diff -r initramfs_rescue/usr/lib/dracut/build-parameter.txt initramfs_normal/usr/lib/dracut/build-parameter.txt
1c1
< --no-hostonly -a 'rescue'
---
> -f
diff -r initramfs_rescue/usr/lib/dracut/modules.txt initramfs_normal/usr/lib/dracut/modules.txt
4d3
< rescue
Only in initramfs_rescue/usr/lib: libcrypt-2.22.so
Only in initramfs_rescue/usr/lib: libcrypt.so.1
Only in initramfs_rescue/usr/lib: libfipscheck.so.1
Only in initramfs_rescue/usr/lib: libfipscheck.so.1.2.1
Only in initramfs_rescue/usr/lib: libfreebl3.so
Only in initramfs_rescue/usr/lib: liblber-2.4.so.2
Only in initramfs_rescue/usr/lib: liblber-2.4.so.2.10.3
Only in initramfs_rescue/usr/lib: libldap-2.4.so.2
Only in initramfs_rescue/usr/lib: libldap-2.4.so.2.10.3
Only in initramfs_rescue/usr/lib: libnspr4.so
Only in initramfs_rescue/usr/lib: libnss3.so
Only in initramfs_rescue/usr/lib: libnssutil3.so
Only in initramfs_rescue/usr/lib: libplc4.so
Only in initramfs_rescue/usr/lib: libplds4.so
Only in initramfs_rescue/usr/lib: libsasl2.so.3
Only in initramfs_rescue/usr/lib: libsasl2.so.3.0.0
Only in initramfs_rescue/usr/lib: libsmime3.so
Only in initramfs_rescue/usr/lib: libssl3.so
Only in initramfs_rescue/usr/lib: libutil-2.22.so
Only in initramfs_rescue/usr/lib: libutil.so.1

所以,“只有”一些额外的二进制文件。没有特殊的配置文件。

当然,我知道上面的检查方法是微不足道的。但在深入挖掘之前,我决定寻求一些提示。

我的问题是:

rescue initramfs镜像成功的根本原因在哪里?


附录

extlinux.conf 条目

label Fedora-Minimal-armhfp-23-10 (4.2.3-300.fc23.armv7hl)
    kernel /vmlinuz-4.2.3-300.fc23.armv7hl
    append ro root=UUID=3dc1e3c9-b443-41ab-8583-698ce7df6bd0 
    fdtdir /dtb-4.2.3-300.fc23.armv7hl/
    initrd /initramfs-4.2.3-300.fc23.armv7hl.img

无法启动。这是启动日志:

U-Boot SPL 2016.01 (Mar 16 2016 - 14:25:13)
DRAM: 1024 MiB
CPU: 912000000Hz, AXI/AHB/APB: 3/2/2
Trying to boot from MMC


U-Boot 2016.01 (Mar 16 2016 - 14:25:13 +0100) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
SCSI:  SUNXI SCSI INIT
SATA link 0 timeout.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst 
Net:   eth0: ethernet@01c50000
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
USB2:   USB EHCI 1.00
USB3:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
371 bytes read in 272 ms (1000 Bytes/s)
Fedora-Minimal-armhfp-23-10 Boot Options.
1:  Fedora-Minimal-armhfp-23-10 (4.2.3-300.fc23.armv7hl)
2:  Fedora-Minimal-armhfp-23-10 (Rescue)
Enter choice: 1
1:  Fedora-Minimal-armhfp-23-10 (4.2.3-300.fc23.armv7hl)
Retrieving file: /initramfs-4.2.3-300.fc23.armv7hl.img
38958034 bytes read in 25124 ms (1.5 MiB/s)
Retrieving file: /vmlinuz-4.2.3-300.fc23.armv7hl
5811776 bytes read in 1761 ms (3.1 MiB/s)
append: ro root=UUID=41bff98f-0fa0-4a4c-95cd-b81a4900f4fc 
Retrieving file: /dtb-4.2.3-300.fc23.armv7hl/sun7i-a20-cubieboard2.dtb
27039 bytes read in 2290 ms (10.7 KiB/s)
Kernel image @ 0x42000000 [ 0x000000 - 0x58ae40 ]
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
   Loading Ramdisk to 47ad8000, end 49fff3d2 ... OK
   Loading Device Tree to 47ace000, end 47ad799e ... OK

Starting kernel ...

但是 extlinux.conf 条目

label Fedora-Minimal-armhfp-23-10 (Rescue)
    kernel /vmlinuz-4.2.3-300.fc23.armv7hl
    append ro root=UUID=3dc1e3c9-b443-41ab-8583-698ce7df6bd0 
    fdtdir /dtb-4.2.3-300.fc23.armv7hl/
    initrd /initramfs-0-rescue-afe50178a2e84c8daa250c0980bfe6f8.img

成功启动。这是启动日志:

U-Boot SPL 2016.01 (Mar 19 2016 - 08:36:05)
DRAM: 1024 MiB
CPU: 912000000Hz, AXI/AHB/APB: 3/2/2
Trying to boot from MMC


U-Boot 2016.01 (Mar 19 2016 - 08:36:05 +0100) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
I2C:   ready
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
SCSI:  SUNXI SCSI INIT
SATA link 0 timeout.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst 
Net:   eth0: ethernet@01c50000
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
USB2:   USB EHCI 1.00
USB3:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
Hit any key to stop autoboot:  2  1  0 
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
1979 bytes read in 277 ms (6.8 KiB/s)
Fedora-Minimal-armhfp-23-10 Boot Options.
1:  Fedora-Minimal-armhfp-23-10 (4.2.3-300.fc23.armv7hl)
2:  Fedora-Minimal-armhfp-23-10 (Rescue)
Enter choice: 2
2:  Fedora-Minimal-armhfp-23-10 (Rescue)
Retrieving file: /initramfs-0-rescue-afe50178a2e84c8daa250c0980bfe6f8.img
40557822 bytes read in 12080 ms (3.2 MiB/s)
Retrieving file: /vmlinuz-4.2.3-300.fc23.armv7hl
5811776 bytes read in 1774 ms (3.1 MiB/s)
append: ro root=UUID=3dc1e3c9-b443-41ab-8583-698ce7df6bd0
Retrieving file: /dtb-4.2.3-300.fc23.armv7hl/sun7i-a20-cubieboard2.dtb
27039 bytes read in 671 ms (39.1 KiB/s)
Kernel image @ 0x42000000 [ 0x000000 - 0x58ae40 ]
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
   Loading Ramdisk to 47952000, end 49fffcfe ... OK
   Loading Device Tree to 47948000, end 4795199e ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.2.3-300.fc23.armv7hl (mockbuild@arm04-builder03.arm.fedoraproject.org) (gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC) ) #1 SMP Mon Oct 5 16:45:59 UTC 2015
[    0.000000] CPU: ARMv7 Processor [410fc074] revision 4 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Cubietech Cubieboard2
[    0.000000] cma: Reserved 16 MiB at 0x7f000000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: Using PSCI v0.1 Function IDs from DT
[    0.000000] PERCPU: Embedded 12 pages/cpu @eeec6000 s19840 r8192 d21120 u49152
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260434
[    0.000000] Kernel command line: ro root=UUID=3dc1e3c9-b443-41ab-8583-698ce7df6bd0
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 968832K/1048576K available (7232K kernel code, 1075K rwdata, 3288K rodata, 1036K init, 843K bss, 63360K reserved, 16384K cma-reserved, 253952K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xef800000   ( 760 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0208000 - 0xc0c4e5bc   (10522 kB)
[    0.000000]       .init : 0xc0c4f000 - 0xc0d52000   (1036 kB)
[    0.000000]       .data : 0xc0d52000 - 0xc0e5ed88   (1076 kB)
[    0.000000]        .bss : 0xc0e5ed88 - 0xc0f31b10   ( 844 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000]  RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000]  Offload RCU callbacks from all CPUs
[    0.000000]  Offload RCU callbacks from CPUs: 0-1.
[    0.000000] Architected cp15 timer(s) running at 24.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000007] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.000021] Switching to timer-based delay loop, resolution 41ns
[    0.002217] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.003022] clocksource: hstimer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 12741736309 ns
[    0.003461] Console: colour dummy device 80x30
[    0.004393] console [tty0] enabled
[    0.004434] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=120000)
[    0.004487] pid_max: default: 32768 minimum: 301
[    0.004661] Security Framework initialized
[    0.004694] SELinux:  Initializing.
[    0.004769] Yama: becoming mindful.
[    0.005085] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.005126] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.006033] Initializing cgroup subsys blkio
[    0.006088] Initializing cgroup subsys memory
[    0.006153] Initializing cgroup subsys devices
[    0.006189] Initializing cgroup subsys freezer
[    0.006223] Initializing cgroup subsys net_cls
[    0.006254] Initializing cgroup subsys perf_event
[    0.006287] Initializing cgroup subsys net_prio
[    0.006380] CPU: Testing write buffer coherency: ok
[    0.006457] ftrace: allocating 30500 entries in 60 pages
[    0.049935] /cpus/cpu@0 missing clock-frequency property
[    0.049997] /cpus/cpu@1 missing clock-frequency property
[    0.050027] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.050124] Setting up static identity map for 0x40208280 - 0x40208318
[    0.056842] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.056971] Brought up 2 CPUs
[    0.057034] SMP: Total of 2 processors activated (96.00 BogoMIPS).
[    0.057057] CPU: All CPU(s) started in HYP mode.
[    0.057076] CPU: Virtualization extensions available.
[    0.058124] devtmpfs: initialized
[    0.066807] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 4
[    0.067750] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302231375000 ns
[    0.069015] atomic64_test: passed
[    0.069177] pinctrl core: initialized pinctrl subsystem
[    0.071343] NET: Registered protocol family 16
[    0.073498] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.084662] No ATAGs?
[    0.084773] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.084828] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.086614] Serial: AMBA PL011 UART driver
[    0.103227] reg-fixed-voltage ahci-5v: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/ahci_pwr_pin@0, deferring probe
[    0.103326] reg-fixed-voltage usb1-vbus: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/usb1_vbus_pin@0, deferring probe
[    0.103391] reg-fixed-voltage usb2-vbus: could not find pctldev for node /soc@01c00000/pinctrl@01c20800/usb2_vbus_pin@0, deferring probe
[    0.107154] vgaarb: loaded
[    0.108463] SCSI subsystem initialized
[    0.109200] usbcore: registered new interface driver usbfs
[    0.109323] usbcore: registered new interface driver hub
[    0.109462] usbcore: registered new device driver usb
[    0.111650] NetLabel: Initializing
[    0.111689] NetLabel:  domain hash size = 128
[    0.111709] NetLabel:  protocols = UNLABELED CIPSOv4
[    0.111800] NetLabel:  unlabeled traffic allowed by default
[    0.112360] clocksource: Switched to clocksource arch_sys_counter
[    0.191181] NET: Registered protocol family 2
[    0.192244] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.192448] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.192595] TCP: Hash tables configured (established 8192 bind 8192)
[    0.192714] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.192791] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.193137] NET: Registered protocol family 1
[    0.193997] RPC: Registered named UNIX socket transport module.
[    0.194038] RPC: Registered udp transport module.
[    0.194059] RPC: Registered tcp transport module.
[    0.194080] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.194748] Unpacking initramfs...
[    3.872008] Freeing initrd memory: 39608K (c7952000 - ca000000)
[    3.872535] hw perfevents: Failed to parse /pmu/interrupt-affinity[0]
[    3.872639] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available
[    3.874864] futex hash table entries: 512 (order: 3, 32768 bytes)
[    3.875065] audit: initializing netlink subsys (disabled)
[    3.875169] audit: type=2000 audit(3.855:1): initialized
[    3.887973] zpool: loaded
[    3.888021] zbud: loaded
[    3.888887] VFS: Disk quotas dquot_6.6.0
[    3.889217] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    3.891644] NFS: Registering the id_resolver key type
[    3.891754] Key type id_resolver registered
[    3.891778] Key type id_legacy registered
[    3.891820] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    3.892816] Key type big_key registered
[    3.923092] NET: Registered protocol family 38
[    3.923286] bounce: pool size: 64 pages
[    3.923657] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    3.923925] io scheduler noop registered
[    3.923965] io scheduler deadline registered
[    3.924253] io scheduler cfq registered (default)
[    3.929693] sun7i-a20-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    3.933870] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    3.956642] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 40, base_baud = 1500000) is a U6_16550A
[    4.713388] console [ttyS0] enabled
[    4.717529] Serial: AMBA driver
[    4.721480] msm_serial: driver initialized
[    4.729079] libphy: Fixed MDIO Bus: probed
[    4.733975] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    4.740589] ehci-pci: EHCI PCI platform driver
[    4.745157] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    4.751390] ohci-pci: OHCI PCI platform driver
[    4.755925] uhci_hcd: USB Universal Host Controller Interface driver
[    4.762640] usbcore: registered new interface driver usbserial
[    4.768562] usbcore: registered new interface driver usbserial_generic
[    4.775174] usbserial: USB Serial support registered for generic
[    4.781573] mousedev: PS/2 mouse device common for all mice
[    4.790300] device-mapper: uevent: version 1.0.3
[    4.795666] device-mapper: ioctl: 4.33.0-ioctl (2015-8-18) initialised: dm-devel@redhat.com
[    4.804776] ledtrig-cpu: registered to indicate activity on CPUs
[    4.810966] hidraw: raw HID events driver (C) Jiri Kosina
[    4.816746] usbcore: registered new interface driver usbhid
[    4.822364] usbhid: USB HID core driver
[    4.828032] drop_monitor: Initializing network drop monitor service
[    4.834676] ip_tables: (C) 2000-2006 Netfilter Core Team
[    4.840195] Initializing XFRM netlink socket
[    4.845639] NET: Registered protocol family 10
[    4.851611] mip6: Mobile IPv6
[    4.854696] NET: Registered protocol family 17
[    4.859357] Key type dns_resolver registered
[    4.864243] ThumbEE CPU extension supported.
[    4.868611] Registering SWP/SWPB emulation handler
[    4.874627] registered taskstats version 1
[    4.878900] zswap: loading zswap
[    4.882148] zswap: using zbud pool
[    4.885654] zswap: using lzo compressor
[    4.892076] hctosys: unable to open rtc device (rtc0)
[    4.897706] sr_init: No PMIC hook to init smartreflex
[    4.902948] sr_init: platform driver register failed for SR
[    4.915436] usb2-vbus: disabling
[    4.918773] usb1-vbus: disabling
[    4.922015] ahci-5v: disabling
[    4.925104] vcc5v0: disabling
[    4.928101] vcc3v3: disabling
[    4.931080] vcc3v0: disabling
[    4.936859] Freeing unused kernel memory: 1036K (c0c4f000 - c0d52000)
[    4.967562] random: systemd urandom read with 0 bits of entropy available
[    4.980714] systemd[1]: systemd 222 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
[    4.999674] systemd[1]: Detected architecture arm.
[    5.004599] systemd[1]: Running in initial RAM disk.

Welcome to Fedora 23 (Twenty Three) dracut-043-60.git20150811.fc23 (Initramfs)

... (30 000 characters Stackoverflow limits)

Welcome to Fedora 23 (Twenty Three)

... (30 000 characters Stackoverflow limits)

Fedora 23 (Twenty Three)
Kernel 4.2.3-300.fc23.armv7hl on an armv7l (ttyS0)

localhost login:

【问题讨论】:

  • 我的猜测是两者都可以正常启动,但没有任何控制台输出。你能告诉你u-boot bootargs吗?您还想检查 /etc/inittab 中的差异
  • 感谢您的帮助。如果我正确理解您的问题,您已经询问了本机 u-boot 配置文件的内容。你?就是这样setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10。请注意 Fedora 23 使用 Extlinux 配置文件工具。因此,有效的启动参数是标准启动场景中的append ro root=UUID=3dc1e3c9-b443-41ab-8583-698ce7df6bd0 和救援中的append earlyprintk verbose loglevel=8 ro root=UUID=3dc1e3c9-b443-41ab-8583-698ce7df6bd0 rootfstype=ext4 rootwait rdshell rdinitdebug
  • 关于 /etc/inittab 中的差异。 initramfs 映像上没有任何 /etc/inittab 文件。如果您提到最终根文件系统上的 /etc/inittab 文件,那么有一个,但它是空的,因为 Fedora 23 使用 systemd 子系统。然而,在两种情况下,normalrescue 根文件系统在物理上是相同的。
  • 我的错误:我在第一条评论中写过 ...Fedora 23 使用 Extlinux 配置...。那是不恰当的句子。事实上,Fedora 发行版在引导文件系统中提供了 extlinux.conf 配置文件。 U-boot 搜索它。如果 u-boot 找到一个,它会使用它。如果没有,它会尝试查找 boot.scr,即。 mkimage 工具的二进制产品。目前,我使用 extlinux.conf。 boot.cmd 的使用是未来的问题,即。在解决了更多基本问题之后。

标签: linux-kernel arm embedded-linux u-boot initrd


【解决方案1】:

rescue initramfs镜像成功的根本原因在哪里?

initramfs 的内容不会影响早期引导(即在内核引导序列的后期阶段访问 initramfs)。
在启动的早期阶段唯一显着的属性是它的内存占用。
显然 smaller initramfs 可以成功启动,而 larger initramfs 无法启动。
这意味着 U-Boot 引导阶段的内存布局不正确(例如,内核映像在解压缩时可能会覆盖自身)。

但是,您没有提供失败引导的任何显着输出(最终消息除外)。
内核映像(和 dtb)在内存中加载到哪里?
这些图片的尺寸是多少?

顺便说一句,您确定“这两个图像之间的差异”的方法是假的。您只是在比较文件名列表;文件的内容可能不同(并且与您构建的内核不兼容)。通常,您不应期望内核和 rootfs 的任意配对都能正常工作。


附录

根据启动日志,U-Boot 使用名为 vmlinuz-4.2.3-300.fc23.armv7hl 的文件作为内核映像。
这可能不是用于在 ARM 上引导的有效内核映像。
“Vmlinux”文件通常是带有 ELF 标头的可执行文件。 ELF 标头不是可执行代码,因此在引导期间执行 ELF 标头本身会导致不可预知的结果(以及可能的引导失败)。

要在 ARM 上启动,您需要使用内核映像文件(例如 arch/arm/boot/zImageuImage)。


附录 2

...仅更改一个启动配置参数与最终效果之间存在严格的相关性。

这是一个错误的断言。
现在您已经提供了两个启动日志,现在很明显您正在使用两个不同的 U-Boot 构建(“3 月 16 日”构建与“3 月 19 日”构建),因此可能是两个完全不同的环境!

此外,即使存在相关性,“相关性也不是因果关系”。

也许我一开始没有把情况表达清楚。

是的,你没有。
您省略了重要信息,例如使用两个版本的 U-Boot。 (愚蠢的假设只涉及一个 U-Boot!)

U-Boot 环境变量通常执行内核(+initramfs)和 dtb 图像的加载,并且是内存布局至关重要的一步。这是我的第一个问题所要求的信息(仍然没有答案)。

请为 每个 构建/版本提供 U-Boot 环境(即printenv 命令输出)。

或者更好的是,至少通过使用相同版本/构建的 U-Boot 和通用环境进行引导,证明 U-Boot(及其环境变量)不是一个因素。

【讨论】:

  • 感谢您的快速回复。让我参考你的具体言论。广告 显然较小的 initramfs 可以成功启动,而较大的 initramfs 无法启动 - 事实上,较小的 initramfs 的大小比较大的 initramfs 的大小大 1.5MB。广告但是你没有提供任何关于失败启动的显着输出 - 这里是link 广告你确定“这两个图像之间的差异”的方法是假的 - 是的,我知道。这就是我提到的。
  • 您已经回复了我的一些评论,但您还没有回答这两个简单的问题。根据您的编辑,您似乎仍然专注于 initramfs 的内容。还有一次:在内核启动的早期阶段,rootfs 或 initramfs根本没有被访问过;内容对于内核初始化无关紧要。如果您不相信,请尝试在没有任何 initramfs 的情况下启动。如果无法初始化内核,则应在 U-Boot 执行其bootmbootz 命令之前验证内存中确实存在有效的内核映像
  • 再次感谢您的帮助。可能一开始我没有把情况表达清楚。我已经重建了你的一份附录。我相信它会有所帮助。我想确保我不坚持认为问题来自 initramfs 图像。我唯一要说明的是,仅更改一个启动配置参数与最终效果之间存在严格的相关性。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-08
  • 1970-01-01
  • 1970-01-01
  • 2016-07-11
相关资源
最近更新 更多