Skip to contentSkip to conversation

Gujin linux.kgz boot format

PATCH In review Etienne Lorrain 1 participant 1 message Oct 6, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 Gujin linux.kgz boot format

Attached second patch adds the two file realmode.c/realmode.h,
and how to compile them and insert then at the end of the ELF file. The resulting linux.kgz can be used with Gujin but the "root=" parameter has to be given manually.

Etienne.

arch/i386/kernel/Makefile +1 -1
diff -uprN -X linux-2.6.14-rc3/Documentation/dontdiff -x '*.orig' -x '*.cmd' -x '.tmp*' -x '*.o' -x '*.ko' -x '*.a' -x '*.so' -x '.config*' -x asm-offsets.s -x asm_offsets.h -x vmlinux.lds -x vsyscall.lds -x '*.mod.c' -x Module.symvers -x consolemap_deftbl.c -x defkeymap.c -x classlist.h -x devlist.h -x asm -x md -x scsi -x logo -x config -x .version -x zconf.tab.h -x elfconfig.h -x System.map -x zconf.tab.c -x lex.zconf.c -x compile.h -x config_data.h -x version.h -x crc32table.h -x autoconf.h -x gen-devlist -x initramfs_list linux-2.6.14-rc3-1/arch/i386/kernel/Makefile linux-2.6.14-rc3-2/arch/i386/kernel/Makefile
@@ -7,7 +7,7 @@ extra-y := head.o init_task.o vmlinux.ld
 obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
 		ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
 		pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \
-		doublefault.o quirks.o i8237.o
+		doublefault.o quirks.o i8237.o realmode.o
 
 obj-y				+= cpu/
 obj-y				+= timers/
arch/i386/kernel/realmode.c +1411 -0

1,411 lines not on this page · raw message

arch/i386/kernel/setup.c +12 -0
diff -uprN -X linux-2.6.14-rc3/Documentation/dontdiff -x '*.orig' -x '*.cmd' -x '.tmp*' -x '*.o' -x '*.ko' -x '*.a' -x '*.so' -x '.config*' -x asm-offsets.s -x asm_offsets.h -x vmlinux.lds -x vsyscall.lds -x '*.mod.c' -x Module.symvers -x consolemap_deftbl.c -x defkeymap.c -x classlist.h -x devlist.h -x asm -x md -x scsi -x logo -x config -x .version -x zconf.tab.h -x elfconfig.h -x System.map -x zconf.tab.c -x lex.zconf.c -x compile.h -x config_data.h -x version.h -x crc32table.h -x autoconf.h -x gen-devlist -x initramfs_list linux-2.6.14-rc3-1/arch/i386/kernel/setup.c linux-2.6.14-rc3-2/arch/i386/kernel/setup.c
@@ -706,6 +706,18 @@ static void __init parse_cmdline_early (
 	/* Save unparsed command line copy for /proc/cmdline */
 	saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
 
+	/*
+	 * If the command line begin with '/', it is the filename of the
+	 * kernel file - like a shell command line. That can be used to
+	 * deduce where root was located when the kernel was compiled,
+	 * inside a directory of root named /boot, inside a small partition
+	 * mounted on a directory of root named /boot or in the root
+	 * directory itself.
+	 */
+	if (*from == '/')
+		while (*from != ' ' && *from != '\t' && *from != '\n' && *from != '\0')
+			from++;
+
 	for (;;) {
 		if (c != ' ')
 			goto next_char;
arch/i386/kernel/vmlinux.lds.S +30 -0
diff -uprN -X linux-2.6.14-rc3/Documentation/dontdiff -x '*.orig' -x '*.cmd' -x '.tmp*' -x '*.o' -x '*.ko' -x '*.a' -x '*.so' -x '.config*' -x asm-offsets.s -x asm_offsets.h -x vmlinux.lds -x vsyscall.lds -x '*.mod.c' -x Module.symvers -x consolemap_deftbl.c -x defkeymap.c -x classlist.h -x devlist.h -x asm -x md -x scsi -x logo -x config -x .version -x zconf.tab.h -x elfconfig.h -x System.map -x zconf.tab.c -x lex.zconf.c -x compile.h -x config_data.h -x version.h -x crc32table.h -x autoconf.h -x gen-devlist -x initramfs_list linux-2.6.14-rc3-1/arch/i386/kernel/vmlinux.lds.S linux-2.6.14-rc3-2/arch/i386/kernel/vmlinux.lds.S
@@ -11,9 +11,39 @@
 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
 OUTPUT_ARCH(i386)
 ENTRY(phys_startup_32)
+EXTERN(__ERROR)   /* Force a link error if function __ERROR() is ever called */
+NOCROSSREFS(.realmode .text)
+NOCROSSREFS(.realmode .data)
+NOCROSSREFS(.realmode .rodata)
 jiffies = jiffies_64;
 SECTIONS
 {
+  /* realmode BIOS (initialisation only) boot code/data area.
+   * Here, segment .code16 is relocatable but .data16 is not.
+   * To see the assembler of compiled file realmode.c:
+   *   objdump -D -m i8086 arch/i386/kernel/realmode.o
+   *   objdump -d --section=.realmode -m i8086 vmlinux
+   */
+  .realmode 0 : AT (_end - LOAD_OFFSET) {
+	*(.init.text16)
+	. = ALIGN(16);
+	_sdata16 = .;
+	*(.rodata16* .data16 .bss16)
+	. = ALIGN(16);
+	_edata16 = .; /* maximum 0x1000 i.e. 4 Kb limit */
+	*(.text16)
+	. = ALIGN(16);
+	_end16 = .;
+	/* This may be used one day - keep a 16 bytes block at end of file: */
+	LONG(0)
+	LONG(SIZEOF (.realmode))
+	LONG(ADDR (.realmode))
+	BYTE(0x42) /* 'B' */
+	BYTE(0x49) /* 'I' */
+	BYTE(0x4F) /* 'O' */
+	BYTE(0x53) /* 'S' */
+	} = 0x9090
+
   . = __KERNEL_START;
   phys_startup_32 = startup_32 - LOAD_OFFSET;
   /* read-only */
include/asm-i386/realmode.h +521 -0

521 lines not on this page · raw message

Makefile +65 -3

102 lines not on this page · raw message