Commit 9b43aebe authored by H. Peter Anvin's avatar H. Peter Anvin Committed by Linus Torvalds

[PATCH] /proc/sys/kernel/bootloader_type

This patch exports to userspace the boot loader ID which has been exported
by (b)zImage boot loaders since boot protocol version 2.

It is needed so that update tools that update kernels from vendors know which
bootloader file they need to update; eg right now those tools do all kinds of
hairy heuristics to find out if it's grub or lilo or ..  that installed the
kernel.  Those heuristics are fragile in the presence of more than one
bootloader (which isn't that uncommon in OS upgrade situations).

Tested on i386 and x86-64; as far as I know those are the only
architectures which use zImage/bzImage format.
Signed-Off-By: default avatarH. Peter Anvin <hpa@zytor.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e090339f
......@@ -97,6 +97,9 @@ unsigned int mca_pentium_flag;
/* For PCI or other memory-mapped resources */
unsigned long pci_mem_start = 0x10000000;
/* Boot loader ID as an integer, for the benefit of proc_dointvec */
int bootloader_type;
/* user-defined highmem size */
static unsigned int highmem_pages = -1;
......@@ -1338,6 +1341,7 @@ void __init setup_arch(char **cmdline_p)
BIOS_revision = SYS_DESC_TABLE.table[2];
}
aux_device_present = AUX_DEVICE_INFO;
bootloader_type = LOADER_TYPE;
#ifdef CONFIG_BLK_DEV_RAM
rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK;
......
......@@ -78,6 +78,9 @@ int __initdata acpi_force = 0;
/* For PCI or other memory-mapped resources */
unsigned long pci_mem_start = 0x10000000;
/* Boot loader ID as an integer, for the benefit of proc_dointvec */
int bootloader_type;
unsigned long saved_video_mode;
#ifdef CONFIG_SWIOTLB
......@@ -452,6 +455,7 @@ void __init setup_arch(char **cmdline_p)
edid_info = EDID_INFO;
aux_device_present = AUX_DEVICE_INFO;
saved_video_mode = SAVED_VIDEO_MODE;
bootloader_type = LOADER_TYPE;
#ifdef CONFIG_BLK_DEV_RAM
rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK;
......
......@@ -285,6 +285,9 @@ extern unsigned int machine_submodel_id;
extern unsigned int BIOS_revision;
extern unsigned int mca_pentium_flag;
/* Boot loader type from the setup header */
extern int bootloader_type;
/*
* User space process size: 3GB (default).
*/
......
......@@ -456,5 +456,7 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)
#define cache_line_size() (boot_cpu_data.x86_cache_alignment)
extern unsigned long boot_option_idle_override;
/* Boot loader type from the setup header */
extern int bootloader_type;
#endif /* __ASM_X86_64_PROCESSOR_H */
......@@ -134,6 +134,7 @@ enum
KERN_SPARC_SCONS_PWROFF=64, /* int: serial console power-off halt */
KERN_HZ_TIMER=65, /* int: hz timer on or off */
KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */
KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */
};
......
......@@ -623,6 +623,16 @@ static ctl_table kern_table[] = {
.mode = 0644,
.proc_handler = &proc_unknown_nmi_panic,
},
#endif
#if defined(CONFIG_X86)
{
.ctl_name = KERN_BOOTLOADER_TYPE,
.procname = "bootloader_type",
.data = &bootloader_type,
.maxlen = sizeof (int),
.mode = 0444,
.proc_handler = &proc_dointvec,
},
#endif
{ .ctl_name = 0 }
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment