Skip to contentSkip to conversation

x86 boot : export boot_params via sysfs

PATCH In review Huang, Ying 4 participants 5 messages Dec 11, 2007 – Dec 12, 2007 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86 boot : export boot_params via sysfs

This patch export the boot parameters via sysfs. This can be used for debugging and kexec.

The files added are as follow:

/sys/kernel/boot_params/data : binary file for struct boot_params
/sys/kernel/boot_params/version : boot protocol version

This patch is based on 2.6.24-rc4-mm1 and has been tested on i386 and x86_64 platoform.

---
 arch/x86/kernel/Makefile_32 |    1 
 arch/x86/kernel/Makefile_64 |    1 
 arch/x86/kernel/ksysfs.c    |   94 ++++++++++++++++++++++++++++++++++++++++++++
 arch/x86/kernel/setup64.c   |    2 
 arch/x86/kernel/setup_32.c  |    2 
 5 files changed, 98 insertions(+), 2 deletions(-)
arch/x86/kernel/Makefile_64 +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_X86_VSMP)		+= vsmp_64.o
 obj-$(CONFIG_K8_NB)		+= k8.o
 obj-$(CONFIG_AUDIT)		+= audit_64.o
 obj-$(CONFIG_EFI)		+= efi.o efi_64.o efi_stub_64.o
+obj-$(CONFIG_SYSFS)		+= ksysfs.o
 
 obj-$(CONFIG_MODULES)		+= module_64.o
 obj-$(CONFIG_PCI)		+= early-quirks.o
arch/x86/kernel/setup64.c +1 -1
@@ -24,7 +24,7 @@
 #include <asm/sections.h>
 #include <asm/setup.h>
 
-struct boot_params __initdata boot_params;
+struct boot_params boot_params;
 
 cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
 
arch/x86/kernel/ksysfs.c new file +94 -0

94 lines not on this page · raw message

arch/x86/kernel/Makefile_32 +1 -0
@@ -44,6 +44,7 @@ obj-$(CONFIG_EARLY_PRINTK)	+= early_prin
 obj-$(CONFIG_HPET_TIMER) 	+= hpet.o
 obj-$(CONFIG_K8_NB)		+= k8.o
 obj-$(CONFIG_MGEODE_LX)		+= geode_32.o mfgpt_32.o
+obj-$(CONFIG_SYSFS)		+= ksysfs.o
 
 obj-$(CONFIG_VMI)		+= vmi_32.o vmiclock_32.o
 obj-$(CONFIG_PARAVIRT)		+= paravirt_32.o
arch/x86/kernel/setup_32.c +1 -1
@@ -194,7 +194,7 @@ unsigned long saved_videomode;
 
 static char __initdata command_line[COMMAND_LINE_SIZE];
 
-struct boot_params __initdata boot_params;
+struct boot_params boot_params;
 
 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
 struct edd edd;
#1 lore raw
Quoted 7 lines · Ying

This patch export the boot parameters via sysfs. This can be used for debugging and kexec.

The files added are as follow:

/sys/kernel/boot_params/data : binary file for struct boot_params
/sys/kernel/boot_params/version : boot protocol version

Your patch uses kobject_create_and_register() which was added in Greg's driver tree as of 2.6.24-rc4-mm1.

However for some reason kobject_create_and_register() has magically vanished from Greg's current driver tree so I cannot carry this patch, sorry.

#2 lore raw
Quoted 7 lines · Andrew Morton
Quoted 5 lines · Ying

This patch export the boot parameters via sysfs. This can be used for debugging and kexec.

The files added are as follow:

Quoted 8 lines
Quoted 2 lines

/sys/kernel/boot_params/data : binary file for struct boot_params
/sys/kernel/boot_params/version : boot protocol version

Your patch uses kobject_create_and_register() which was added in Greg's driver tree as of 2.6.24-rc4-mm1.

However for some reason kobject_create_and_register() has magically vanished from Greg's current driver tree so I cannot carry this patch, sorry.

Seems kobject_create_and_register would be replaced by kobject_create_and_add, and the uevent handling would be separated from original create_and_register onefunction.

wait for greg's patches or modify to use:

kobject_init
kobject_add
kobject_uevent

BTW, I suspect whether the uevent is really needed for boot_params object.

Regards
dave

#3 lore raw
Quoted 14 lines · Dave Young
Quoted 13 lines · Andrew Morton
Quoted 7 lines · Ying

This patch export the boot parameters via sysfs. This can be used for debugging and kexec.

The files added are as follow:

/sys/kernel/boot_params/data : binary file for struct boot_params
/sys/kernel/boot_params/version : boot protocol version

Your patch uses kobject_create_and_register() which was added in Greg's driver tree as of 2.6.24-rc4-mm1.

Quoted 6 lines
Quoted 2 lines

However for some reason kobject_create_and_register() has magically vanished from Greg's current driver tree so I cannot carry this patch, sorry.

Seems kobject_create_and_register would be replaced by kobject_create_and_add, and the uevent handling would be separated from original create_and_register onefunction.

Yes, that is what has now changed.

Quoted 7 lines

wait for greg's patches or modify to use:

kobject_init
kobject_add
kobject_uevent

BTW, I suspect whether the uevent is really needed for boot_params object.

Actually, for something as trivial as this, just use the kobject_create_and_add() and don't worry about the uevent. It should be pretty trivial.

thanks,

greg k-h

#4 lore raw
In reply to Dave Young
Quoted 21 lines · Dave Young
Quoted 7 lines · Andrew Morton
Quoted 5 lines · Ying

This patch export the boot parameters via sysfs. This can be used for debugging and kexec.

The files added are as follow:

Quoted 8 lines
Quoted 2 lines

/sys/kernel/boot_params/data : binary file for struct boot_params
/sys/kernel/boot_params/version : boot protocol version

Your patch uses kobject_create_and_register() which was added in Greg's driver tree as of 2.6.24-rc4-mm1.

However for some reason kobject_create_and_register() has magically vanished from Greg's current driver tree so I cannot carry this patch, sorry.

Seems kobject_create_and_register would be replaced by kobject_create_and_add, and the uevent handling would be separated from original create_and_register onefunction.

Quoted 7 lines

wait for greg's patches or modify to use:

kobject_init
kobject_add
kobject_uevent

BTW, I suspect whether the uevent is really needed for boot_params object.

Oh, if you want, I'd be glad to add this to my tree as I am messing with the kobject API a lot and I don't mind keeping it with the other kobject patches so that it is known to work properly :)

Just forward it on to me if you want me to fix it up and add it to my tree.

thanks,

greg k-h