Hi all,
I am trying to build a basic linux system from kernel and busybox, using my debian 9 linux machine. I am referring to the tutorial at
Basically, there are four things which I am doing.
1. Compiling the kernel from source :-
The kernel bzImage is stored in the folder /arch/x86/boot/ folder after successful make.
2. Next I download the busybox source code and build it statically :-
Quote:
make allnoconfig
make menuconfig
|
Enabling satic linking under Settings -> Build Options -> Build static binary(no shared library)
After the binary is ready, I check whether it is statically linked by using :-
the system responds with "not a dynamic executable"
3. I then create a root filesystem as under:-
Quote:
mkdir rootfs
cd rootfs
mkdir dev proc sys tmp
mknod dev/console c 5 1
|
I also create a init file as under :-
Quote:
cat >> init << EOF
#!/bin/ash
mount -t proc none /proc
mount -t sysfs none /sys
/bin/ash
EOF
|
Change it's permissions
Finally, I issue the commands :-
Quote:
find . | cpio -H newc -o | gzip > ../rootfs.cpio.gz
|
4. After this I take a usb drive and load grub onto it :-
Quote:
mkfs.ext3 /dev/sdb1
mount /dev/sdb1 /mnt
grub-install --root-directory=/mnt /dev/sdb
|
Lastly, I just copy the files created in steps 1 -3 in the root partition of the usb
bzImage, busybox, rootfs.cpio.gz
Then as I insert my usb disk into a system and choose to boot from it, I get a grub prompt where I give the following commands :-
Quote:
set root=(hd0,msdos1)
linux /bzImage
initrd /rootfs.cpio.gz
|
The system boots up but halts with a kernel panic message as under :-
Quote:
kernel panic - not syncing: No working init found. Try passing init= option to kernel
|
Can someone help me sort this problem and get the kernel to find init and execute it correctly.
I am sorry for the unusually long post. But thought the details would be needed to help me properly.
thanks in advance