[coreboot-gerrit] New patch to review for filo: 25eadf5 Create bzImage formatted FILO image
Patrick Georgi (patrick@georgi-clan.de)
gerrit at coreboot.org
Fri Jun 13 13:53:02 CEST 2014
Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5989
-gerrit
commit 25eadf5befebb35afdc836cdd17c546e95fea659
Author: Patrick Georgi <patrick.georgi at secunet.com>
Date: Fri Jun 22 14:48:01 2012 +0200
Create bzImage formatted FILO image
This can be booted from FILO (ideally by all our versions).
Tested on FILO HEAD (eg. booted by itself).
Change-Id: I3fa8fe00a8816987c7043c4b64c0792dd90b1691
Signed-off-by: Patrick Georgi <patrick.georgi at secunet.com>
---
Makefile | 6 ++++
i386/linux_head.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 95 insertions(+)
diff --git a/Makefile b/Makefile
index 46010b3..a860236 100644
--- a/Makefile
+++ b/Makefile
@@ -131,6 +131,12 @@ $(obj)/filo: $(OBJS) $(LIBPAYLOAD)
printf " LD $(subst $(shell pwd)/,,$(@))\n"
$(LD) -N -T $(ARCHDIR-y)/ldscript $(OBJS) --start-group $(LIBS) --end-group -o $@
+$(obj)/filo.bzImage: $(TARGET) $(obj)/i386/linux_head.o
+ $(OBJCOPY) -O binary $(obj)/i386/linux_head.o $@.tmp1
+ $(OBJCOPY) -O binary $< $@.tmp2
+ cat $@.tmp1 $@.tmp2 > $@.tmp
+ mv $@.tmp $@
+
$(TARGET): $(obj)/filo $(obj)/filo.map
printf " STRIP $(subst $(shell pwd)/,,$(@))\n"
$(STRIP) -s $< -o $@
diff --git a/i386/linux_head.c b/i386/linux_head.c
new file mode 100644
index 0000000..f089502
--- /dev/null
+++ b/i386/linux_head.c
@@ -0,0 +1,89 @@
+/*
+ * This file is part of FILO.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * Linux/i386 loader
+ * Supports bzImage, zImage and Image format.
+ *
+ * Based on work by Steve Gehlbach.
+ * Portions are taken from mkelfImage.
+ *
+ * 2003-09 by SONE Takeshi
+ */
+
+#include <libpayload.h>
+#include <libpayload-config.h>
+
+/* The header of Linux/i386 kernel */
+struct linux_header {
+ u8 reserved1[0x1f1]; /* 0x000 */
+ u8 setup_sects; /* 0x1f1 */
+ u16 root_flags; /* 0x1f2 */
+ u32 syssize; /* 0x1f4 (2.04+) */
+ u8 reserved2[2]; /* 0x1f8 */
+ u16 vid_mode; /* 0x1fa */
+ u16 root_dev; /* 0x1fc */
+ u16 boot_sector_magic; /* 0x1fe */
+ /* 2.00+ */
+ u8 reserved3[2]; /* 0x200 */
+ u8 header_magic[4]; /* 0x202 */
+ u16 protocol_version; /* 0x206 */
+ u32 realmode_swtch; /* 0x208 */
+ u16 start_sys; /* 0x20c */
+ u16 kver_addr; /* 0x20e */
+ u8 type_of_loader; /* 0x210 */
+ u8 loadflags; /* 0x211 */
+ u16 setup_move_size; /* 0x212 */
+ u32 code32_start; /* 0x214 */
+ u32 ramdisk_image; /* 0x218 */
+ u32 ramdisk_size; /* 0x21c */
+ u8 reserved4[4]; /* 0x220 */
+ /* 2.01+ */
+ u16 heap_end_ptr; /* 0x224 */
+ u8 reserved5[2]; /* 0x226 */
+ /* 2.02+ */
+ u32 cmd_line_ptr; /* 0x228 */
+ /* 2.03+ */
+ u32 initrd_addr_max; /* 0x22c */
+ /* 2.05+ */
+ u32 kernel_alignment; /* 0x230 */
+ u8 relocatable_kernel; /* 0x234 */
+ u8 min_alignment; /* 0x235 (2.10+) */
+ u8 reserved6[2]; /* 0x236 */
+ /* 2.06+ */
+ u32 cmdline_size; /* 0x238 */
+ /* 2.07+ */
+ u32 hardware_subarch; /* 0x23c */
+ u64 hardware_subarch_data;/* 0x240 */
+ /* 2.08+ */
+ u32 payload_offset; /* 0x248 */
+ u32 payload_length; /* 0x24c */
+ /* 2.09+ */
+ u64 setup_data; /* 0x250 */
+ /* 2.10+ */
+ u64 pref_address; /* 0x258 */
+ u32 init_size; /* 0x260 */
+ u8 filler[0x1000-0x264];
+} __attribute__ ((packed));
+
+struct linux_header data = {
+ .setup_sects = 7,
+ .boot_sector_magic = 0xaa55,
+ .header_magic = { 'H', 'd', 'r', 'S' },
+ .protocol_version = 0x200,
+ .loadflags = 1,
+};
More information about the coreboot-gerrit
mailing list