Skip to contentSkip to conversation

bzImage, root device Q

DISCUSSION D. Stimits 2 participants 2 messages Jul 20, 2001

lore
Share & tools
lore

D. Stimits

author
#0 lore raw

When booting to a bzImage kernel, bytes 508 and 509 can be used to name the minor and major number of the intended root device (although it can be overridden with a command line parameter). Other characteristics are also available this way, through bytes in the kernel. rdev makes a convenient way to hex edit those bytes.

What I'm more curious about is how does the kernel know what filesystem _type_ the root is? Are there similar bytes in the bzImage, and can rdev change this? And is there a command line syntax to allow specifying filesystem type (e.g., something like "vmlinuz root=/dev/scd0,iso9660" or "vmlinuz root=/dev/scd0,xfs")? Or is this limited in some way, requiring mount on one or a few known filesystem types ("linux native" subset comes to mind), followed by a chroot or pivot_root style command (which in turn means no direct root mount of some filesystem types)?

D. Stimits, [email protected]

#1 lore raw
Quoted 6 lines · D. Stimits

When booting to a bzImage kernel, bytes 508 and 509 can be used to name the minor and major number of the intended root device (although it can be overridden with a command line parameter). Other characteristics are also available this way, through bytes in the kernel. rdev makes a convenient way to hex edit those bytes.

Quoted 8 lines

What I'm more curious about is how does the kernel know what filesystem _type_ the root is? Are there similar bytes in the bzImage, and can rdev change this? And is there a command line syntax to allow specifying filesystem type (e.g., something like "vmlinuz root=/dev/scd0,iso9660" or "vmlinuz root=/dev/scd0,xfs")? Or is this limited in some way, requiring mount on one or a few known filesystem types ("linux native" subset comes to mind), followed by a chroot or pivot_root style command (which in turn means no direct root mount of some filesystem types)?

Take a look at fs/super.c - function mount_root().

It reads the file system superblock (from the major/minor specified root device) and determines the filesystem from that. There is a loop that cycles through all known (ie built in) file systems until one works.

If none do, then it panics.

Signature · 5 lines
-------------------------------------------------------------------------
Jesse I Pollard, II
Email: [email protected]

Any opinions expressed are solely my own.