カーネルが initramfs イメージで init を見つけることができません。

カーネルが initramfs イメージで init を見つけることができません。

私の組み込みシステムでinitramfsを実行しようとしています。今このinitramfsの「init」は、実行中かどうかをテストするためにメッセージをエコーする以外は何もしません。

私の初期化スクリプト:

#!/bin/sh
echo "HELLO INITRAMFS"

私のinitramfs cpioファイルには静的にリンクされたbusyboxが含まれています。 "init"はファイルシステムの/ initにあります。まずcpioアーカイブを作成し、それをu-bootに変換します。

(find initramfs-test |cpio -o -H newc --quiet) > initramfs.cpio
mkimage -A arm -a 80008000 -e 80008000 -T ramdisk -C none -n uInitrd -d initramfs.cpio ./uInitrd

カーネルと共にこのuInitrdファイルをSDカードのfatパーティションに配置し、u-bootプロンプトで起動した後、両方のファイルをメモリにロードし、bootargsを設定して起動しました。

RIM-U-Boot# fatload mmc 0 0x81000000 uImage
reading uImage
4024775 bytes read in 415 ms (9.2 MiB/s)
RIM-U-Boot# fatload mmc 0 0x85000000 uInitrd
reading uInitrd
1410112 bytes read in 148 ms (9.1 MiB/s)
RIM-U-Boot# setenv bootargs console=${console} root=/dev/ram0 rootfstype=ramfs initrd=0x85000000
RIM-U-Boot# bootm 0x81000000 0x85000000
## Booting kernel from Legacy Image at 81000000 ...
   Image Name:   Linux 4.1 + Devicetree
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    4024711 Bytes = 3.8 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 85000000 ...
   Image Name:   uInitrd
   Image Type:   ARM Linux RAMDisk Image (uncompressed)
   Data Size:    1410048 Bytes = 1.3 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
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.1.18-ts-armv7l-crown-1.0 (mjohn@vbox) (gcc version 4.8.3 (Timesys 20161024) ) #1 SMP Tue Nov 13 16:40:10 EST 2018
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Crown RIM
[    0.000000] cma: Reserved 16 MiB at 0x86800000
[    0.000000] Memory policy: Data cache writeback
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] AM335X ES2.1 (neon )
[    0.000000] PERCPU: Embedded 13 pages/cpu @c7c77000 s23296 r8192 d21760 u53248
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 31968
[    0.000000] Kernel command line: console=ttyO3,115200n8 root=/dev/ram0 rootfstype=ramfs initrd=0x85000000
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Memory: 91580K/129024K available (7192K kernel code, 871K rwdata, 2580K rodata, 464K init, 8225K bss, 21060K reserved, 16384K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc09935f0   (9774 kB)
[    0.000000]       .init : 0xc0994000 - 0xc0a08000   ( 464 kB)
[    0.000000]       .data : 0xc0a08000 - 0xc0ae1fd0   ( 872 kB)
[    0.000000]        .bss : 0xc0ae4000 - 0xc12ec688   (8226 kB)
[    0.000000] Running RCU self tests
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  RCU lockdep checking is enabled.
[    0.000000]  Additional per-CPU info printed with stalls.
[    0.000000]  RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
[    0.000000] OMAP clockevent source: timer2 at 24000000 Hz
[    0.000021] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000052] clocksource timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000118] OMAP clocksource: timer1 at 24000000 Hz
[    0.001261] Console: colour dummy device 80x30
[    0.001339] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[    0.001352] ... MAX_LOCKDEP_SUBCLASSES:  8
[    0.001363] ... MAX_LOCK_DEPTH:          48
[    0.001373] ... MAX_LOCKDEP_KEYS:        8191
[    0.001384] ... CLASSHASH_SIZE:          4096
[    0.001393] ... MAX_LOCKDEP_ENTRIES:     32768
[    0.001404] ... MAX_LOCKDEP_CHAINS:      65536
[    0.001414] ... CHAINHASH_SIZE:          32768
[    0.001424]  memory used by lock dependency info: 5167 kB
[    0.001435]  per task-struct memory footprint: 1152 bytes
[    0.001466] Calibrating delay loop... 718.02 BogoMIPS (lpj=3590144)
[    0.108307] pid_max: default: 32768 minimum: 301
[    0.108753] Security Framework initialized
[    0.109015] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.109041] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.113214] Initializing cgroup subsys blkio
[    0.113271] Initializing cgroup subsys memory
[    0.113392] Initializing cgroup subsys devices
[    0.113510] Initializing cgroup subsys freezer
[    0.113689] Initializing cgroup subsys perf_event
[    0.113771] CPU: Testing write buffer coherency: ok
[    0.115776] CPU0: thread -1, cpu 0, socket -1, mpidr 0
[    0.115920] Setting up static identity map for 0x80008280 - 0x800082f0
[    0.126396] Brought up 1 CPUs
[    0.126434] SMP: Total of 1 processors activated (718.02 BogoMIPS).
[    0.126448] CPU: All CPU(s) started in SVC mode.
[    0.131751] devtmpfs: initialized
[    0.178685] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    0.251639] omap_hwmod: debugss: _wait_target_disable failed
[    0.308946] clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.312216] pinctrl core: initialized pinctrl subsystem
[    0.319501] NET: Registered protocol family 16
[    0.327296] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.330401] cpuidle: using governor ladder
[    0.330444] cpuidle: using governor menu
[    0.347621] OMAP GPIO hardware version 0.1
[    0.379407] omap-gpmc 50000000.gpmc: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_nandflash_pins, deferring probe
[    0.384981] No ATAGs?
[    0.385022] hw-breakpoint: debug architecture 0x4 unsupported.
[    0.385802] omap4_sram_init:Unable to allocate sram needed to handle errata I688
[    0.385826] omap4_sram_init:Unable to get sram pool needed to handle errata I688
[    0.446811] edma 49000000.edma: TI EDMA DMA engine driver
[    0.449438] reg-fixed-voltage fixedregulator@1: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_wl12xx_gpio, deferring probe
[    0.453649] SCSI subsystem initialized
[    0.455728] usbcore: registered new interface driver usbfs
[    0.455982] usbcore: registered new interface driver hub
[    0.456188] usbcore: registered new device driver usb
[    0.479540] tps65910 0-002d: No interrupt support, no core IRQ
[    0.614304] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 100 kHz
[    0.615013] pps_core: LinuxPPS API ver. 1 registered
[    0.615032] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    0.615109] PTP clock support registered
[    0.620004] Bluetooth: Core ver 2.20
[    0.620170] NET: Registered protocol family 31
[    0.620185] Bluetooth: HCI device and connection manager initialized
[    0.620332] Bluetooth: HCI socket layer initialized
[    0.620370] Bluetooth: L2CAP socket layer initialized
[    0.620592] Bluetooth: SCO socket layer initialized
[    0.624095] Switched to clocksource timer1
[    0.820693] NET: Registered protocol family 2
[    0.823356] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.823542] TCP bind hash table entries: 1024 (order: 3, 36864 bytes)
[    0.824172] TCP: Hash tables configured (established 1024 bind 1024)
[    0.824497] UDP hash table entries: 256 (order: 2, 20480 bytes)
[    0.824757] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
[    0.825968] NET: Registered protocol family 1
[    0.828351] RPC: Registered named UNIX socket transport module.
[    0.828381] RPC: Registered udp transport module.
[    0.828394] RPC: Registered tcp transport module.
[    0.828407] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.831337] CPU PMU: Failed to parse /pmu/interrupt-affinity[0]
[    0.831463] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
[    0.838002] futex hash table entries: 256 (order: 2, 16384 bytes)
[    0.838313] audit: initializing netlink subsys (disabled)
[    0.838639] audit: type=2000 audit(0.830:1): initialized
[    0.845262] VFS: Disk quotas dquot_6.6.0
[    0.845456] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.847891] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.849171] NFS: Registering the id_resolver key type
[    0.849744] Key type id_resolver registered
[    0.849764] Key type id_legacy registered
[    0.860204] io scheduler noop registered
[    0.860252] io scheduler deadline registered
[    0.860327] io scheduler cfq registered (default)
[    0.863209] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
[    0.867560] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.876098] omap_uart 44e09000.serial: no wakeirq for uart0
[    0.877001] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 158, base_baud = 3000000) is a OMAP UART0
[    0.879864] omap_uart 48022000.serial: no wakeirq for uart1
[    0.880322] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 159, base_baud = 3000000) is a OMAP UART1
[    0.882065] omap_uart 481a6000.serial: no wakeirq for uart3
[    0.882510] 481a6000.serial: ttyO3 at MMIO 0x481a6000 (irq = 160, base_baud = 3000000) is a OMAP UART3
[    1.699898] console [ttyO3] enabled
[    1.705757] omap_uart 481aa000.serial: no wakeirq for uart5
[    1.712068] 481aa000.serial: ttyO5 at MMIO 0x481aa000 (irq = 161, base_baud = 3000000) is a OMAP UART5
[    1.760738] brd: module loaded
[    1.785830] loop: module loaded
[    1.789963] (stk) :sysfs entries created
[    1.800178] mtdoops: mtd device (mtddev=name/number) must be supplied
[    1.874092] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
[    1.880499] davinci_mdio 4a101000.mdio: detected phy mask fffffff5
[    1.894287] libphy: 4a101000.mdio: probed
[    1.898524] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver unknown
[    1.906962] davinci_mdio 4a101000.mdio: phy[3]: device 4a101000.mdio:03, driver unknown
[    1.917029] cpsw 4a100000.ethernet: Detected MACID = d0:ff:50:ab:2d:b7
[    1.927796] PPP generic driver version 2.4.2
[    1.933714] PPP BSD Compression module registered
[    1.938845] PPP Deflate Compression module registered
[    1.945366] usbcore: registered new interface driver cdc_acm
[    1.951296] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    1.959997] usbcore: registered new interface driver usb-storage
[    1.970707] 47401300.usb-phy supply vcc not found, using dummy regulator
[    1.983582] musb-hdrc musb-hdrc.0.auto: Failed to request rx1.
[    1.990461] musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -517
[    2.000788] 47401b00.usb-phy supply vcc not found, using dummy regulator
[    2.012019] musb-hdrc musb-hdrc.1.auto: Failed to request rx1.
[    2.018436] musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -517
[    2.055667] mousedev: PS/2 mouse device common for all mice
[    2.062865] i2c /dev entries driver
[    2.072753] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[    2.082969] omap_hsmmc 48060000.mmc: Got CD GPIO
[    2.089408] vmmc: supplied by vbat
[    2.139221] ledtrig-cpu: registered to indicate activity on CPUs
[    2.147462] oprofile: using arm/armv7
[    2.151464] Netfilter messages via NETLINK v0.30.
[    2.157069] nf_conntrack version 0.5.0 (1686 buckets, 6744 max)
[    2.164144] ctnetlink v0.93: registering with nfnetlink.
[    2.170652] ipip: IPv4 over IPv4 tunneling driver
[    2.179323] ip_tables: (C) 2000-2006 Netfilter Core Team
[    2.185436] arp_tables: (C) 2002 David S. Miller
[    2.190642] Initializing XFRM netlink socket
[    2.195447] NET: Registered protocol family 17
[    2.200200] NET: Registered protocol family 15
[    2.207048] Bluetooth: RFCOMM TTY layer initialized
[    2.212284] Bluetooth: RFCOMM socket layer initialized
[    2.217831] Bluetooth: RFCOMM ver 1.11
[    2.221818] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    2.227427] Bluetooth: BNEP filters: protocol multicast
[    2.232927] Bluetooth: BNEP socket layer initialized
[    2.238179] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[    2.244432] Bluetooth: HIDP socket layer initialized
[    2.249798] BT WLAN Gpio value is :10
[    2.254432] WD Enable Gpio value is :114
[    2.258976] WD Tick Gpio value is :115
[    2.263340] BT_WLAN Gpio value is :10
[    2.267239] WL1271: BT/WLAN Enable
[    2.284032] Voltage translator init complete
[    2.302427] mmc0: host does not support reading read-only switch, assuming write-enable
[    2.310942] WD: Enable
[    2.313464] WD: TICK
[    2.317180] Key type dns_resolver registered
[    2.322818] omap_voltage_late_init: Voltage driver support not added
[    2.329621] sr_dev_init: No voltage domain specified for smartreflex0. Cannot initialize
[    2.338138] sr_dev_init: No voltage domain specified for smartreflex1. Cannot initialize
[    2.348688] ThumbEE CPU extension supported.
[    2.353214] Registering SWP/SWPB emulation handler
[    2.358356] SmartReflex Class3 initialized
[    2.364460] mmc0: new high speed SDHC card at address 0001
[    2.373404] mmcblk0: mmc0:0001 SD32G 29.3 GiB
[    2.384627]  mmcblk0: p1 p2
[    2.399807] omap-gpmc 50000000.gpmc: GPMC revision 6.0
[    2.405715] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
[    2.416508] nand: device found, Manufacturer ID: 0x01, Chip ID: 0xf1
[    2.423165] nand: AMD/Spansion S34ML01G2
[    2.427383] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    2.435458] nand: using OMAP_ECC_BCH4_CODE_HW ECC scheme
[    2.441305] 8 ofpart partitions found on MTD device 8000000.nand
[    2.447640] Creating 8 MTD partitions on "8000000.nand":
[    2.453212] 0x000000000000-0x000000020000 : "SPL"
[    2.467798] 0x000000020000-0x000000040000 : "SPL.backup1"
[    2.478062] 0x000000040000-0x000000060000 : "SPL.backup2"
[    2.488203] 0x000000060000-0x000000080000 : "SPL.backup3"
[    2.498676] 0x000000080000-0x000000260000 : "U-Boot"
[    2.508970] 0x000000260000-0x000000280000 : "U-Boot Env"
[    2.518872] 0x000000280000-0x000000780000 : "Kernel"
[    2.531256] 0x000000780000-0x000008000000 : "File System"
[    2.610135] musb-hdrc musb-hdrc.0.auto: MUSB HDRC host driver
[    2.617210] musb-hdrc musb-hdrc.0.auto: new USB bus registered, assigned bus number 1
[    2.628376] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    2.635588] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.643149] usb usb1: Product: MUSB HDRC host driver
[    2.648380] usb usb1: Manufacturer: Linux 4.1.18-ts-armv7l-crown-1.0 musb-hcd
[    2.655881] usb usb1: SerialNumber: musb-hdrc.0.auto
[    2.667430] hub 1-0:1.0: USB hub found
[    2.672216] hub 1-0:1.0: 1 port detected
[    2.692454] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    2.698661] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 2
[    2.708020] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    2.715198] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.722758] usb usb2: Product: MUSB HDRC host driver
[    2.727986] usb usb2: Manufacturer: Linux 4.1.18-ts-armv7l-crown-1.0 musb-hcd
[    2.735499] usb usb2: SerialNumber: musb-hdrc.1.auto
[    2.743553] hub 2-0:1.0: USB hub found
[    2.747851] hub 2-0:1.0: 1 port detected
[    2.877465] hctosys: unable to open rtc device (rtc0)
[    2.882786] sr_init: No PMIC hook to init smartreflex
[    2.888543] sr_init: platform driver register failed for SR
[    2.930249] VFS: Mounted root (ramfs filesystem) readonly on device 0:15.
[    2.937980] devtmpfs: error mounting -2
[    2.943047] Freeing unused kernel memory: 464K (c0994000 - c0a08000)
[    2.950460] Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[    2.964386] ---[ end Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[   79.333959] random: nonblocking pool is initialized

ご覧のとおり、カーネルは initramfs で init を見つけることができません。理由をご存知ですか?カーネルは4.1.18で、u-bootは2013.09です。

ありがとう

編集する: jc__質問に答える:

1. いいえ、デバイスツリーにカーネル遷移はありません。

2. 設定しようとしましたが、initrd=/dev/ram0同じエラーが発生しました。また、initを次のように指定しようとしましたが、次のエラーが表示されinit=/initました。

[    2.953050] Freeing unused kernel memory: 464K (c0994000 - c0a08000)
[    2.960261] Kernel panic - not syncing: Requested init /init failed (error -2).
[    2.968092] ---[ end Kernel panic - not syncing: Requested init /init failed (error -2).

3. cpioファイルinitramfsを使用していますが(カーネルイメージの一部ではなく)別々にロードしようとしていますが、initramfsがこのように動作しているかどうかわかりません。私が見つけたものこれが可能なようです。私のファイルシステムにはinitramfs.cpioが含まれています/dev。このモジュールは現在カーネルに組み込まれています。

4.カーネルイメージにinitramfsが含まれていないため、デフォルト値のみを含める必要があります。

CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=16384

5. これはカーネルに含めることができますが、追加の作業が必要です。カーネルはTimesys Factoryビルドシステムによってビルドされ、initramfs.cpioは後でビルドされます。

返信ソースジェダイ

私はそれを次のように変更しようとしました。

# setenv bootargs console=${console} root=/dev/ram0 init=/init

そして得る:

[    2.882766] sr_init: No PMIC hook to init smartreflex
[    2.888519] sr_init: platform driver register failed for SR
[    2.930847] omap_hsmmc 481d8000.mmc: card claims to support voltages below defined range
[    2.946830] List of all partitions:
[    2.950696] 0100           16384 ram0  (driver?)
[    2.955763] 0101           16384 ram1  (driver?)
[    2.960639] 0102           16384 ram2  (driver?)
[    2.965564] 0103           16384 ram3  (driver?)
[    2.970442] 0104           16384 ram4  (driver?)
[    2.975364] 0105           16384 ram5  (driver?)
[    2.980239] 0106           16384 ram6  (driver?)
[    2.985153] 0107           16384 ram7  (driver?)
[    2.990029] 0108           16384 ram8  (driver?)
[    2.994937] 0109           16384 ram9  (driver?)
[    2.999791] 010a           16384 ram10  (driver?)
[    3.004781] 010b           16384 ram11  (driver?)
[    3.009725] 010c           16384 ram12  (driver?)
[    3.014700] 010d           16384 ram13  (driver?)
[    3.019642] 010e           16384 ram14  (driver?)
[    3.024616] 010f           16384 ram15  (driver?)
[    3.029577] b300        30707712 mmcblk0  driver: mmcblk
[    3.035191]   b301            9216 mmcblk0p1 00011b5e-01
[    3.040769]   b302          440320 mmcblk0p2 00011b5e-02
[    3.046421] 1f00             128 mtdblock0  (driver?)
[    3.051727] 1f01             128 mtdblock1  (driver?)
[    3.057074] 1f02             128 mtdblock2  (driver?)
[    3.062380] 1f03             128 mtdblock3  (driver?)
[    3.067723] 1f04            1920 mtdblock4  (driver?)
[    3.073030] 1f05             128 mtdblock5  (driver?)
[    3.078369] 1f06            5120 mtdblock6  (driver?)
[    3.083676] 1f07          123392 mtdblock7  (driver?)
[    3.089006] No filesystem could mount root, tried:  ext3 ext2 ext4 cramfs squashfs vfat msdos
[    3.098220] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
[    3.107068] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)

同じ状況に変更すると、次のようになります。

# setenv bootargs console=${console} root=/dev/ram0 initrd=/dev/ram0 init=/init

編集2:

試験を終えた:

# setenv bootargs console=${console} root=/dev/ram0 initrd=0x85000000,2M

同じエラーが表示されます。ただし、今は次のようになります。

[    2.978095] RAMDISK: Couldn't find valid RAM disk image starting at 0.
[    2.992086] List of all partitions:
[    2.996226] 0100           16384 ram0  (driver?)
[    3.001097] 0101           16384 ram1  (driver?)
[    3.006041] 0102           16384 ram2  (driver?)
[    3.010895] 0103           16384 ram3  (driver?)

カーネルがどこでもinitramfsを見ることができないようです/dev/ram0。これは間違っている可能性があります。 u-bootがuImageとuInitrdをメモリにロードすると、/dev/ram0アドレス0x85000000にどのようにバインドされますか?

編集3:

カーネルにinitramfs.cpioを構築し、エコメッセージを見ることができます。したがって、私のinitramfsは有効ですが、外部からロードしようとしたときに何が間違っているのかわかりません。

ベストアンサー1

研究する項目:

1:

## Booting kernel from Legacy Image at 81000000 ...
   Image Name:   Linux 4.1 + Devicetree

デバイスツリーにデバイスと競合するカーネルスイッチが含まれているかどうかsetenv bootargs console=${console} root=/dev/ram0 rootfstype=ramfs initrd=0x85000000

2:

setenv bootargs console=${console} root=/dev/ram0 rootfstype=ramfs initrd=0x85000000

カーネルにinitrd = 0x850000000のメモリアドレスが必要ですか、それともdev / ram0の場所だけが必要ですか?

サム:

initramfsまたはinitrdを使用していますか?カーネルを直接コンパイルしますか?カーネルイメージにすでにinitramfsが含まれていますか?

カーネル構成で以下を確認してください。

CONFIG_BLK_DEV_INITRD

CONFIG_INITRAMFS_SOURC

[ 0.131751] devtmpfs: initialized

[ 2.937980] devtmpfs: error mounting -2

devtmpfsがほぼ2回マウントされているようです。初めてインストールしたときにinitramfsに組み込まれたものは何ですか? @sourcejediのコメントに同意します。いいえ/dev、rootfsがないためです。

カーネルはハードウェアも初期化しています。 Bluetooth、USB、MMCなど、これらのモジュールがカーネルにコンパイルされ、モジュールがロードされない限り、どこかでロードされます。 (内蔵initramfs)?

4:

initramfsの代わりにinitrdを使用し、カーネルイメージに組み込みinitramfsが含まれていない場合...

カーネル構成には次のものが必要だと思います。

BLK_DEV_RAM

"最新のカーネルは、使用されている場合は/dev/ram0をinitrdとして使用します。"

./linux-4.x.x/Documentation/blockdev/ramdisk.txt

そうではありませんinitrd=/dev/ram0initrd=0x85000000

「以前のinitrdは常に別々のファイルですが、initramfsアーカイブはLinuxカーネルイメージにリンクされました。」

./linux-4.x.x/Documentation/filesystems/ramfs-rootfs-initramfs.txtramfs-rootfs-initramfs.txt

「以前のinitrd(/ initではなく/ initrdと呼ばれています)はいくつかの設定を実行し、カーネルに戻るプログラムを実行しました...」

./linux-4.x.x/Documentation/filesystems/ramfs-rootfs-initramfs.txtramfs-rootfs-initramfs.txt

/initrd代わりにinitを使用する必要がありますか/init

5:

独自のカーネルをコンパイルする場合は、カーネル作成プロセスでinitramfsをカーネルイメージにマージすることで、多くの作業を減らすことができます。

CONFIG_BLK_DEV_INITRD

CONFIG_INITRAMFS_SOURCE

おすすめ記事