3

At the beginning I'd like to announce that it is partially a success story. :-)

Context: Just for personal self-development, I had got an idea to complete semi-LFS procedure to build Linux for my ARM Cubieboard2. Why semi? Because my impatience led me to the idea to take some components from Fedora 23 image that are already built.

Hence, the procedure was more or less the following:

Phase 0

Crosstool-ng has been used to build cross-compile toolchain. (Let's skip over the details of this step. Honestly, the result is the same when gcc-arm-linux-gnu, gcc-c++-arm-linux-gnu and binutils-arm-linux-gnu packages are used.)

Phase 1

MMC card has been configured as follows

Step 1

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

Step 2

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

where sdb.gpt.prt content is

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

Step 3

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

Step 4

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

Step 5

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

Step 6

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

Phase 2

U-Boot has been compiled

Step 1

The most recent branch has been checked out from git://git.denx.de/u-boot

Step 2

Bootloader + SPL has been built as follows

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

As a result u-boot-sunxi-with-spl.bin has been produced.

WARNING: SEMI starts below.

Phase 3

Fedora 23 image has been downloaded and mounted

Step 1

The raw image file has been downloaded

Step 2

The image has been uncompressed

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

Step 3

Boot and root filesystems has been mounted

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

Phase 4

Bootloader + SPL has been recorded on the MMC

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

Phase 5

Fedora boot partition has been copied and amended

Step 1

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

Step 2

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

Phase 6

Fedora root partition has been copied and amended

Step 1

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

Step 2

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

Intermediate result

Now, after booting the Cubieboard with the MMC card in the slot the system hangs with famous "Starting kernel image ..." message.

But, that is not the end of the story. As I mentioned at the beginning, one experiment turned out to be successful. Namely, I tried to use the rescue initramfs image that is provided with Fedora 23 ie. extlinux.conf with

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

has brought a success!

I have tried to analyse the root cause of the promising result. The question that I have asked to myself was "What's the difference between these two images?"

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:]]<//"

yields the following output:

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    

Furthermore

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

yields the following result:

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

So, there are "only" some additional binaries. No special configuration files.

Of course, I'm aware that above check method is a trivial one. But before digging deeper I decided to ask for some hints.

My question is:

Where is the root cause of the success in the rescue initramfs image?


ADDENDUM

extlinux.conf entry

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

fails to boot. And here is the boot log:

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 ...

But extlinux.conf entry

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

boots successfully. And here is the boot log:

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:
utom
  • 482
  • 1
  • 3
  • 15
  • My guess is that both are booting fine but one doesn't have any console output. Can you show you u-boot bootargs? You also want to check the differences in /etc/inittab – Alexandre Belloni Mar 21 '16 at 10:48
  • Thank you for your help. If I understand correctly your question, you have asked for the content of the native u-boot configuration file. Have you? That's it `setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10`. Please, take into consideration that Fedora 23 uses Extlinux configuration file facility. Hence, effective boot arguments are `append ro root=UUID=3dc1e3c9-b443-41ab-8583-698ce7df6bd0` in standard boot scenario and `append earlyprintk verbose loglevel=8 ro root=UUID=3dc1e3c9-b443-41ab-8583-698ce7df6bd0 rootfstype=ext4 rootwait rdshell rdinitdebug` in rescue. – utom Mar 21 '16 at 11:18
  • And regarding the differences in /etc/inittab. There is not any /etc/inittab file on initramfs images. If you mentioned /etc/inittab file on the ultimate root filesystem, then there is one, but it is empty, as Fedora 23 uses systemd subsystem. Nevertheless, in both scenarios _normal_ and _rescue_ root filesystem is physically the same. – utom Mar 21 '16 at 11:32
  • My mistake: I have written that _...Fedora 23 uses Extlinux configuration..._ in the first comment. That's improper sentence. In fact, Fedora distribution provides extlinux.conf configuration file at the boot filesystem. U-boot searches for it. If u-boot finds one, it uses it. If not, it tries to find boot.scr, ie. binary product of the mkimage tool. Currently, I use extlinux.conf. The boot.cmd usage is the question of future, ie. after solving much more fundamental issues. – utom Mar 21 '16 at 12:04

1 Answers1

3

Where is the root cause of the success in the rescue initramfs image?

The contents of the initramfs cannot affect the early boot (i.e. the initramfs is accessed in the late stages of the kernel boot sequence).
The only salient attribute at the early stage of booting would be its memory footprint.
Apparently the smaller initramfs can successfully boot, whereas the larger initramfs cannot boot.
That implies an improper memory layout at the U-Boot stage of booting (e.g. the kernel image is probably overwriting itself as it decompresses).

However you haven't provided any salient output of the failed boot (other than the final message).
Where are the kernel image (and dtb) loaded in memory?
What are the sizes of these images?

BTW your method to determine the "difference between these two images" is bogus. You're only comparing the lists of filenames; the contents of files could be different (and incompatible for the kernel you built). In general you should not expect an arbitrary pairing of kernel and rootfs to work.


ADDENDUM

Based on the boot log, it looks like the file named vmlinuz-4.2.3-300.fc23.armv7hl is used by U-Boot as the kernel image.
That is probably not a valid kernel image for booting on ARM.
"Vmlinux" files typically are executable files with an ELF header. The ELF header is not executable code, and will therefore will cause unpredictable results (and probable boot failure) when the ELF header itself is executed during boot.

For booting on ARM, you need to use a kernel image file (e.g. arch/arm/boot/zImage or uImage).


ADDENDUM 2

... there is a strict correlation between changing only one boot configuration parameter and the final effect.

That's a false assertion.
Now that you've provided both boot logs, it is now obvious that you're using two different builds of U-Boot (a "Mar 16" build versus a "Mar 19" build), and therefore possibly two completely different environments!

Besides, even if there is a correlation, "correlation is not causation".

Maybe I haven't expressed the situation clearly at the beginning.

Yes, you have not.
You have omitted salient information like using two builds of U-Boot. (Foolish me for assuming that there was only one U-Boot involved!)

It's the U-Boot environment variables that typically perform the loading of the kernel(+initramfs) and dtb images, and is a step where the memory layout is crucial. This is the information requested by my first question (which is still unanswered).

Please provide the U-Boot environment for each build/version (i.e. the printenv command output).

Or even better, at least demonstrate that U-Boot (and its environment variables) is not a factor by booting with the same version/build of U-Boot and a common environment.

sawdust
  • 16,103
  • 3
  • 40
  • 50
  • Thank you for the quick reply. Let me refer to your particular remarks. Ad _Apparently the smaller initramfs can successfully boot, whereas the larger initramfs cannot boot_ - in fact the size of smaller initramfs is 1,5MB bigger than the size of larger initramfs. Ad _However you haven't provided any salient output of the failed boot_ - Here you are [link](https://onedrive.live.com/embed?cid=FB985EAB6952BD25&resid=FB985EAB6952BD25%211047&authkey=ANQSnJWIH_Q5geU) Ad _your method to determine the "difference between these two images" is bogus_ - Yeah, I know. That's what I mentioned. – utom Mar 21 '16 at 07:20
  • You've responded to a few of my remarks, but you haven't answered the two simple questions. Based on your edits, you still seem focused on the contents of the initramfs. One more time: the rootfs or initramfs is not accessed *at all* during the early phases of kernel booting; the contents do not matter for kernel initialization. If you don't believe that, then try booting without any initramfs. If you cannot get the kernel to initialize, then you should verify that there really is a valid kernel image in memory before U-Boot executes its `bootm` or `bootz` command – sawdust Mar 21 '16 at 21:16
  • Thank you again for your help. Maybe I haven't expressed the situation clearly at the beginning. I have rebuilt one of your addendums. I believe that it can be helpful. I'd like to ensure that I do not insist that the issue comes from initramfs image. The only thing that I want to indicate is that there is a strict correlation between changing only one boot configuration parameter and the final effect. – utom Mar 22 '16 at 09:06