2014-12-29 5 views
0

AT91SAM9261 및 2.6.30 커널을 사용하는 설정을 위해 램 디스크를 설정하려고합니다. initramfs를 사용하지 않는 이유는 무엇입니까? 그 중 하나를 사용하겠다. 지금은 rootfs로 램 디스크로 부팅 할 수 있는지 확인하고 싶다.ramfs를 rootfs로 부팅 할 때 초기화 프로세스를 찾을 수 없음

이 시스템에서는 이미 jffs2 형식으로 정상적으로 실행중인 루트 fs가 있습니다. 나는 튜토리얼을 밑도는 :

http://www.ibm.com/developerworks/library/l-initrd/

그래서 나는 4 메가 ​​바이트 크기, 임베디드 대상에 직접 램 디스크를 만들었습니다. "dd"와 "mkefs"를 사용했고 rootfs가 내 jffs2 일 때 루프로 마운트하면 램 디스크 이미지가 잘 작동합니다. mount_point를 찾아보고 내부에서 작업 할 수 있습니다. 위의 링크에서 "수동으로 초기 RAM 디스크 만들기"섹션에 따라 내용이 만들어졌습니다.

/dev에 널 (null)을 넣고 console을/bin에 복사하고 비지 박스를 복사하고 링크를 만들었습니다. 나는 내 커널 설정에서

(rootfs로 JFFS2와 루프 장치로) 여기를 실행할 때 다음과 같이 내가 램 디스크를 지원 활성화 잘 작동뿐만 아니라 스크립트를 초기화하기 위해서 실행 속성을 설정합니다

CONFIG_BLK_DEV_INITRD=y 
CONFIG_RD_GZIP=y 

CONFIG_BLK_DEV_RAM=y 
CONFIG_BLK_DEV_RAM_COUNT=16 
CONFIG_BLK_DEV_RAM_SIZE=4096 

tftp 사용 램 디스크 이미지를 0x21100000으로 다운로드합니다. 0x20008000에서 나는 커널을 압축 해제했으며 0x22000000에서 zImage를 복사했습니다.

그러나 init 프로세스를 검사 할 때 시스템이 정지 할 때 시스템을 성공적으로 부팅 할 수 없습니다. 앞서 언급했듯이 init을 실행할 수 있는지 여러 번 확인했습니다.

또한 init로 사용할 수 있는지 여부를 확인하기 위해 bootargs init =/bin/busybox 또는 다른 스크립트/바이너리에 사용됩니다.

명령 줄 지금 사용

bootargs = 64M 콘솔 = ttyS0,115200 루트 =는/dev/ram0으로 RW 된 initrd = 0x211000004194304의 init =/초기화

일부 I의 경우 차이가 있는지 확인하기 위해 소유권을 "아무에게도"설정하십시오. 로그 출력에서 ​​볼 수 있듯이 램 디스크가 마운트되었지만 init가 실패합니다. 복사하기 전에 한 ext2 이미지를 확인하라는 경고 메시지가 나타나며 오류가보고되지 않습니다.

tftp 서버가 Windows7에 있습니다. 나는 램 디스크 이미지를 리눅스에서 윈도우로 복사 한 다음 윈도우 서버에서 tftp를하면 약간의 비호 환성이 있을지 모르지만. Windows에서 Linux로 이미지를 다시 복사하여 마운트하고 FS에서 오류를보고하고 스크립트를 실행할 수 있는지 확인했습니다. 모든 것이 정상적으로 보입니다.

그래서 모든 파일을 가지고 속성을 설정했는데 ramdisk는 rootfs로 마운트되었다고보고되지만 init는 찾을 수 없습니다.

Uncompressing Linux......................................................................................................... done, booting the kernel. 
Linux version 2.6.30-olimex ([email protected]) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203)) #1 Mon Dec 29 13:53:54 CET 2014 
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177 
CPU: VIVT data cache, VIVT instruction cache 
Machine: Olimex SAM9-L9261 
Ignoring unrecognised tag 0x54410008 
Memory policy: ECC disabled, Data cache writeback 
Clocks: CPU 198 MHz, master 99 MHz, main 18.432 MHz 
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 
Kernel command line: 64M console=ttyS0,115200 root=/dev/ram0 rw initrd=0x21100000,4194304 init=/init 
NR_IRQS:192 
AT91: 96 gpio irqs in 3 banks 
PID hash table entries: 256 (order: 8, 1024 bytes) 
Console: colour dummy device 80x30 
console [ttyS0] enabled 
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: 57384KB available (2924K code, 246K data, 132K init, 0K highmem) 
Calibrating delay loop... 99.12 BogoMIPS (lpj=495616) 
Mount-cache hash table entries: 512 
CPU: Testing write buffer coherency: ok 
net_namespace: 716 bytes 
NET: Registered protocol family 16 
AT91: Power Management 
AT91: Starting after user reset 
bio: create slab <bio-0> at 0 
SCSI subsystem initialized 
usbcore: registered new interface driver usbfs 
usbcore: registered new interface driver hub 
usbcore: registered new device driver usb 
NET: Registered protocol family 2 
IP route cache hash table entries: 1024 (order: 0, 4096 bytes) 
TCP established hash table entries: 2048 (order: 2, 16384 bytes) 
TCP bind hash table entries: 2048 (order: 1, 8192 bytes) 
TCP: Hash tables configured (established 2048 bind 2048) 
TCP reno registered 
NET: Registered protocol family 1 
Trying to unpack rootfs image as initramfs... 
rootfs image is not initramfs (junk in compressed archive); looks like an initrd 
Freeing initrd memory: 4096K 
NetWinder Floating Point Emulator V0.97 (double precision) 
JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc. 
msgmni has been set to 120 
io scheduler noop registered 
io scheduler anticipatory registered (default) 
atmel_lcdfb atmel_lcdfb.0: backlight control is not available 
atmel_lcdfb atmel_lcdfb.0: 225KiB frame buffer at 23140000 (mapped at ffc00000) 
Console: switching to colour frame buffer device 40x30 
atmel_lcdfb atmel_lcdfb.0: fb0: Atmel LCDC at 0x00600000 (mapped at c4866000), irq 21 
atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL 
atmel_usart.1: ttyS1 at MMIO 0xfffb0000 (irq = 6) is a ATMEL_SERIAL 
brd: module loaded 
loop: module loaded 
ssc ssc.1: Atmel SSC device at 0xc4878000 (irq 15) 
Driver 'sd' needs updating - please use bus_type methods 
dm9000 Ethernet Driver, V1.31 
eth0 (dm9000): not using net_device_ops yet 
eth0: dm9000e at c486a000,c486e044 IRQ 107 MAC: 3a:1f:34:08:54:64 (chip) 
NAND device: Manufacturer ID: 0xec, Chip ID: 0xdc (Samsung NAND 512MiB 3,3V 8-bit) 
Scanning device for bad blocks 
Bad eraseblock 1478 at 0x00000b8c0000 
Creating 2 MTD partitions on "atmel_nand": 
0x000000000000-0x000000040000 : "Partition 1" 
0x000000040000-0x000020000000 : "Partition 2" 
atmel_spi atmel_spi.0: Atmel SPI Controller at 0xfffc8000 (irq 12) 
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver 
at91_ohci at91_ohci: AT91 OHCI 
at91_ohci at91_ohci: new USB bus registered, assigned bus number 1 
at91_ohci at91_ohci: irq 20, io mem 0x00500000 
usb usb1: New USB device found, idVendor=1d6b, idProduct=0001 
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 
usb usb1: Product: AT91 OHCI 
usb usb1: Manufacturer: Linux 2.6.30-olimex ohci_hcd 
usb usb1: SerialNumber: at91 
usb usb1: configuration #1 chosen from 1 choice 
hub 1-0:1.0: USB hub found 
hub 1-0:1.0: 2 ports detected 
Initializing USB Mass Storage driver... 
usbcore: registered new interface driver usb-storage 
USB Mass Storage support registered. 
udc: at91_udc version 3 May 2006 
g_serial gadget: Gadget Serial v2.4 
g_serial gadget: g_serial ready 
mice: PS/2 mouse device common for all mice 
input: gpio-keys as /class/input/input0 
ads7846 spi0.2: touchscreen, irq 29 
input: ADS784x Touchscreen as /class/input/input1 
rtc-at91sam9 at91_rtt.0: rtc core: registered at91_rtt as rtc0 
IRQ 1/rtc0: IRQF_DISABLED is not guaranteed on shared IRQs 
rtc-at91sam9 at91_rtt.0: rtc0: SET TIME! 
i2c /dev entries driver 
i2c-gpio: probe of i2c-gpio failed with error -16 
Registered led device: led1 
Registered led device: led2 
Registered led device: led3 
Advanced Linux Sound Architecture Driver Version 1.0.20. 
at73c213 spi0.3: at73c213: supported bitrate is 48500 (64 divider) 
usb 1-1: new full speed USB device using at91_ohci and address 2 
usb 1-1: New USB device found, idVendor=0457, idProduct=0151 
usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=3 
usb 1-1: Product: USB Mass Storage Device 
usb 1-1: SerialNumber: 8d54bd8186b42c 
usb 1-1: configuration #1 chosen from 1 choice 
scsi0 : SCSI emulation for USB Mass Storage devices 
ALSA device list: 
    #0: SAM9-L9261 external DAC on irq 15 
TCP cubic registered 
NET: Registered protocol family 17 
RPC: Registered udp transport module. 
RPC: Registered tcp transport module. 
rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock 
RAMDISK: ext2 filesystem found at block 0 
RAMDISK: Loading 4096KiB [1 disk] into ram disk... done. 
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended 
VFS: Mounted root (ext2 filesystem) on device 1:0. 
Freeing init memory: 132K 
Failed to execute /init. Attempting defaults... 
Kernel panic - not syncing: No init found. Try passing init= option to kernel. 
[<c002f414>] (unwind_backtrace+0x0/0xdc) from [<c025bd34>] (panic+0x40/0x110) 
[<c025bd34>] (panic+0x40/0x110) from [<c0029500>] (init_post+0xd0/0xf8) 
[<c0029500>] (init_post+0xd0/0xf8) from [<c00085a0>] (kernel_init+0xbc/0xe4) 
[<c00085a0>] (kernel_init+0xbc/0xe4) from [<c0041998>] (do_exit+0x0/0x5ac) 
[<c0041998>] (do_exit+0x0/0x5ac) from [<00000001>] (0x1) 

나는 비지 박스를 다시하고 다시 시도 할 계획입니다,하지만 난 루프로 마운트 할 때 내 현재 램 디스크 이미지가 작동하기 때문에 나는 그것이 무엇인가를 변경됩니다 너무 많은 자신감을 가지고하지 않습니다. 아이디어가 없습니다. 나는이 일을하기 위해 하루 종일 노력했다.

도움을 많이 받으실 수 있습니다.

감사합니다.

+1

*/init을 (를) 실행하지 못했습니다. 기본값 시도 중 ... *; '/ init'에서 귀하의 busybox로 심볼릭 링크를 만들어보십시오. 라이브러리가 제대로 배치되지 않았고 콘솔로 설정 한 */dev/ttyS0 *도 없을 수 있습니다. * JFFS2 * 파티션에서 */bin/sh * (깨끗한 부트 환경을 모방)의'chroot '를 수행하십시오. 관련 질문 : [ARM 리눅스 부팅에 대한 세부 사항 (http://stackoverflow.com/questions/27607496/some-details-on-arm-linux-boot) 내가 표시 할 수 있도록 답변으로 귀하의 회신을 추가 할 수 있습니다 @artlessnoise –

+0

그것. 내가 만든 ttyS0에 파일도 초기화, 에서 비지 박스에 simlink을했지만,이 비지 박스는 dinamically 컴파일하고 libs와 내게로 복사되지 않았습니다. 그러나 ldd가 설치되지 않았으므로 objdump와의 종속성을 확인한 후에 모든 libs (및 심볼릭 링크 : libm.so.6 libgcc_s.so.1 libc.so.6)를 복사했지만 여전히 chroot를 실행할 수 없습니다./bin 내의 모든 명령에. 그래서 기본 jffs2/lib에있는 모든 libs를 복사 했으므로 이제는 정상적으로 작동합니다. 실제로 누락 된 항목을 확인하지 않았습니다. – mdaniel

+0

전혀 대답이없는 또 다른 요점은, 아마도 새 스레드를 열어 보겠다. (?) 은 나에 의해 컴파일 된 busybox로 생성 된 램 디스크에 관한 것이다. 나는 "SU"애플릿이 포함되어 있지만 내가 램 디스크 후 실행하려고 할 때마다 나는 다음과 같은 얻을 rootfs로 장착되어있다 비지 박스 바이너리가 +의 비트가 설정하고 : "알 수없는 사용자 루트 SU" su에서 busybox 로의 심볼릭 링크입니다. -rwsr-sr-x1 1000 1000 년 1 월 4 일 2015 su-> busybox lrwxrwxrwx 1 1000 1000 1912608 1 월 4 일 2015 busybox – mdaniel

답변

1

누락 된 라이브러리가 실행 불가능한 초기화의 근본 원인이었습니다. chroot을 사용하면 매우 유용합니다. 이 문제로 나는 chroot을 사용하고 감옥을 시뮬레이트하는 법을 배웠습니다.

또 다른 트릭

명령 줄에서 user_debug=31을 사용하는 것이었다 커널이 출력 파일이 발견되지 않았다는 메시지 수 있도록. 은 그것은 "파일을 찾을 수 없습니다"정말 누락 된 파일을 가리하지만, 파일 시스템을 읽을 수있는 오류로 인해이 제대로 실행되지 비지 박스에없는 (없는 라이브러리)처럼 보인다.

병렬에서 나는 내 팔 아키텍처 동적으로 비지 박스 1.20.02를 컴파일하고 램 디스크 (libs가없이) 제대로했다. 이 user_debug=31 내가 컴파일 할 때 다시 유용한 것으로 밝혀졌다 그것은 또한 램 디스크를 장착 한 후 실패되면서, 비지 박스를 실행하지만, 비지 박스를 컴파일하는 데 잘못 "아치"값으로 나를 이끄는 "정의되지 않은 예외"를 밖으로 던져. 그것을 바꾼 후에 모든 것이 좋았다.

관련 문제