[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[RFC]: d-i, /dev, busybox



My goal is to make debian-installer create the files in /dev on boot, and I
would also like to use busybox's linuxrc-init-inittab feature because it is
clean and fairly standard.  There are a couple ways we can do this, all have
drawbacks, I know this is a solved problem so I'm looking for advice, someone to
poitn out something I missed.

I've gotten Methods A and B to work so there aren't any hidden problems with
them as far as I know.

-----
Method A

This one is cool because I don't have to create anything in /dev

proposed flow:
-linuxrc isn't busybox init but rather a script that populates /dev/ and then
calls init(linuxrc) in a funny way. /linuxrc looks like this:
# cat /linuxrc
#!/bin/sh
/etc/init.d/makedevs
/sbin/linuxrc
#
-/sbin/linuxrc is a smylink to /bin/busybox, it is called that way so it
behaves the way I want it to.  I feel a bit wierd about this, I feel like I am
abusing busybox, or something.

-----------
Method B

This one is grimerier in that it will require more patches to busybox, but in
some ways makes more sense.

Here's one proposed flow (this works, with the included patch to busybox, though
I still have to create /dev/null beforehand.):

-linuxrc (in busybox pretty much same as init) reads inittab
-linuxrc executes /etc/init.d/rcS
-/etc/init.d/rcS creates nodes in /dev/ first thing, then does other stuff
-linuxrc can now do other stuff since /dev is populated.


One problem that this patch tries to fix:

-when inittab is read busybox makes sure the tty existsi for each entry, if it
doesn't exist the action is ditched.  Since inittab is read before /dev is
populated this isn't what we want.

Another problem is that I need to create /dev/null so rcS has a tty.  This could
be fixed by applying another patch to busybox.

------------------------
Method C

Don't use busybox init (linuxrc) at all.  We roll our own simple boot sequence.
I think we'd rather not do it this way.  I'm in favor of using ready-made tools
when possible.


--------------

Thoughts, critisism, wisdom, send it my way.

Thanks,

David



Exhibit 1 : This is a patch that makes Method B work.

diff -uwr orig/busybox-0.49pre/debian/Config.h-udeb busybox-0.49pre/debian/Config.h-udeb
--- orig/busybox-0.49pre/debian/Config.h-udeb	Sat Jan 20 13:43:43 2001
+++ busybox-0.49pre/debian/Config.h-udeb	Mon Feb 12 19:10:41 2001
@@ -59,7 +59,7 @@
 //#define BB_LOGNAME
 #define BB_LS
 //#define BB_LSMOD
-//#define BB_MAKEDEVS
+#define BB_MAKEDEVS
 //#define BB_MD5SUM
 #define BB_MKDIR
 //#define BB_MKFIFO
@@ -180,6 +180,13 @@
 //
 // Make init use a simplified /etc/inittab file (recommended).
 #define BB_FEATURE_USE_INITTAB
+
+// If init sees problems with /etc/inittab it will abort.  If this is
+// not defined then iupon encountering problems with /etc/inittab init 
+// will assume the inittab author knew what they were doing and will 
+// continue as long as possible with potentially unpredictable results. 
+// 
+//#define BB_FEATURE_STRICT_INITTAB
 //
 //Enable init being called as /linuxrc
 #define BB_FEATURE_LINUXRC
diff -uwr orig/busybox-0.49pre/init.c busybox-0.49pre/init.c
--- orig/busybox-0.49pre/init.c	Wed Dec 13 08:41:29 2000
+++ busybox-0.49pre/init.c	Mon Feb 12 19:34:57 2001
@@ -892,12 +892,14 @@
 
 					strcpy(tmpConsole, "/dev/");
 					strncat(tmpConsole, id, 200);
+#ifdef BB_FEATURE_STRICT_INITTAB
 					if (stat(tmpConsole, &statBuf) != 0) {
 						message(LOG | CONSOLE,
 								"device '%s' does not exist.  Did you read the directions?\n",
 								tmpConsole);
 						break;
 					}
+#endif /* BB_FEATURE_STRICT_INITTAB */
 					id = tmpConsole;
 				}
 				new_initAction(a->action, process, id);



Reply to: