我已经建立了一个使用busybox的小型嵌入式Linux。我正面临一个问题,我不确定它是由busybox还是内核引起的。
问题是,init
进程没有进程ID 1.继承ps
的输出:
1 root 0:26 [swapper/0]
2 root 0:00 [kthreadd]
3 root 0:00 [ksoftirqd/0]
4 root 0:00 [kworker/0:0]
5 root 0:00 [kworker/0:0H]
6 root 0:00 [kworker/u4:0]
7 root 0:00 [rcu_preempt]
8 root 0:00 [rcu_sched]
...
549 root 0:00 {linuxrc} init
...
我想init
之前的其他进程都是内核进程。这是一个问题的原因是,孤立进程被赋予父进程ID 1,它应该是init
进程,但现在这个swapper
进程正在接收它们。
当我观察到很多僵尸进程时,我注意到出现了问题。
所以不管怎样,init
必须强制为PID 1,否则必须将孤立的进程分配给正确的init
PID。
有没有人知道该怎么做?
非常感谢!
<小时/> 更新:有关我的设置的更多信息
目标是带有Xilinx Zynq芯片的ARM板。我正在使用Xilinx linux内核,并自己编译了busybox(v1.20.2)。
命令行是:
ramdisk_size=65536 console=ttyPS0,115200 earlyprintk
以下是启动init脚本时的启动日志:
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 3.13.0-xilinx (cone@cone-ubuntu) (gcc version 4.8.1 (Sourcery CodeBench Lite 2013.11-53) ) #5 SMP PREEMPT Sun J4
[ 0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: Xilinx Zynq
[ 0.000000] bootconsole [earlycon0] enabled
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] PERCPU: Embedded 8 pages/cpu @c101e000 s10176 r8192 d14400 u32768
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
[ 0.000000] Kernel command line: ramdisk_size=65536 console=ttyPS0,115200 earlyprintk
[ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Memory: 501272K/524288K available (4781K kernel code, 307K rwdata, 1692K rodata, 197K init, 5345K bss, 23016K reserved, 0K hi)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] vmalloc : 0xe0800000 - 0xff000000 ( 488 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0xc0008000 - 0xc065a600 (6474 kB)
[ 0.000000] .init : 0xc065b000 - 0xc068c7c0 ( 198 kB)
[ 0.000000] .data : 0xc068e000 - 0xc06dac78 ( 308 kB)
[ 0.000000] .bss : 0xc06dac84 - 0xc0c13230 (5346 kB)
[ 0.000000] Preemptible hierarchical RCU implementation.
[ 0.000000] RCU lockdep checking is enabled.
[ 0.000000] Dump stacks of tasks blocking RCU-preempt GP.
[ 0.000000] RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] ps7-slcr mapped to e0802000
[ 0.000000] zynq_clock_init: clkc starts at e0802100
[ 0.000000] Zynq clock init
[ 0.000000] sched_clock: 32 bits at 325MHz, resolution 3ns, wraps every 13215283196ns
[ 0.000000] ps7-ttc #0 at e0804000, irq=43
[ 0.000000] Console: colour dummy device 80x30
[ 0.000000] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[ 0.000000] ... MAX_LOCKDEP_SUBCLASSES: 8
[ 0.000000] ... MAX_LOCK_DEPTH: 48
[ 0.000000] ... MAX_LOCKDEP_KEYS: 8191
[ 0.000000] ... CLASSHASH_SIZE: 4096
[ 0.000000] ... MAX_LOCKDEP_ENTRIES: 16384
[ 0.000000] ... MAX_LOCKDEP_CHAINS: 32768
[ 0.000000] ... CHAINHASH_SIZE: 16384
[ 0.000000] memory used by lock dependency info: 3695 kB
[ 0.000000] per task-struct memory footprint: 1152 bytes
[ 13.207599] Calibrating delay loop... 1292.69 BogoMIPS (lpj=6463488)
[ 13.207606] pid_max: default: 32768 minimum: 301
[ 13.207607] Mount-cache hash table entries: 512
[ 13.207609] CPU: Testing write buffer coherency: ok
[ 13.207610] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 13.207611] Setting up static identity map for 0x489b98 - 0x489bf0
[ 13.207612] L310 cache controller enabled
[ 13.207613] l2x0: 8 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x72760000, Cache size: 512 kB
[ 13.207627] CPU1: Booted secondary processor
[ 13.207641] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 13.207642] Brought up 2 CPUs
[ 13.207644] SMP: Total of 2 processors activated.
[ 13.207644] CPU: All CPU(s) started in SVC mode.
[ 13.207646] devtmpfs: initialized
[ 13.207647] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[ 13.207650] regulator-dummy: no parameters
[ 13.207651] NET: Registered protocol family 16
[ 13.207651] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 13.207654] cpuidle: using governor ladder
[ 13.207654] cpuidle: using governor menu
[ 13.207658] syscon f8000000.ps7-slcr: regmap [mem 0xf8000000-0xf8000fff] registered
[ 13.207660] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[ 13.207662] hw-breakpoint: maximum watchpoint size is 4 bytes.
[ 13.207663] zynq-ocm f800c000.ps7-ocmc: ZYNQ OCM pool: 256 KiB @ 0xe0880000
[ 13.207672] bio: create slab <bio-0> at 0
[ 13.207674] vgaarb: loaded
[ 13.207674] SCSI subsystem initialized
[ 13.207675] usbcore: registered new interface driver usbfs
[ 13.207676] usbcore: registered new interface driver hub
[ 13.207677] usbcore: registered new device driver usb
[ 13.207678] media: Linux media interface: v0.10
[ 13.207679] Linux video capture interface: v2.00
[ 13.207680] pps_core: LinuxPPS API ver. 1 registered
[ 13.207681] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 13.207682] PTP clock support registered
[ 13.207683] EDAC MC: Ver: 3.0.0
[ 13.207685] DMA-API: preallocated 4096 debug entries
[ 13.207686] DMA-API: debugging enabled by kernel config
[ 13.207687] Switched to clocksource arm_global_timer
[ 13.207696] NET: Registered protocol family 2
[ 13.207697] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[ 13.207698] TCP bind hash table entries: 4096 (order: 5, 147456 bytes)
[ 13.207699] TCP: Hash tables configured (established 4096 bind 4096)
[ 13.207700] TCP: reno registered
[ 13.207701] UDP hash table entries: 256 (order: 2, 20480 bytes)
[ 13.207702] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
[ 13.207703] NET: Registered protocol family 1
[ 13.207704] RPC: Registered named UNIX socket transport module.
[ 13.207705] RPC: Registered udp transport module.
[ 13.207706] RPC: Registered tcp transport module.
[ 13.207707] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 13.207708] Trying to unpack rootfs image as initramfs...
[ 13.207709] rootfs image is not initramfs (no cpio magic); looks like an initrd
[ 13.207717] Freeing initrd memory: 6004K (df551000 - dfb2e000)
[ 13.207718] hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
[ 13.207722] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
[ 13.207723] msgmni has been set to 990
[ 13.207724] io scheduler noop registered
[ 13.207724] io scheduler deadline registered
[ 13.207725] io scheduler cfq registered (default)
[ 13.207728] dma-pl330 f8003000.ps7-dma: unable to set the seg size
[ 13.207729] dma-pl330 f8003000.ps7-dma: Loaded driver for PL330 DMAC-2364208
[ 13.207731] dma-pl330 f8003000.ps7-dma: DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
[ 13.207733] e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 82, base_baud = 3125000) is a xuartps
[ 13.207734] console [ttyPS0] enabled
[ 13.207734] console [ttyPS0] enabled
[ 13.207735] bootconsole [earlycon0] disabled
[ 13.207735] bootconsole [earlycon0] disabled
[ 13.207737] xdevcfg f8007000.ps7-dev-cfg: ioremap 0xf8007000 to e0866000
[ 13.207743] brd: module loaded
[ 13.207746] loop: module loaded
[ 13.207748] zynq-qspi e000d000.ps7-qspi: master is unqueued, this is deprecated
[ 13.207749] zynq-qspi e000d000.ps7-qspi: at 0xE000D000 mapped to 0xE0868000, irq=51
[ 13.207752] e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k
[ 13.207753] e1000e: Copyright(c) 1999 - 2013 Intel Corporation.
[ 13.207754] libphy: XEMACPS mii bus: probed
[ 13.207755] xemacps e000b000.ps7-ethernet: pdev->id -1, baseaddr 0xe000b000, irq 54
[ 13.207757] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 13.207758] ehci-pci: EHCI PCI platform driver
[ 13.207759] ULPI transceiver vendor/product ID 0x0424/0x0007
[ 13.207760] Found SMSC USB3320 ULPI transceiver.
[ 13.207761] ULPI integrity check: passed.
[ 13.207761] zynq-ehci zynq-ehci.0: Xilinx Zynq USB EHCI Host Controller
[ 13.207763] zynq-ehci zynq-ehci.0: new USB bus registered, assigned bus number 1
[ 13.207769] zynq-ehci zynq-ehci.0: irq 53, io mem 0x00000000
[ 13.207772] zynq-ehci zynq-ehci.0: USB 2.0 started, EHCI 1.00
[ 13.207773] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 13.207774] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 13.207775] usb usb1: Product: Xilinx Zynq USB EHCI Host Controller
[ 13.207776] usb usb1: Manufacturer: Linux 3.13.0-xilinx ehci_hcd
[ 13.207777] usb usb1: SerialNumber: zynq-ehci.0
[ 13.207779] hub 1-0:1.0: USB hub found
[ 13.207779] hub 1-0:1.0: 1 port detected
[ 13.207781] usbcore: registered new interface driver usb-storage
[ 13.207782] mousedev: PS/2 mouse device common for all mice
[ 13.207783] i2c /dev entries driver
[ 13.207784] cdns-i2c e0004000.ps7-i2c: 400 kHz mmio e0004000 irq 57
[ 13.207787] xadcps f8007100.ps7-xadc: enabled: yes reference: external
[ 13.207788] cdns-wdt f8005000.ps7-wdt: Xilinx Watchdog Timer at e0876000 with timeout 10s
[ 13.207790] zynq-edac f8006000.ps7-ddrc: ecc not enabled
[ 13.207791] Xilinx Zynq CpuIdle Driver started
[ 13.207590] sdhci: Secure Digital Host Controller Interface driver
[ 13.207591] sdhci: Copyright(c) Pierre Ossman
[ 13.207592] sdhci-pltfm: SDHCI platform and OF driver helper
[ 13.207593] sdhci-arasan e0100000.ps7-sdio: dummy supplies not allowed
[ 13.207594] mmc0: no vqmmc regulator found
[ 13.207595] sdhci-arasan e0100000.ps7-sdio: dummy supplies not allowed
[ 13.207596] mmc0: no vmmc regulator found
[ 13.207603] mmc0: SDHCI controller on e0100000.ps7-sdio [e0100000.ps7-sdio] using ADMA
[ 13.207608] usbcore: registered new interface driver usbhid
[ 13.207608] usbhid: USB HID core driver
[ 13.207609] TCP: cubic registered
[ 13.207610] NET: Registered protocol family 17
[ 13.207611] Registering SWP/SWPB emulation handler
[ 13.207612] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[ 13.207614] mmc0: new high speed SDHC card at address 59b4
[ 13.207615] mmcblk0: mmc0:59b4 USD 14.7 GiB
[ 13.207617] mmcblk0: p1 p2
[ 13.207618] RAMDISK: gzip image found at block 0
[ 13.207691] usb 1-1: new high-speed USB device number 2 using zynq-ehci
[ 13.207707] VFS: Mounted root (ext2 filesystem) on device 1:0.
Starting rcS...
@sawdust:我没有/init
个文件。我认为/linuxrc
是第一个被执行的东西,而这只是busybox的符号链接。
答案 0 :(得分:0)
我想我解决了这个问题。显然,将root=/dev/ram
添加到引导参数就可以了。我看到在线推荐的地方,但我找不到链接了。我不完全确定为什么这是必要的,但它有效: - )