All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>,
	SYSLINUX@zytor.com
Subject: [PATCH] /proc/sys/kernel/bootloader_type
Date: Wed, 29 Dec 2004 16:39:22 -0800	[thread overview]
Message-ID: <41D34E3A.3090708@zytor.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]

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

Tested on i386 and x86-64; as far as I know those are the only 
architectures which use zImage/bzImage format.

	-hpa


Signed-Off-By: H. Peter Anvin <hpa@zytor.com>


[-- Attachment #2: bootloader_type.patch --]
[-- Type: text/x-patch, Size: 4905 bytes --]

Index: linux-2.5/arch/i386/Makefile
===================================================================
RCS file: /home/hpa/kernel/bkcvs/linux-2.5/arch/i386/Makefile,v
retrieving revision 1.73
diff -u -r1.73 Makefile
--- linux-2.5/arch/i386/Makefile	24 Dec 2004 21:09:54 -0000	1.73
+++ linux-2.5/arch/i386/Makefile	28 Dec 2004 04:56:17 -0000
@@ -20,6 +20,10 @@
 LDFLAGS_vmlinux :=
 CHECKFLAGS	+= -D__i386__
 
+# This allows compilation with an x86-64 compiler
+CC_M32		:= $(call cc-option,-m32)
+CC 		+= $(CC_M32)
+
 CFLAGS += -pipe -msoft-float
 
 # prevent gcc from keeping the stack 16 byte aligned
Index: linux-2.5/arch/i386/kernel/setup.c
===================================================================
RCS file: /home/hpa/kernel/bkcvs/linux-2.5/arch/i386/kernel/setup.c,v
retrieving revision 1.128
diff -u -r1.128 setup.c
--- linux-2.5/arch/i386/kernel/setup.c	27 Dec 2004 18:21:04 -0000	1.128
+++ linux-2.5/arch/i386/kernel/setup.c	29 Dec 2004 22:10:30 -0000
@@ -97,6 +97,9 @@
 /* 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 @@
 		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;
Index: linux-2.5/arch/x86_64/kernel/setup.c
===================================================================
RCS file: /home/hpa/kernel/bkcvs/linux-2.5/arch/x86_64/kernel/setup.c,v
retrieving revision 1.59
diff -u -r1.59 setup.c
--- linux-2.5/arch/x86_64/kernel/setup.c	2 Nov 2004 23:06:28 -0000	1.59
+++ linux-2.5/arch/x86_64/kernel/setup.c	29 Dec 2004 23:46:41 -0000
@@ -78,6 +78,9 @@
 /* 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 @@
 	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;
Index: linux-2.5/include/asm-i386/processor.h
===================================================================
RCS file: /home/hpa/kernel/bkcvs/linux-2.5/include/asm-i386/processor.h,v
retrieving revision 1.78
diff -u -r1.78 processor.h
--- linux-2.5/include/asm-i386/processor.h	27 Dec 2004 18:21:04 -0000	1.78
+++ linux-2.5/include/asm-i386/processor.h	29 Dec 2004 23:45:34 -0000
@@ -283,6 +283,9 @@
 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).
  */
Index: linux-2.5/include/asm-x86_64/processor.h
===================================================================
RCS file: /home/hpa/kernel/bkcvs/linux-2.5/include/asm-x86_64/processor.h,v
retrieving revision 1.48
diff -u -r1.48 processor.h
--- linux-2.5/include/asm-x86_64/processor.h	27 Dec 2004 18:21:04 -0000	1.48
+++ linux-2.5/include/asm-x86_64/processor.h	29 Dec 2004 23:45:31 -0000
@@ -456,5 +456,7 @@
 #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 */
Index: linux-2.5/include/linux/sysctl.h
===================================================================
RCS file: /home/hpa/kernel/bkcvs/linux-2.5/include/linux/sysctl.h,v
retrieving revision 1.82
diff -u -r1.82 sysctl.h
--- linux-2.5/include/linux/sysctl.h	20 Oct 2004 15:36:36 -0000	1.82
+++ linux-2.5/include/linux/sysctl.h	29 Dec 2004 22:11:14 -0000
@@ -134,6 +134,7 @@
 	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 */
 };
 
 
Index: linux-2.5/kernel/sysctl.c
===================================================================
RCS file: /home/hpa/kernel/bkcvs/linux-2.5/kernel/sysctl.c,v
retrieving revision 1.96
diff -u -r1.96 sysctl.c
--- linux-2.5/kernel/sysctl.c	2 Nov 2004 23:04:07 -0000	1.96
+++ linux-2.5/kernel/sysctl.c	29 Dec 2004 22:10:41 -0000
@@ -624,6 +624,16 @@
 		.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 }
 };
 

             reply	other threads:[~2004-12-30  0:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-30  0:39 H. Peter Anvin [this message]
2004-12-31  9:34 ` [PATCH] /proc/sys/kernel/bootloader_type Andrew Morton
2004-12-31 10:12   ` Arjan van de Ven
2004-12-31 14:24     ` Coywolf Qi Hunt
2004-12-31 14:36       ` Arjan van de Ven
2004-12-31 20:10   ` H. Peter Anvin
2005-01-01 20:22 ` Kay Sievers
2005-01-02  8:56   ` Lethalman
  -- strict thread matches above, loose matches on Subject: below --
2005-01-01  9:39 Lethalman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41D34E3A.3090708@zytor.com \
    --to=hpa@zytor.com \
    --cc=SYSLINUX@zytor.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.