Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What are the necessary packages to boot kernel?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
colag
Tux's lil' helper
Tux's lil' helper


Joined: 26 Sep 2009
Posts: 100
Location: Dhaka, Bangladesh

PostPosted: Thu Oct 13, 2016 11:43 am    Post subject: What are the necessary packages to boot kernel? Reply with quote

Debian is the existing linux.
I'm trying to boot kernel from an empty partition (/dev/sda1).
These are the empty directories in that partition.
Code:

bin  boot  dev   include  lib  media  mnt  proc   sbin  sys  tmp   usr  var

Kernel source is in /usr/src.
What I tried:
Code:

mount /dev/sda1 /media/sda1
cd /media/sda1/usr/src/linux-4.8
make menuconfig
make INSTALL_MOD_PATH=/media/sda1 modules_install
cp -v arch/x86/boot/bzImage /media/sda1/boot/vmlinuz-4.8.0
cp -v System.map /media/sda1/boot/System.map-4.8.0
cp -v .config /media/sda1/boot/config-4.8.0
reboot

Got error something like this:
Code:

Kernel panic unable to mount rootfs

Why is this error?
What other packages do I have to install to boot kernel?


Last edited by colag on Mon Oct 17, 2016 5:41 am; edited 1 time in total
Back to top
View user's profile Send private message
xaviermiller
Administrator
Administrator


Joined: 23 Jul 2004
Posts: 8074
Location: ~Brussels - Belgique

PostPosted: Thu Oct 13, 2016 11:52 am    Post subject: Reply with quote

Hi!,

Did you add the support for the disk controller and filesystem ?

/dev need also to contain /dev/console and /dev/null before /dev is mounted into devtmpfs (don't forget to enable it)

Then you need at least one init system.

More info at http://www.tldp.org/HOWTO/From-PowerUp-To-Bash-Prompt-HOWTO.html
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
colag
Tux's lil' helper
Tux's lil' helper


Joined: 26 Sep 2009
Posts: 100
Location: Dhaka, Bangladesh

PostPosted: Thu Oct 13, 2016 3:49 pm    Post subject: Reply with quote

xaviermiller wrote:
Did you add the support for the disk controller and filesystem ?

What does that mean? Can you please explain this more?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43754
Location: 56N 3W

PostPosted: Thu Oct 13, 2016 4:13 pm    Post subject: Reply with quote

colag,

If you mean have the kernel load and attempt to mount the root filesystem, a boot loader and kernel are required.
No more. Root will mount and you will get an error about /sbin/init missing.

The next step is to include a statically built /bin/busybox in the root filesystem and add init=/bin/busybox to your kernel command line.

Adding in /bin/bash in place of /bin/busybox is a little harder as bash is dynamically linked.
You need all the libraries too. lddtree /bin/bash will tell you what they are.

These options don't give you much more that a shell. Does that cover your definition of booted?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
colag
Tux's lil' helper
Tux's lil' helper


Joined: 26 Sep 2009
Posts: 100
Location: Dhaka, Bangladesh

PostPosted: Fri Oct 14, 2016 7:48 am    Post subject: Reply with quote

NeddySeagoon wrote:
The next step is to include a statically built /bin/busybox in the root filesystem and add init=/bin/busybox to your kernel command line.

This works:
Code:

linux   /boot/vmlinuz-4.8.0 root=/dev/sda1 ro init=/bin/busybox hush

But this doesn't work:
Code:

linux   /boot/vmlinuz-4.8.0 root=UUID=69b65444-5f22-4b9b-9afc-3a815c0d44b8 ro init=/bin/busybox hush

This gets error like this:
Code:

Kernel panic VFS: Unable to mount root fs

lddtree /bin/bash doesn't work in debian,
Code:
bash: lddtree: command not found

Code:

ldd /bin/bash
   linux-gate.so.1 (0xb771f000)
   libncurses.so.5 => /lib/i386-linux-gnu/libncurses.so.5 (0xb76d8000)
   libtinfo.so.5 => /lib/i386-linux-gnu/libtinfo.so.5 (0xb76b5000)
   libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb76af000)
   libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb7502000)
   /lib/ld-linux.so.2 (0xb7722000)

If I want to run bash, do I need these:
Code:

ncurses
glibc

What are linux-gate.so.1,libtinfo.so.5,libdl.so.2 ?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43754
Location: 56N 3W

PostPosted: Fri Oct 14, 2016 8:03 am    Post subject: Reply with quote

colag,

Code:
linux   /boot/vmlinuz-4.8.0 root=UUID=69b65444-5f22-4b9b-9afc-3a815c0d44b8 ro init=/bin/busybox hush

fails as mounting root by filesystem UUID requires that the userspace mount command be available, so requires an initrd.

The kernel understands PARTUUID without any outside help. root=PARTUUID=<your_root_partition_PARTUUID> will work.
Note that the filesystem UUID and PARTUUID are different values because they refer to different objects.

/sbin/blkid:
/dev/sda2: UUID="b6633d8e-41ef-4485-9bbe-c4c2d69f4e8c" TYPE="swap" PARTUUID="0553caf4-02"

Thats swap on on MSDOS partition by way of an example.
The PARTUUID format varies with the partition table type in use.

The following is /boot on GPT
/sbin/blkid:
/dev/sde1: UUID="c400b18c-0210-4338-a0fd-f437ecbaaf99" TYPE="ext4" PARTLABEL="ext4" PARTUUID="150e6ef1-7ba8-409c-9c3f-dbdecdc9f18b

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum