[klibc] sparc32: transfer arch-specific options to /arch.cmd
Boot options which have been obtained in an architecture-specific
fashion have to be copied to /arch.cmd in the rootfs. This implements
that functionality for sparc32; the code is identical to sparc64 minus
the openprom support for obtaining nfsroot options.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
index 8606ef4..430527c 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -240,8 +240,6 @@
#define RAMDISK_PROMPT_FLAG 0x8000
#define RAMDISK_LOAD_FLAG 0x4000
-extern int root_mountflags;
-
char reboot_command[COMMAND_LINE_SIZE];
enum sparc_cpu sparc_cpu_model;
@@ -328,14 +326,7 @@
}
pfn_base = phys_base >> PAGE_SHIFT;
- if (!root_flags)
- root_mountflags &= ~MS_RDONLY;
ROOT_DEV = old_decode_dev(root_dev);
-#ifdef CONFIG_BLK_DEV_RAM
- rd_image_start = ram_flags & RAMDISK_IMAGE_START_MASK;
- rd_prompt = ((ram_flags & RAMDISK_PROMPT_FLAG) != 0);
- rd_doload = ((ram_flags & RAMDISK_LOAD_FLAG) != 0);
-#endif
prom_setsync(prom_sync_me);
@@ -388,6 +379,44 @@
}
console_initcall(set_preferred_console);
+/*
+ * Platform-specific configuration commands which don't come from
+ * the actual kernel command line. Write them into a file in rootfs
+ * so kinit can pick them up.
+ */
+static int __init set_arch_init_commands(void)
+{
+ int fd = sys_open("/arch.cmd", O_WRONLY|O_CREAT|O_APPEND, 0666);
+ char buffer[256];
+ int len = 0;
+
+ if (fd < 0)
+ return fd;
+
+ buffer[0] = 'r';
+ buffer[1] = root_flags ? 'o' : 'w';
+ buffer[2] = '\n';
+ len = 3;
+
+#ifdef CONFIG_BLK_DEV_RAM
+ len += min((int)(sizeof buffer - 1 - len),
+ snprintf(buffer+len, sizeof buffer - len,
+ "ramdisk_start=%u\n"
+ "prompt_ramdisk=%d\n"
+ "load_ramdisk=%d\n",
+ ram_flags & RAMDISK_IMAGE_START_MASK,
+ !!(ram_flags & RAMDISK_PROMPT_FLAG),
+ !!(ram_flags & RAMDISK_LOAD_FLAG)));
+#endif
+
+ sys_write(fd, buffer, len);
+ sys_close(fd);
+
+ return 0;
+}
+
+late_initcall(set_arch_init_commands);
+
extern char *sparc_cpu_type;
extern char *sparc_fpu_type;