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/afs_be.c \
106 fs/befs.c fs/befs_be.c fs/tar.c \
108 partmap/msdos.c partmap/gpt.c \
110 disk/raid.c disk/mdraid_linux.c disk/lvm.c \
111 util/raid.c util/lvm.c \
114 # For grub-mkdevicemap.
115 grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
116 util/devicemap.c util/misc.c
119 util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
120 grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
121 commands/configfile.c commands/echo.c commands/help.c \
122 commands/handler.c commands/ls.c commands/test.c \
123 commands/search.c commands/blocklist.c commands/hexdump.c \
124 lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c \
125 lib/envblk.c commands/loadenv.c \
126 commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
127 commands/i386/cpuid.c \
128 commands/password.c commands/keystatus.c \
129 disk/host.c disk/loopback.c disk/scsi.c \
133 kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
134 kern/err.c kern/list.c kern/handler.c \
135 kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
136 kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
137 kern/partition.c kern/reader.c kern/term.c \
138 kern/rescue_reader.c kern/rescue_parser.c \
139 lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
140 normal/handler.c normal/auth.c normal/autofs.c \
141 normal/completion.c normal/main.c normal/color.c \
142 normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
144 script/sh/main.c script/sh/execute.c script/sh/function.c \
145 script/sh/lexer.c script/sh/script.c grub_script.tab.c \
146 partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
147 partmap/acorn.c partmap/gpt.c \
149 fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
150 fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
151 fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
152 fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
153 fs/befs.c fs/befs_be.c fs/tar.c \
155 util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
156 util/hostdisk.c util/getroot.c \
158 disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
159 disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
160 commands/parttool.c parttool/msdospart.c \
163 grub_emu_LDFLAGS = $(LIBCURSES)
165 ifeq ($(enable_grub_emu_usb), yes)
166 grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c \
168 grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB)
172 sbin_SCRIPTS = grub-install
173 bin_SCRIPTS = grub-mkrescue
176 grub_install_SOURCES = util/i386/pc/grub-install.in
179 grub_mkrescue_SOURCES = util/i386/pc/grub-mkrescue.in
181 pkglib_MODULES = biosdisk.mod chain.mod \
182 multiboot.mod reboot.mod halt.mod \
183 vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
184 ata.mod vga.mod memdisk.mod pci.mod lspci.mod \
185 aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
186 datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
187 usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
188 efiemu.mod mmap.mod acpi.mod drivemap.mod
191 pkglib_MODULES += boot.mod
192 boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
193 boot_mod_CFLAGS = $(COMMON_CFLAGS)
194 boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
197 drivemap_mod_SOURCES = commands/i386/pc/drivemap.c \
198 commands/i386/pc/drivemap_int13h.S
199 drivemap_mod_ASFLAGS = $(COMMON_ASFLAGS)
200 drivemap_mod_CFLAGS = $(COMMON_CFLAGS)
201 drivemap_mod_LDFLAGS = $(COMMON_LDFLAGS)
204 efiemu_mod_SOURCES = efiemu/main.c efiemu/i386/loadcore32.c \
205 efiemu/i386/loadcore64.c efiemu/i386/pc/cfgtables.c \
206 efiemu/mm.c efiemu/loadcore_common.c efiemu/symbols.c \
207 efiemu/loadcore32.c efiemu/loadcore64.c \
208 efiemu/prepare32.c efiemu/prepare64.c efiemu/pnvram.c \
209 efiemu/i386/coredetect.c
210 efiemu_mod_CFLAGS = $(COMMON_CFLAGS)
211 efiemu_mod_LDFLAGS = $(COMMON_LDFLAGS)
214 acpi_mod_SOURCES = commands/acpi.c commands/i386/pc/acpi.c
215 acpi_mod_CFLAGS = $(COMMON_CFLAGS)
216 acpi_mod_LDFLAGS = $(COMMON_LDFLAGS)
219 mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c \
220 mmap/i386/pc/mmap.c mmap/i386/pc/mmap_helper.S
221 mmap_mod_CFLAGS = $(COMMON_CFLAGS)
222 mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
223 mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
226 biosdisk_mod_SOURCES = disk/i386/pc/biosdisk.c
227 biosdisk_mod_CFLAGS = $(COMMON_CFLAGS)
228 biosdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
231 chain_mod_SOURCES = loader/i386/pc/chainloader.c
232 chain_mod_CFLAGS = $(COMMON_CFLAGS)
233 chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
235 pkglib_MODULES += linux16.mod
236 linux16_mod_SOURCES = loader/i386/pc/linux.c
237 linux16_mod_CFLAGS = $(COMMON_CFLAGS)
238 linux16_mod_LDFLAGS = $(COMMON_LDFLAGS)
240 pkglib_MODULES += linux.mod
241 linux_mod_SOURCES = loader/i386/linux.c
242 linux_mod_CFLAGS = $(COMMON_CFLAGS)
243 linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
245 pkglib_MODULES += xnu.mod
246 xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c\
247 loader/macho.c loader/xnu.c loader/i386/xnu_helper.S
248 xnu_mod_CFLAGS = $(COMMON_CFLAGS)
249 xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
250 xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
253 reboot_mod_SOURCES = commands/reboot.c
254 reboot_mod_CFLAGS = $(COMMON_CFLAGS)
255 reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
258 halt_mod_SOURCES = commands/i386/pc/halt.c
259 halt_mod_CFLAGS = $(COMMON_CFLAGS)
260 halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
263 serial_mod_SOURCES = term/i386/pc/serial.c
264 serial_mod_CFLAGS = $(COMMON_CFLAGS)
265 serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
268 multiboot_mod_SOURCES = loader/i386/multiboot.c \
269 loader/i386/multiboot_helper.S \
270 loader/i386/pc/multiboot2.c \
271 loader/multiboot2.c \
272 loader/multiboot_loader.c
273 multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
274 multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
275 multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
278 vbe_mod_SOURCES = video/i386/pc/vbe.c
279 vbe_mod_CFLAGS = $(COMMON_CFLAGS)
280 vbe_mod_LDFLAGS = $(COMMON_LDFLAGS)
283 vbeinfo_mod_SOURCES = commands/i386/pc/vbeinfo.c
284 vbeinfo_mod_CFLAGS = $(COMMON_CFLAGS)
285 vbeinfo_mod_LDFLAGS = $(COMMON_LDFLAGS)
288 vbetest_mod_SOURCES = commands/i386/pc/vbetest.c
289 vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
290 vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS)
293 play_mod_SOURCES = commands/i386/pc/play.c
294 play_mod_CFLAGS = $(COMMON_CFLAGS)
295 play_mod_LDFLAGS = $(COMMON_LDFLAGS)
298 ata_mod_SOURCES = disk/ata.c
299 ata_mod_CFLAGS = $(COMMON_CFLAGS)
300 ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
303 vga_mod_SOURCES = term/i386/pc/vga.c
304 vga_mod_CFLAGS = $(COMMON_CFLAGS)
305 vga_mod_LDFLAGS = $(COMMON_LDFLAGS)
308 memdisk_mod_SOURCES = disk/memdisk.c
309 memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
310 memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
313 pci_mod_SOURCES = bus/pci.c
314 pci_mod_CFLAGS = $(COMMON_CFLAGS)
315 pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
318 lspci_mod_SOURCES = commands/lspci.c
319 lspci_mod_CFLAGS = $(COMMON_CFLAGS)
320 lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
323 aout_mod_SOURCES = loader/aout.c
324 aout_mod_CFLAGS = $(COMMON_CFLAGS)
325 aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
328 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
329 bsd_mod_CFLAGS = $(COMMON_CFLAGS)
330 bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
331 bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
334 usb_mod_SOURCES = bus/usb/usb.c bus/usb/usbtrans.c bus/usb/usbhub.c
335 usb_mod_CFLAGS = $(COMMON_CFLAGS)
336 usb_mod_LDFLAGS = $(COMMON_LDFLAGS)
339 usbtest_mod_SOURCES = commands/usbtest.c
340 usbtest_mod_CFLAGS = $(COMMON_CFLAGS)
341 usbtest_mod_LDFLAGS = $(COMMON_LDFLAGS)
344 uhci_mod_SOURCES = bus/usb/uhci.c
345 uhci_mod_CFLAGS = $(COMMON_CFLAGS)
346 uhci_mod_LDFLAGS = $(COMMON_LDFLAGS)
349 ohci_mod_SOURCES = bus/usb/ohci.c
350 ohci_mod_CFLAGS = $(COMMON_CFLAGS)
351 ohci_mod_LDFLAGS = $(COMMON_LDFLAGS)
354 usbms_mod_SOURCES = disk/usbms.c
355 usbms_mod_CFLAGS = $(COMMON_CFLAGS)
356 usbms_mod_LDFLAGS = $(COMMON_LDFLAGS)
358 # For usb_keyboard.mod
359 usb_keyboard_mod_SOURCES = term/usb_keyboard.c
360 usb_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
361 usb_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
364 pxe_mod_SOURCES = fs/i386/pc/pxe.c
365 pxe_mod_CFLAGS = $(COMMON_CFLAGS)
366 pxe_mod_LDFLAGS = $(COMMON_LDFLAGS)
369 pxecmd_mod_SOURCES = commands/i386/pc/pxecmd.c
370 pxecmd_mod_CFLAGS = $(COMMON_CFLAGS)
371 pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
374 datetime_mod_SOURCES = lib/i386/datetime.c
375 datetime_mod_CFLAGS = $(COMMON_CFLAGS)
376 datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
379 date_mod_SOURCES = commands/date.c
380 date_mod_CFLAGS = $(COMMON_CFLAGS)
381 date_mod_LDFLAGS = $(COMMON_LDFLAGS)
384 datehook_mod_SOURCES = hook/datehook.c
385 datehook_mod_CFLAGS = $(COMMON_CFLAGS)
386 datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
389 lsmmap_mod_SOURCES = commands/lsmmap.c
390 lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
391 lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
394 ata_pthru_mod_SOURCES = disk/ata_pthru.c
395 ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
396 ata_pthru_mod_LDFLAGS = $(COMMON_LDFLAGS)
399 hdparm_mod_SOURCES = commands/hdparm.c lib/hexdump.c
400 hdparm_mod_CFLAGS = $(COMMON_CFLAGS)
401 hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
403 ifeq ($(enable_efiemu), yes)
405 efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
407 ifeq ($(TARGET_APPLE_CC), 1)
409 $(TARGET_CC) -c -m32 -DELF32 -DAPPLE_CC -o $@.bin -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
410 $(OBJCONV) -felf32 -nu -nd $@.bin $@
413 $(TARGET_CC) -c -m32 -DELF32 -o $@ -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
414 if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
417 efiemu64_c.o: efiemu/runtime/efiemu.c
418 ifeq ($(TARGET_APPLE_CC), 1)
419 $(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
421 $(TARGET_CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
424 efiemu64_s.o: efiemu/runtime/efiemu.S
426 ifeq ($(TARGET_APPLE_CC), 1)
427 $(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
429 $(TARGET_CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude
432 efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELF)
434 ifeq ($(TARGET_APPLE_CC), 1)
436 $(TARGET_CC) -m64 -o $@.bin -Wl,-r $^ -nostdlib
437 $(OBJCONV) -felf64 -nu -nd $@.bin $@
440 $(TARGET_CC) -m64 -o $@ -Wl,-r $^ -nostdlib
441 if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
444 CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
445 pkglib_DATA += efiemu32.o efiemu64.o
449 include $(srcdir)/conf/i386.mk
450 include $(srcdir)/conf/common.mk