x86: add grub2 iso support
[openwrt/openwrt.git] / package / grub / patches / 030-add-stage2-ldscripts.patch
1 From 8858927ddc6797489cad322fc2d2134aeae543cd Mon Sep 17 00:00:00 2001
2 From: Arnaud Lacombe <lacombar@gmail.com>
3 Date: Sun, 11 Dec 2011 16:44:02 -0500
4 Subject: [PATCH] add-stage2-ldscripts
5
6 ---
7 stage2/Makefile.am | 2 +-
8 stage2/Makefile.in | 2 +-
9 stage2/stage2.ldscripts | 30 ++++++++++++++++++++++++++++++
10 3 files changed, 32 insertions(+), 2 deletions(-)
11 create mode 100644 stage2/stage2.ldscripts
12
13 diff --git a/stage2/Makefile.am b/stage2/Makefile.am
14 index f8e6d42..ea28a4d 100644
15 --- a/stage2/Makefile.am
16 +++ b/stage2/Makefile.am
17 @@ -55,7 +55,7 @@ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
18 endif
19 MOSTLYCLEANFILES = $(noinst_PROGRAMS)
20
21 -PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
22 +PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Tstage2.ldscripts
23 START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
24 NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
25 PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
26 diff --git a/stage2/Makefile.in b/stage2/Makefile.in
27 index d0062bd..7bee2d5 100644
28 --- a/stage2/Makefile.in
29 +++ b/stage2/Makefile.in
30 @@ -468,7 +468,7 @@ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
31 @DISKLESS_SUPPORT_FALSE@noinst_DATA = pre_stage2 start start_eltorito
32 @DISKLESS_SUPPORT_TRUE@noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
33 MOSTLYCLEANFILES = $(noinst_PROGRAMS)
34 -PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
35 +PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Tstage2.ldscripts
36 START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
37 NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
38 PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
39 diff --git a/stage2/stage2.ldscripts b/stage2/stage2.ldscripts
40 new file mode 100644
41 index 0000000..2c8b8e1
42 --- /dev/null
43 +++ b/stage2/stage2.ldscripts
44 @@ -0,0 +1,30 @@
45 +/* Script for -N: mix text and data on same page; don't align data */
46 +OUTPUT_FORMAT("elf32-i386", "elf32-i386",
47 + "elf32-i386")
48 +OUTPUT_ARCH(i386)
49 +ENTRY(_start)
50 +SECTIONS
51 +{
52 + . = 0x8200;
53 + .text :
54 + {
55 + _start = .;
56 + *(.text .text.* )
57 + }
58 + .rodata : { *(.rodata .rodata.* ) }
59 + /* Adjust the address for the data segment. We want to adjust up to
60 + the same address within the page on the next page up. */
61 + . = .;
62 + .data : { *(.data .data.* ) }
63 + __bss_start = .;
64 + .bss :
65 + {
66 + *(.bss .bss.* )
67 + *(COMMON)
68 + . = ALIGN(. != 0 ? 32 / 8 : 1);
69 + }
70 + . = ALIGN(32 / 8);
71 + . = ALIGN(32 / 8);
72 + _end = .; PROVIDE (end = .);
73 + .comment 0 : { *(.comment) }
74 +}
75 --
76 1.7.6.153.g78432
77