a "/.lfsstd" and the kernel

Rick Hohensee (humbubba@smarty.smart.net)
Thu, 3 Jun 1999 04:58:18 -0400 (EDT)


I just tried out a kernel with the following tail end on init/main.c...

######################################################################
/*
* The kernel needs an executable to invoke. Something that allows
* user-input might be handy. We try a "command line arg", init, then
* a shell. Failing that, we print a sympathetic post-mortem.
* The .bi/.sbi stuff is for the /.lfsstd .
*/

if (execute_command)
execve(execute_command,argv_init,envp_init);
execve("/sbin/init",argv_init,envp_init);
execve("/.sbi/init",argv_init,envp_init);
execve("/etc/init",argv_init,envp_init);
execve("/bin/init",argv_init,envp_init);
execve("/bin/sh",argv_init,envp_init);
execve("/.bi/bash",argv_init,envp_init);
printk("You almost booted. Starting e.g. init is the last step,
\n");
printk("from the kernel's point of view.\n");
panic("Can't execute init or a shell. rdev/rootflags/Makefile may
pertain.");
}

/* and then Barbra Streisand sings...

Kernels... kernels that need executables... are the luckiest kernels...
in the world .....

*/

##################################################################

Then I rigged up a root floppy image for it to boot to that doesn't have
/bin, /etc, /sbin... well, here's what it does have...

$ls
COPYING cat_me configure help log mount subroutine
GUIDE command dev kernel lost+found scratch suite

or rather...

$ls -a
. .et .pro .us GUIDE configure kernel mount suite
.. .li .sbi .va cat_me dev log scratch
.bi .mn .tm COPYING command help lost+found subroutine

Here's what's in /command....

$ls command
agetty cat dmesg gzip loadkeys mke2fs mv sh telinit
bash chroot dump hhhh login mknod rdev stty
bpe cp ed init ls mkswap rm swapon
c: dd fdisk kill mingetty mount setfont sync
calc df free ln mkdir mt setterm tar

I gave up for now on ps, but all the above works. I twiddled all the
references to /etc/ and so on in the binaries with bpe.

This puts the filesystem standard where it belongs; behind a dot. Oh, a
bit more explanatory matter...

$file .*
.: directory
..: directory
.bi: symbolic link to command/
.et: symbolic link to configure
.li: symbolic link to subroutine/
.mn: symbolic link to mount
.pro: symbolic link to kernel
.sbi: symbolic link to command/
.tm: symbolic link to scratch/
.us: symbolic link to suite/
.va: symbolic link to log

so /sbin is now /.sbi, and so on. This has the nice property of being the
same size as the predominant name, so it can be changed in-situ even in
commercial binaries perhaps.

This also facilitates internationalization of the file namespace a user
sees. I'm not fooling with /dev though. ps beat me due to some /proc
issues, but other ones that don't use it as much work with /kernel.

The boot/root combo probably boots on any 386+ with a floppy drive, and
has 3 vt's and docs and stuff. Said images are at...

ftp linux01.gwdg.de in /pub/cLIeNUX/interim

Rick Hohensee

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/