diff mbox

sh: Add CONFIG_PARAM_* to set boot parameters.

Message ID 20091210140025.9f989f97.yoshii.takashi@gmail.com
State Changes Requested
Headers show

Commit Message

yoshii.takashi@gmail.com Dec. 10, 2009, 5 a.m. UTC
None
diff mbox

Patch

diff --git a/arch/sh/boot/compressed/head_32.S b/arch/sh/boot/compressed/head_32.S
index 02a3093..0a96edb 100644
--- a/arch/sh/boot/compressed/head_32.S
+++ b/arch/sh/boot/compressed/head_32.S
@@ -99,6 +99,12 @@  decompress_kernel_addr:
 kernel_start_addr:
 	.long	_text+PAGE_SIZE
 
+#if defined(CONFIG_CMDLINE)
+	.skip	startup + 0x100 - .
+cmdline:
+	.asciz	CONFIG_CMDLINE	! default command line
+#endif
+
 	.align	9
 fake_headers_as_bzImage:
 	.word	0
@@ -117,3 +123,48 @@  fake_headers_as_bzImage:
 	.long	0x100000	! 0x100000 = default for big kernel
 	.long	0		! address of loaded ramdisk image
 	.long	0		# its size in bytes
+
+	.skip	startup + 0x220 - .
+
+	! address of empty_zero_page
+#ifdef CONFIG_PMB_FIXED
+	.long	CONFIG_PAGE_OFFSET + (CONFIG_MEMORY_START & 0x1fffffff) \
+		+ CONFIG_ZERO_PAGE_OFFSET
+#elif defined(CONFIG_32BIT)
+	.long	CONFIG_PAGE_OFFSET + CONFIG_ZERO_PAGE_OFFSET
+#else
+	.long	CONFIG_PAGE_OFFSET + CONFIG_MEMORY_START \
+		+ CONFIG_ZERO_PAGE_OFFSET
+#endif
+	.long	_edata - startup	! size of zImage
+	.long	default_values - startup
+
+	! default values of boot parameters and flags
+	.align	2
+default_values:
+#ifdef CONFIG_PARAM_BOOL
+	.long	CONFIG_PARAM_MOUNT_ROOT_RDONLY
+	.long	CONFIG_PARAM_RAMDISK_FLAGS
+	.long	CONFIG_PARAM_ORIG_ROOT_DEV
+	.long	CONFIG_PARAM_LOADER_TYPE
+	.long	CONFIG_PARAM_INITRD_START
+	.long	CONFIG_PARAM_INITRD_SIZE
+#else
+	.long	1		/* MOUNT_ROOT_RDONLY */
+	.long	0		/* RAMDISK_FLAGS */
+	.long	0x0200		/* ORIG_ROOT_DEV */
+	.long	1		/* LOADER_TYPE */
+	.long	0x00000000	/* INITRD_START */
+	.long	0x00000000	/* INITRD_SIZE */
+#endif
+	! Mode flag
+#ifdef CONFIG_32BIT
+	.long	0x53453f00 + 32 /* "SE?" = 32 bit */
+#else
+	.long	0x53453f00 + 29 /* "SE?" = 29 bit */
+#endif
+#if defined(CONFIG_CMDLINE)
+	.long	cmdline - startup	! offset of the default command line
+#else
+	.long	0			! no default provided
+#endif
diff --git a/arch/sh/kernel/head_32.S b/arch/sh/kernel/head_32.S
index a78be74..58325fe 100644
--- a/arch/sh/kernel/head_32.S
+++ b/arch/sh/kernel/head_32.S
@@ -27,17 +27,36 @@ 
 
 	.section	.empty_zero_page, "aw"
 ENTRY(empty_zero_page)
+#ifdef CONFIG_PARAM_BOOL
+	.long	CONFIG_PARAM_MOUNT_ROOT_RDONLY
+	.long	CONFIG_PARAM_RAMDISK_FLAGS
+	.long	CONFIG_PARAM_ORIG_ROOT_DEV
+	.long	CONFIG_PARAM_LOADER_TYPE
+	.long	CONFIG_PARAM_INITRD_START
+	.long	CONFIG_PARAM_INITRD_SIZE
+#else
 	.long	1		/* MOUNT_ROOT_RDONLY */
 	.long	0		/* RAMDISK_FLAGS */
 	.long	0x0200		/* ORIG_ROOT_DEV */
 	.long	1		/* LOADER_TYPE */
 	.long	0x00000000	/* INITRD_START */
 	.long	0x00000000	/* INITRD_SIZE */
+#endif
 #ifdef CONFIG_32BIT
 	.long	0x53453f00 + 32	/* "SE?" = 32 bit */
 #else
 	.long	0x53453f00 + 29	/* "SE?" = 29 bit */
 #endif
+#if defined(CONFIG_CMDLINE)
+	.long	0x100		/* offset of the default command line */
+#else
+	.long	0
+#endif
+#if defined(CONFIG_CMDLINE)
+	.skip	empty_zero_page + 0x100 - .
+cmdline:
+	.asciz	CONFIG_CMDLINE	! default command line
+#endif
 1:
 	.skip	PAGE_SIZE - empty_zero_page - 1b
 
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 88cdeb9..97b2668 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -799,6 +799,41 @@  config CMDLINE
 	depends on CMDLINE_OVERWRITE || CMDLINE_EXTEND
 	default "console=ttySC1,115200"
 
+config PARAM_BOOL
+	bool "Default kernel params"
+	help
+	  Setting this option allows the boot parameters to be set.
+
+config PARAM_MOUNT_ROOT_RDONLY
+	int "MOUNT_ROOT_RDONLY"
+	depends on PARAM_BOOL
+	default 1
+
+config PARAM_RAMDISK_FLAGS
+	hex "RAMDISK_FLAGS"
+	depends on PARAM_BOOL
+	default 0
+
+config PARAM_ORIG_ROOT_DEV
+	hex "ORIG_ROOT_DEV"
+	depends on PARAM_BOOL
+	default 0x200
+
+config PARAM_LOADER_TYPE
+	hex "LOADER_TYPE"
+	depends on PARAM_BOOL
+	default 1
+
+config PARAM_INITRD_START
+	hex "INITRD_START"
+	depends on PARAM_BOOL
+	default 0
+
+config PARAM_INITRD_SIZE
+	hex "INITRD_SIZE"
+	depends on PARAM_BOOL
+	default 0
+
 endmenu
 
 menu "Bus options"