2017-05-30 97 views
1

我在SmartFusion2上運行uClinux,作爲構建小型多維數據集衛星的大學團隊的一部分。但是,我在Linux內核方面並不是非常有經驗,而且這個問題讓我難過了幾天。我試圖讓SmartFusion在啓動時運行一個程序。目前,唯一的.uImage是測試'hello'文件。我試圖重新創建另一個程序的過程,但遇到了一些困難。使用initramfs啓動時運行程序

在我的hello目錄

我有以下文件:hello.busybox,hello.kernel.M2S,的help.txt,hello.uImage,Makefile文件,hello.initramfs,你好(目錄)

在Hello子目錄(項目/打招呼/你好):

你好(可執行文件),hello.c中,hello.gdb,hello.h,hello.o,Makefile文件

,試圖獲得的uImage引導和運行不同程序,我製作了項目/ hello/hello目錄的副本,並將其重命名爲'goodbye',並對.h和.c文件進行了一些小改動以用於測試目的。現在我試圖在項目/ hello/goodbye中獲得可執行文件'hello'以在啓動時運行。

我的initramfs的文件原本是這樣的:

# This is a very simple, default initramfs 

dir /dev 0755 0 0 
nod /dev/console 0600 0 0 c 5 1 
nod /dev/tty 0666 0 0 c 5 0 
nod /dev/null 0600 0 0 c 1 3 
nod /dev/mem 0600 0 0 c 1 1 
nod /dev/kmem 0600 0 0 c 1 2 
nod /dev/zero 0600 0 0 c 1 5 
nod /dev/random 0600 0 0 c 1 8 
nod /dev/urandom 0600 0 0 c 1 9 

dir /dev/pts 0755 0 0 
nod /dev/ptmx 0666 0 0 c 5 2 

nod /dev/ttyS0 0666 0 0 c 4 64 
nod /dev/ttyS1 0666 0 0 c 4 65 
nod /dev/ttyS2 0666 0 0 c 4 66 
nod /dev/ttyS3 0666 0 0 c 4 67 
nod /dev/ttyS4 0666 0 0 c 4 68 
nod /dev/ttyS5 0666 0 0 c 4 69 

dir /bin 755 0 0 
dir /proc 755 0 0 

file /bin/hello ${INSTALL_ROOT}/projects/${SAMPLE}/hello/hello 755 0 0 
slink /bin/init hello 777 0 0 
I changed the last two lines of the initramfs to read as follows: 

file /bin/hello ${INSTALL_ROOT}/projects/${SAMPLE}/hello/goodbye 755 0 0 
slink /bin/init hello 777 0 0 

但是當我嘗試和改造中的uImage後引導SmartFusion2,我得到這個,witht底部的錯誤:

Starting kernel ... 

Linux version 2.6.33-arm1 ([email protected]) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-189)) #38 Thu May 25 09:09:08 MDT 2017 
CPU: ARMv7-M Processor [412fc231] revision 1 (ARMv7M) 
CPU: NO data cache, 8K instruction cache 
Machine: Microsemi M2S 
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 
Kernel command line: m2s_platform=m2s-fg484-som console=ttyS0,115200 panic=10 ip=10.2.118.102:10.2.118.101:192.168.0.1::m2s-fg484-som:eth0:off ethaddr=3C:FB:96:05:00:53 
PID hash table entries: 256 (order: -2, 1024 bytes) 
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) 
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) 
Memory: 64MB = 64MB total 
Memory: 64408k/64408k available, 1128k reserved, 0K highmem 
Virtual kernel memory layout: 
    vector : 0x00000000 - 0x00001000 ( 4 kB) 
    fixmap : 0xfff00000 - 0xfffe0000 (896 kB) 
    vmalloc : 0x00000000 - 0xffffffff (4095 MB) 
    lowmem : 0xa0000000 - 0xa4000000 ( 64 MB) 
    modules : 0xa0000000 - 0x01000000 (1552 MB) 
     .init : 0xa0008000 - 0xa0012000 ( 40 kB) 
     .text : 0xa0074bc0 - 0xa0083000 ( 58 kB) 
     .data : 0xa0084000 - 0xa008cce0 ( 36 kB) 
Hierarchical RCU implementation. 
NR_IRQS:83 
Calibrating delay loop... 132.30 BogoMIPS (lpj=661504) 
Mount-cache hash table entries: 512 
Switching to clocksource mss_timer2 
Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled 
serial8250.0: ttyS0 at MMIO 0x40000000 (irq = 10) is a 16550A 
console [ttyS0] enabled 
serial8250.1: ttyS1 at MMIO 0x40010000 (irq = 11) is a 16550A 
Freeing init memory: 40K 
Kernel panic - not syncing: No init found. Try passing init= option to kernel. 
Backtrace: no frame pointer 
Rebooting in 10 seconds.. 

有人可以幫助解釋爲什麼會發生這種情況,以及我需要對我的initramfs做些什麼來使其在啓動時運行正確的程序?謝謝!!

回答

2

事實證明,我對這兩條線的工作方式感到困惑。當我終於想通了,他們是這樣的:

file /bin/hello ${INSTALL_ROOT}/projects/${SAMPLE}/goodbye/hello 755 0 0 
slink /bin/init hello 777 0 0 

然後它的工作根據需要,我能夠落實到其他uImages。

相關問題