Bernard Li wrote:
> Was trying to build SystemImager trunk as a non-root user, can got the
> following error:
> 
> cd
> /home/bli/rpmbuild/BUILD/systemimager-3.7.2r3474M_bli/initrd_source/buil
> d_dir/dev && mknod -m 660 console c 5 1
> mknod: `console': Operation not permitted
> make: ***
> [/home/bli/rpmbuild/BUILD/systemimager-3.7.2r3474M_bli/initrd_source/bui
> ld_dir.prep] Error 1
> error: Bad exit status from /var/tmp/rpm-tmp.31264 (%build)
> 
> Would it be possible to tar up the special files (console, null) and
> just copy them over as needed?
> 
> Cheers,
> 
> Bernard

Another way could be to let the kernel to create the devices (the patch
is very very simple - see the attachment), but to do that the initrd fs
would be writeable and at the moment this is not our case (cramfs is a
read-only fs)... To obviate this problem we could start to consider to
use cpio ramdisk, also the most part of the latest distro seem to move
in this direction... I did some tests trying to create a gzipped cpio
initrd and that was very nice! 4.2MB instead of 5MB with a gzipped
cramfs ramdisk.

Unfortunately there are some incompatibilities with pivot_root and cpio
rootfs (see
/usr/src/linux/Documentation/filesystems/ramfs-rootfs-initramfs.txt), so
I've not spent other time to check if there's a workaround, or better
the workaround should be to use switch_root (already present in the
recent busybox 1.1.1), but the behaviour of switch_root is quite
different than pivot_root...

Cheers,
-Andrea
--- linux-2.6.16/init/main.c.orig	2006-03-20 06:53:29.000000000 +0100
+++ linux-2.6.16/init/main.c	2006-03-25 10:14:45.000000000 +0100
@@ -710,6 +710,17 @@
 	system_state = SYSTEM_RUNNING;
 	numa_default_policy();
 
+	/* Special devices needed by BOEL */
+	if (sys_mknod((const char __user *) "/dev/console", S_IFCHR | 0600,
+		new_encode_dev(MKDEV(5, 1))) < 0)
+		printk(KERN_WARNING "Warning: unable to create special file /dev/console.\n");
+	if (sys_mknod((const char __user *) "/dev/null", S_IFCHR | 0666,
+		new_encode_dev(MKDEV(1, 3))) < 0)
+		printk(KERN_WARNING "Warning: unable to create special file /dev/null.\n");
+
 	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
 		printk(KERN_WARNING "Warning: unable to open an initial console.\n");
 

Reply via email to