0
votes

I have an embedded ARM system with processor AT91SAM9G45.

System consists of two components:

  1. Linux kernel (4.14.79)
  2. Busybox 1.29.3 as initramfs image.

I connect to the device using putty and connecting to serial port.

When kernel starts, everything goes fine. Kernel unpacks initramfs image, all files are found and listed (I see it by debug messages). But when it starts /init, log messages are:

Freeing unused kernel memory: 384K
This architecture does not have kernel memory protection.
run_init_process BEFORE /init
run_init_process AFTER /init, result = 0
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004

/init is symlink to /bin/busybox. I tried to replace /init with /sbin/init, /bin/busybox, /linuxrc, but results are the same.

/etc/inittab file:

# Begin /etc/inittab

id::initdefault:

si::sysinit:/etc/init.d/rc S

#l0::wait:/etc/rc.d/init.d/rc 0
#l1::wait:/etc/rc.d/init.d/rc 1
#l2::wait:/etc/rc.d/init.d/rc 2
#l3::wait:/etc/rc.d/init.d/rc 3
#l4::wait:/etc/rc.d/init.d/rc 4
#l5::wait:/etc/rc.d/init.d/rc 5
#l6::wait:/etc/rc.d/init.d/rc 6

ca::ctrlaltdel:/sbin/shutdown -t1 -a -r now

su::once:/sbin/sulogin

1::respawn:/sbin/getty ttyS1 115200
2::respawn:/sbin/getty ttyS2 115200
3::respawn:/sbin/getty ttyS3 115200
4::respawn:/sbin/getty ttyS4 115200
5::respawn:/sbin/getty ttyS5 115200
6::respawn:/sbin/getty ttyS6 115200

# End /etc/inittab

/etc/init.d/rcS file (this file is allowed to execute):

#!/bin/busybox sh
echo "Hello world!"

I don't know if even /init process starts parsing /etc/inittab or it falls before getting /etc/inittab by some reasons I cannot find out. Maybe there are some mistakes in my /etc/inittab and /etc/init.d/rcS files. Maybe there are some errors with terminal (/etc/init.d/rcS cannot write to stdout cause it's blocked, suspended, being used by another process and so on).

How to definitely get sured, that /etc/inittab is started?

2
I cross-compiled BusyBox and linux kernel with same CROSS_COMPILER option: CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- The linux kernel version is 4.14.79. If I open compiled busybox binary with F3 at Midnight Commander, I see: /some/path/to/busybox/bin/busybox: ELF 32-bit LSB executable, ARM, EABI5 version 1(SYSV), statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=921ca074aa7e285cb654d1d1d7acc0cc88c039of, stripped. I suppose that I must compile busybox for GNU/Linux 4.14.79, but don't see the way to do this.vglv

2 Answers

0
votes

Welcome to StackOverflow. I see there is space between rc and S si::sysinit:/etc/init.d/rc S

change it to

si::sysinit:/etc/init.d/rcS

let me know if it works.

0
votes

/init is symlink to /bin/busybox.

The typical /init file in an initramfs built by Buildroot that incorporates Busybox is a script of seven lines:

#!/bin/sh
# devtmpfs does not get automounted for initramfs
/bin/mount -t devtmpfs devtmpfs /dev
exec 0</dev/console
exec 1>/dev/console
exec 2>/dev/console
exec /sbin/init $*

Note the comment ("devtmpfs does not get automounted for initramfs") and the mount command for /dev.

It's /sbin/init (rather than /init) that is linked to /bin/busybox.

IOW without the proper setup of the /dev directory, userland has no I/O capabilty.
Only after devtmpfs has been mounted should the init program in Busybox be executed, which will then access /etc/inittab.

See Is there a way to get Linux to treat an initramfs as the final root filesystem?
and
Make CONFIG_DEVTMPFS_MOUNT apply to initramfs/initmpfs