diff options
author | Jeremy Katz <katzj@redhat.com> | 2004-12-20 22:59:39 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2004-12-20 22:59:39 +0000 |
commit | bc0daa45a1f16daf67bec55e97a5c5bd9b439a59 (patch) | |
tree | 1f55e4656f8f4575d925e22a004613b65a254147 | |
parent | 0c5e63fd0bd7f347bff8114d747e3ba78f0114b2 (diff) | |
download | anaconda-bc0daa45a1f16daf67bec55e97a5c5bd9b439a59.tar.gz anaconda-bc0daa45a1f16daf67bec55e97a5c5bd9b439a59.tar.xz anaconda-bc0daa45a1f16daf67bec55e97a5c5bd9b439a59.zip |
2004-12-20 Jeremy Katz <katzj@redhat.com>
* loader2/devices.h: Add static list of basic devices to create in
/dev.
* loader2/init.c: Create /dev as a tmpfs so that we don't try to
bind-mount to the rootfs (#141570)
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | loader2/devices.h | 95 | ||||
-rw-r--r-- | loader2/init.c | 40 |
3 files changed, 141 insertions, 0 deletions
@@ -1,5 +1,11 @@ 2004-12-20 Jeremy Katz <katzj@redhat.com> + * loader2/devices.h: Add static list of basic devices to create in + /dev. + + * loader2/init.c: Create /dev as a tmpfs so that we don't try to + bind-mount to the rootfs (#141570) + * packages.py (doPreInstall): Some finagling for kernel-*devel handling (#143257) diff --git a/loader2/devices.h b/loader2/devices.h new file mode 100644 index 000000000..59aeb1692 --- /dev/null +++ b/loader2/devices.h @@ -0,0 +1,95 @@ +/* + * devices.h: handle declaration of devices to be created under /dev + * + * Copyright 2004 Red Hat, Inc. + * + * This software may be freely redistributed under the terms of the GNU + * general public license. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef LOADER_INIT_DEVICES_H +#define LOADER_INIT_DEVICES_H + +struct devnode { + char * devname; + int type; + int major; + int minor; + int perms; + char * owner; + char * group; +}; + +#define CHARDEV 0 +#define BLOCKDEV 1 +#define DIRTYPE 2 + +struct devnode devnodes[] = { + /* consoles */ + {"console", CHARDEV, 5, 1, 0600, "root", "root"}, + {"ttyS0", CHARDEV, 4, 64, 0600, "root", "root"}, + {"ttyS1", CHARDEV, 4, 65, 0600, "root", "root"}, + {"ttyS2", CHARDEV, 4, 66, 0600, "root", "root"}, + {"ttyS3", CHARDEV, 4, 67, 0600, "root", "root"}, +#ifdef __ia64__ + {"ttySG0", CHARDEV, 204, 40, 0600, "root", "root"} +#endif +#ifdef __powerpc__ + {"hvsi0", CHARDEV, 229, 128, 0600, "root", "root"} + {"hvsi1", CHARDEV, 229, 129, 0600, "root", "root"} + {"hvsi2", CHARDEV, 229, 130, 0600, "root", "root"} + {"hvc0", CHARDEV, 229, 0, 0600, "root", "root"} +#endif + /* base unix */ + {"null", CHARDEV, 1, 3, 0666, "root", "root"}, + {"zero", CHARDEV, 1, 5, 0666, "root", "root"}, + {"mem", CHARDEV, 1, 1, 0600, "root", "root"}, + /* ttys */ + {"pts", DIRTYPE, 0, 0, 0755, "root", "root"}, + {"ptmx", CHARDEV, 5, 2, 0666, "root", "root"}, + {"tty", CHARDEV, 5, 0, 0666, "root", "root"}, + {"tty0", CHARDEV, 4, 0, 0600, "root", "tty"}, + {"tty1", CHARDEV, 4, 1, 0600, "root", "tty"}, + {"tty2", CHARDEV, 4, 2, 0600, "root", "tty"}, + {"tty3", CHARDEV, 4, 3, 0600, "root", "tty"}, + {"tty4", CHARDEV, 4, 4, 0600, "root", "tty"}, + {"tty5", CHARDEV, 4, 5, 0600, "root", "tty"}, + {"tty6", CHARDEV, 4, 6, 0600, "root", "tty"}, + {"tty7", CHARDEV, 4, 7, 0600, "root", "tty"}, + {"tty8", CHARDEV, 4, 8, 0600, "root", "tty"}, + {"tty9", CHARDEV, 4, 9, 0600, "root", "tty"}, + /* fb */ + {"fb0", CHARDEV, 29, 0, 0600, "root", "tty"}, + /* sparc specific */ +#ifdef __sparc__ + {"openprom", CHARDEV, 10, 139, 0644, "root", "root"}, + {"sunmouse", CHARDEV, 10, 6, 0644, "root", "root"}, + {"kbd", CHARDEV, 11, 0, 0644, "root", "root"}, +#endif + /* X */ + {"agpgart", CHARDEV, 10, 175, 0664, "root", "root"}, + {"psaux", CHARDEV, 10, 1, 0644, "root", "root"}, + {"input", DIRTYPE, 0, 0, 0755, "root", "root"}, + {"input/mice", CHARDEV, 13, 63, 0664, "root", "root"}, + /* floppies */ + {"fd0", BLOCKDEV, 2, 0, 0644, "root", "root"}, + {"fd1", BLOCKDEV, 2, 1, 0644, "root", "root"}, + /* random */ + {"random", CHARDEV, 1, 8, 0644, "root", "root"}, + {"urandom", CHARDEV, 1, 9, 0644, "root", "root"}, + /* mac stuff */ +#ifdef __powerpc__ + {"nvram", CHARDEV, 10, 144, 0644, "root", "root"}, + {"adb", CHARDEV, 56, 0, 0644, "root", "root"}, + {"iseries", DEVTYPE, 0, 0, 0755, "root", "root" }, +#endif + {"rtc", CHARDEV, 10, 135, 0644, "root", "root"}, + { NULL, 0, 0, 0, 0, NULL, NULL }, +}; + +#endif diff --git a/loader2/init.c b/loader2/init.c index 495bfe65d..c7047d4f9 100644 --- a/loader2/init.c +++ b/loader2/init.c @@ -50,6 +50,7 @@ #include <libgen.h> #include "devt.h" +#include "devices.h" #define syslog klogctl #endif @@ -380,6 +381,37 @@ static int copyDirectory(char * from, char * to) { return 0; } +static void createDevices(void) { + int i; + + for (i = 0; devnodes[i].devname; i++) { + char devname[64]; + int type = -1; + + snprintf(devname, 63, "/dev/%s", devnodes[i].devname); + switch (devnodes[i].type) { + case DIRTYPE: + if (mkdir(devname, devnodes[i].perms) < 0) { + fprintf(stderr, "Unable to create directory %s: %s\n", + devname, strerror(errno)); + break; + case CHARDEV: + type = S_IFCHR; + break; + case BLOCKDEV: + type = S_IFDIR; + break; + } + if (type == -1) continue; + + if (mknod(devname, type | devnodes[i].perms, + makedev(devnodes[i].major, devnodes[i].minor)) < 0) + fprintf(stderr, "Unable to create device %s: %s\n", devname, + strerror(errno)); + } + } +} + static void termReset(void) { /* change to tty1 */ ioctl(0, VT_ACTIVATE, 1); @@ -498,6 +530,14 @@ int main(int argc, char **argv) { } printf("done\n"); + printf("creating /dev filesystem... "); + if (!testing) { + if (mount("/dev", "/dev", "ramfs", 0, NULL)) + fatal_error(1); + createDevices(); + } + printf("done\n"); + printf("mounting /dev/pts (unix98 pty) filesystem... "); if (!testing) { if (mount("/dev/pts", "/dev/pts", "devpts", 0, NULL)) |