3 GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
5 COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
6 COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
7 COMMON_LDFLAGS = -m32 -nostdlib
9 # Used by various components. These rules need to precede them.
10 script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
13 pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
17 boot_img_SOURCES = boot/i386/pc/boot.S
18 boot_img_ASFLAGS = $(COMMON_ASFLAGS)
19 boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)7C00
20 boot_img_FORMAT = binary
23 pxeboot_img_SOURCES = boot/i386/pc/pxeboot.S
24 pxeboot_img_ASFLAGS = $(COMMON_ASFLAGS)
25 pxeboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)7C00
26 pxeboot_img_FORMAT = binary
29 diskboot_img_SOURCES = boot/i386/pc/diskboot.S
30 diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)
31 diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)8000
32 diskboot_img_FORMAT = binary
35 lnxboot_img_SOURCES = boot/i386/pc/lnxboot.S
36 lnxboot_img_ASFLAGS = $(COMMON_ASFLAGS)
37 lnxboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)6000
38 lnxboot_img_FORMAT = binary
41 cdboot_img_SOURCES = boot/i386/pc/cdboot.S
42 cdboot_img_ASFLAGS = $(COMMON_ASFLAGS)
43 cdboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)7C00
44 cdboot_img_FORMAT = binary
47 kernel_img_SOURCES = kern/i386/pc/startup.S \
49 kern/main.c kern/device.c \
50 kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
51 kern/misc.c kern/mm.c kern/reader.c kern/term.c \
52 kern/rescue_parser.c kern/rescue_reader.c \
53 kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
54 kern/$(target_cpu)/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.c \
55 kern/parser.c kern/partition.c \
56 kern/i386/tsc.c kern/i386/pit.c \
57 kern/generic/rtc_get_time_ms.c \
58 kern/generic/millisleep.c \
60 term/i386/pc/console.c term/i386/vga_common.c \
62 kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
63 env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
64 partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
65 machine/biosdisk.h machine/boot.h machine/console.h machine/init.h \
66 machine/memory.h machine/loader.h machine/vga.h machine/vbe.h \
67 machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h
68 kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
69 kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
70 kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
71 kernel_img_FORMAT = binary
73 MOSTLYCLEANFILES += symlist.c kernel_syms.lst
74 DEFSYMFILES += kernel_syms.lst
76 symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
77 /bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
79 kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
80 /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
83 bin_UTILITIES = grub-mkimage
84 sbin_UTILITIES = grub-setup grub-mkdevicemap
85 ifeq ($(enable_grub_emu), yes)
86 sbin_UTILITIES += grub-emu
90 grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
91 util/resolve.c lib/LzmaEnc.c lib/LzFind.c
92 grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
93 util/i386/pc/grub-mkimage.c_DEPENDENCIES = Makefile
96 util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
97 grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
98 util/misc.c util/getroot.c kern/device.c kern/disk.c \
99 kern/err.c kern/misc.c kern/parser.c kern/partition.c \
100 kern/file.c kern/fs.c kern/env.c fs/fshelp.c \
102 fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
103 fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
104 fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
105 fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
107 partmap/msdos.c partmap/gpt.c \
109 disk/raid.c disk/mdraid_linux.c disk/lvm.c \
110 util/raid.c util/lvm.c \
113 # For grub-mkdevicemap.
114 grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
115 util/devicemap.c util/misc.c
118 util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
119 grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
120 commands/configfile.c commands/echo.c commands/help.c \
121 commands/handler.c commands/ls.c commands/test.c \
122 commands/search.c commands/blocklist.c commands/hexdump.c \
123 lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c \
124 commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
125 commands/i386/cpuid.c \
126 disk/host.c disk/loopback.c disk/scsi.c \
130 kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
131 kern/err.c kern/list.c kern/handler.c \
132 kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
133 kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
134 kern/partition.c kern/reader.c kern/term.c \
135 kern/rescue_reader.c kern/rescue_parser.c \
136 lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
137 normal/handler.c normal/autofs.c \
138 normal/completion.c normal/main.c normal/color.c \
139 normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
141 script/sh/main.c script/sh/execute.c script/sh/function.c \
142 script/sh/lexer.c script/sh/script.c grub_script.tab.c \
143 partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
144 partmap/acorn.c partmap/gpt.c \
146 fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
147 fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
148 fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
149 fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/befs.c fs/tar.c \
151 util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
152 util/hostdisk.c util/getroot.c \
154 disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
155 disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
156 commands/parttool.c parttool/msdospart.c \
159 grub_emu_LDFLAGS = $(LIBCURSES)
161 ifeq ($(enable_grub_emu_usb), yes)
162 grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c \
164 grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB)
168 sbin_SCRIPTS = grub-install
169 bin_SCRIPTS = grub-mkrescue
172 grub_install_SOURCES = util/i386/pc/grub-install.in
175 grub_mkrescue_SOURCES = util/i386/pc/grub-mkrescue.in
177 pkglib_MODULES = biosdisk.mod chain.mod \
178 multiboot.mod reboot.mod halt.mod \
179 vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
180 ata.mod vga.mod memdisk.mod pci.mod lspci.mod \
181 aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
182 datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
183 usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
184 efiemu.mod mmap.mod acpi.mod drivemap.mod
187 pkglib_MODULES += boot.mod
188 boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
189 boot_mod_CFLAGS = $(COMMON_CFLAGS)
190 boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
193 drivemap_mod_SOURCES = commands/i386/pc/drivemap.c \
194 commands/i386/pc/drivemap_int13h.S
195 drivemap_mod_ASFLAGS = $(COMMON_ASFLAGS)
196 drivemap_mod_CFLAGS = $(COMMON_CFLAGS)
197 drivemap_mod_LDFLAGS = $(COMMON_LDFLAGS)
200 efiemu_mod_SOURCES = efiemu/main.c efiemu/i386/loadcore32.c \
201 efiemu/i386/loadcore64.c efiemu/i386/pc/cfgtables.c \
202 efiemu/mm.c efiemu/loadcore_common.c efiemu/symbols.c \
203 efiemu/loadcore32.c efiemu/loadcore64.c \
204 efiemu/prepare32.c efiemu/prepare64.c efiemu/pnvram.c \
205 efiemu/i386/coredetect.c
206 efiemu_mod_CFLAGS = $(COMMON_CFLAGS)
207 efiemu_mod_LDFLAGS = $(COMMON_LDFLAGS)
210 acpi_mod_SOURCES = commands/acpi.c commands/i386/pc/acpi.c
211 acpi_mod_CFLAGS = $(COMMON_CFLAGS)
212 acpi_mod_LDFLAGS = $(COMMON_LDFLAGS)
215 mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c \
216 mmap/i386/pc/mmap.c mmap/i386/pc/mmap_helper.S
217 mmap_mod_CFLAGS = $(COMMON_CFLAGS)
218 mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
219 mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
222 biosdisk_mod_SOURCES = disk/i386/pc/biosdisk.c
223 biosdisk_mod_CFLAGS = $(COMMON_CFLAGS)
224 biosdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
227 chain_mod_SOURCES = loader/i386/pc/chainloader.c
228 chain_mod_CFLAGS = $(COMMON_CFLAGS)
229 chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
231 pkglib_MODULES += linux16.mod
232 linux16_mod_SOURCES = loader/i386/pc/linux.c
233 linux16_mod_CFLAGS = $(COMMON_CFLAGS)
234 linux16_mod_LDFLAGS = $(COMMON_LDFLAGS)
236 pkglib_MODULES += linux.mod
237 linux_mod_SOURCES = loader/i386/linux.c
238 linux_mod_CFLAGS = $(COMMON_CFLAGS)
239 linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
241 pkglib_MODULES += xnu.mod
242 xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c\
243 loader/macho.c loader/xnu.c loader/i386/xnu_helper.S
244 xnu_mod_CFLAGS = $(COMMON_CFLAGS)
245 xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
246 xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
249 reboot_mod_SOURCES = commands/reboot.c
250 reboot_mod_CFLAGS = $(COMMON_CFLAGS)
251 reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
254 halt_mod_SOURCES = commands/i386/pc/halt.c
255 halt_mod_CFLAGS = $(COMMON_CFLAGS)
256 halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
259 serial_mod_SOURCES = term/i386/pc/serial.c
260 serial_mod_CFLAGS = $(COMMON_CFLAGS)
261 serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
264 multiboot_mod_SOURCES = loader/i386/multiboot.c \
265 loader/i386/multiboot_helper.S \
266 loader/i386/pc/multiboot2.c \
267 loader/multiboot2.c \
268 loader/multiboot_loader.c
269 multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
270 multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
271 multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
274 vbe_mod_SOURCES = video/i386/pc/vbe.c
275 vbe_mod_CFLAGS = $(COMMON_CFLAGS)
276 vbe_mod_LDFLAGS = $(COMMON_LDFLAGS)
279 vbeinfo_mod_SOURCES = commands/i386/pc/vbeinfo.c
280 vbeinfo_mod_CFLAGS = $(COMMON_CFLAGS)
281 vbeinfo_mod_LDFLAGS = $(COMMON_LDFLAGS)
284 vbetest_mod_SOURCES = commands/i386/pc/vbetest.c
285 vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
286 vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS)
289 play_mod_SOURCES = commands/i386/pc/play.c
290 play_mod_CFLAGS = $(COMMON_CFLAGS)
291 play_mod_LDFLAGS = $(COMMON_LDFLAGS)
294 ata_mod_SOURCES = disk/ata.c
295 ata_mod_CFLAGS = $(COMMON_CFLAGS)
296 ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
299 vga_mod_SOURCES = term/i386/pc/vga.c
300 vga_mod_CFLAGS = $(COMMON_CFLAGS)
301 vga_mod_LDFLAGS = $(COMMON_LDFLAGS)
304 memdisk_mod_SOURCES = disk/memdisk.c
305 memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
306 memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
309 pci_mod_SOURCES = bus/pci.c
310 pci_mod_CFLAGS = $(COMMON_CFLAGS)
311 pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
314 lspci_mod_SOURCES = commands/lspci.c
315 lspci_mod_CFLAGS = $(COMMON_CFLAGS)
316 lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
319 aout_mod_SOURCES = loader/aout.c
320 aout_mod_CFLAGS = $(COMMON_CFLAGS)
321 aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
324 bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c loader/i386/bsd_helper.S loader/i386/bsd_trampoline.S
325 bsd_mod_CFLAGS = $(COMMON_CFLAGS)
326 bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
327 bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
330 usb_mod_SOURCES = bus/usb/usb.c bus/usb/usbtrans.c bus/usb/usbhub.c
331 usb_mod_CFLAGS = $(COMMON_CFLAGS)
332 usb_mod_LDFLAGS = $(COMMON_LDFLAGS)
335 usbtest_mod_SOURCES = commands/usbtest.c
336 usbtest_mod_CFLAGS = $(COMMON_CFLAGS)
337 usbtest_mod_LDFLAGS = $(COMMON_LDFLAGS)
340 uhci_mod_SOURCES = bus/usb/uhci.c
341 uhci_mod_CFLAGS = $(COMMON_CFLAGS)
342 uhci_mod_LDFLAGS = $(COMMON_LDFLAGS)
345 ohci_mod_SOURCES = bus/usb/ohci.c
346 ohci_mod_CFLAGS = $(COMMON_CFLAGS)
347 ohci_mod_LDFLAGS = $(COMMON_LDFLAGS)
350 usbms_mod_SOURCES = disk/usbms.c
351 usbms_mod_CFLAGS = $(COMMON_CFLAGS)
352 usbms_mod_LDFLAGS = $(COMMON_LDFLAGS)
354 # For usb_keyboard.mod
355 usb_keyboard_mod_SOURCES = term/usb_keyboard.c
356 usb_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
357 usb_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
360 pxe_mod_SOURCES = fs/i386/pc/pxe.c
361 pxe_mod_CFLAGS = $(COMMON_CFLAGS)
362 pxe_mod_LDFLAGS = $(COMMON_LDFLAGS)
365 pxecmd_mod_SOURCES = commands/i386/pc/pxecmd.c
366 pxecmd_mod_CFLAGS = $(COMMON_CFLAGS)
367 pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
370 datetime_mod_SOURCES = lib/i386/datetime.c
371 datetime_mod_CFLAGS = $(COMMON_CFLAGS)
372 datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
375 date_mod_SOURCES = commands/date.c
376 date_mod_CFLAGS = $(COMMON_CFLAGS)
377 date_mod_LDFLAGS = $(COMMON_LDFLAGS)
380 datehook_mod_SOURCES = hook/datehook.c
381 datehook_mod_CFLAGS = $(COMMON_CFLAGS)
382 datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
385 lsmmap_mod_SOURCES = commands/lsmmap.c
386 lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
387 lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
390 ata_pthru_mod_SOURCES = disk/ata_pthru.c
391 ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
392 ata_pthru_mod_LDFLAGS = $(COMMON_LDFLAGS)
395 hdparm_mod_SOURCES = commands/hdparm.c lib/hexdump.c
396 hdparm_mod_CFLAGS = $(COMMON_CFLAGS)
397 hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
399 ifeq ($(enable_efiemu), yes)
401 efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
403 ifeq ($(TARGET_APPLE_CC), 1)
405 $(TARGET_CC) -c -m32 -DELF32 -DAPPLE_CC -o $@.bin -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
406 $(OBJCONV) -felf32 -nu -nd $@.bin $@
409 $(TARGET_CC) -c -m32 -DELF32 -o $@ -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
410 if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
413 efiemu64_c.o: efiemu/runtime/efiemu.c
414 ifeq ($(TARGET_APPLE_CC), 1)
415 $(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
417 $(TARGET_CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
420 efiemu64_s.o: efiemu/runtime/efiemu.S
422 ifeq ($(TARGET_APPLE_CC), 1)
423 $(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
425 $(TARGET_CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
428 efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELF)
430 ifeq ($(TARGET_APPLE_CC), 1)
432 $(TARGET_CC) -m64 -o $@.bin -Wl,-r $^ -nostdlib
433 $(OBJCONV) -felf64 -nu -nd $@.bin $@
436 $(TARGET_CC) -m64 -o $@ -Wl,-r $^ -nostdlib
437 if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
440 CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
441 pkglib_DATA += efiemu32.o efiemu64.o
445 include $(srcdir)/conf/i386.mk
446 include $(srcdir)/conf/common.mk