2004-12-04 Marco Gerards <metgerards@student.han.nl>
Modulize the partition map support and add support for the amiga partition map. * commands/ls.c: Include <grub/partition.h> instead of <grub/machine/partition.h>. * kern/disk.c: Likewise. * kern/rescue.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * normal/cmdline.c: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. (grub_machine_init): Call `grub_pc_partition_map_init', `grub_amiga_partition_map_init' and `grub_apple_partition_map_init'. * conf/i386-pc.rmk (kernel_img_SOURCES): Remove `disk/i386/pc/partition.c'. Add `kern/partition.c'. (kernel_img_HEADERS): Remove `machine/partition.h'. Add `partition.h' and `pc_partition.h'. (grub_setup_SOURCES): Remove `disk/i386/pc/partition.c'. Add `kern/partition.c', `partmap/amiga.c', `partmap/apple.c' and `partmap/pc.c'. (grub_emu_SOURCES): Likewise. (pkgdata_MODULES): Add `amiga.mod', `apple.mod' and `pc.mod'. (amiga_mod_SOURCES, amiga_mod_CFLAGS, apple_mod_SOURCES) (apple_mod_CFLAGS, pc_mod_SOURCES, pc_mod_CFLAGS): New variables. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Remove `disk/powerpc/ieee1275/partition.c'. Add `kern/partition.c', `partmap/amiga.c', `partmap/apple.c' and `partmap/pc.c'. (grubof_SOURCES): Likewise. * disk/i386/pc/partition.c: File removed. * disk/powerpc/ieee1275/partition.c: Likewise. * include/grub/powerpc/ieee1275/partition.h: Likewise. * include/grub/i386/pc/partition.h: Likewise. * kern/partition.c: New file. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/pc.c: Likewise. * include/grub/partition.h: Likewise.. * include/grub/pc_partition.h: Likewise. * util/grub-emu.c: Include <grub/partition.h> instead of <grub/machine/partition.h>. (main): Call `grub_pc_partition_map_init', `grub_amiga_partition_map_init' and `grub_apple_partition_map_init' and deinitialize afterwards. * util/i386/pc/biosdisk.c: Include `#include <grub/partition.h>' and `include <grub/pc_partition.h>' instead of `<grub/machine/partition.h>'. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/biosdisk.c: Likewise. (grub_util_biosdisk_get_grub_dev): Only access the PC specific partition information in case of a PC partition. * util/i386/pc/grub-setup.c: Include `#include <grub/partition.h>' and `include <grub/pc_partition.h>' instead of `<grub/machine/partition.h>'. (setup): Only access the PC specific partition information in case of a PC partition.
This commit is contained in:
parent
0ef4ced959
commit
3f1578fe4a
23 changed files with 1405 additions and 638 deletions
58
ChangeLog
58
ChangeLog
|
@ -1,3 +1,61 @@
|
|||
2004-12-04 Marco Gerards <metgerards@student.han.nl>
|
||||
|
||||
Modulize the partition map support and add support for the amiga
|
||||
partition map.
|
||||
|
||||
* commands/ls.c: Include <grub/partition.h> instead of
|
||||
<grub/machine/partition.h>.
|
||||
* kern/disk.c: Likewise.
|
||||
* kern/rescue.c: Likewise.
|
||||
* loader/i386/pc/chainloader.c: Likewise.
|
||||
* normal/cmdline.c: Likewise.
|
||||
* kern/powerpc/ieee1275/init.c: Likewise.
|
||||
(grub_machine_init): Call `grub_pc_partition_map_init',
|
||||
`grub_amiga_partition_map_init' and
|
||||
`grub_apple_partition_map_init'.
|
||||
* conf/i386-pc.rmk (kernel_img_SOURCES): Remove
|
||||
`disk/i386/pc/partition.c'. Add `kern/partition.c'.
|
||||
(kernel_img_HEADERS): Remove `machine/partition.h'. Add
|
||||
`partition.h' and `pc_partition.h'.
|
||||
(grub_setup_SOURCES): Remove
|
||||
`disk/i386/pc/partition.c'. Add `kern/partition.c',
|
||||
`partmap/amiga.c', `partmap/apple.c' and `partmap/pc.c'.
|
||||
(grub_emu_SOURCES): Likewise.
|
||||
(pkgdata_MODULES): Add `amiga.mod', `apple.mod' and `pc.mod'.
|
||||
(amiga_mod_SOURCES, amiga_mod_CFLAGS, apple_mod_SOURCES)
|
||||
(apple_mod_CFLAGS, pc_mod_SOURCES, pc_mod_CFLAGS): New variables.
|
||||
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Remove
|
||||
`disk/powerpc/ieee1275/partition.c'. Add `kern/partition.c',
|
||||
`partmap/amiga.c', `partmap/apple.c' and `partmap/pc.c'.
|
||||
(grubof_SOURCES): Likewise.
|
||||
* disk/i386/pc/partition.c: File removed.
|
||||
* disk/powerpc/ieee1275/partition.c: Likewise.
|
||||
* include/grub/powerpc/ieee1275/partition.h: Likewise.
|
||||
* include/grub/i386/pc/partition.h: Likewise.
|
||||
* kern/partition.c: New file.
|
||||
* partmap/amiga.c: Likewise.
|
||||
* partmap/apple.c: Likewise.
|
||||
* partmap/pc.c: Likewise.
|
||||
* include/grub/partition.h: Likewise..
|
||||
* include/grub/pc_partition.h: Likewise.
|
||||
* util/grub-emu.c: Include <grub/partition.h> instead of
|
||||
<grub/machine/partition.h>.
|
||||
(main): Call `grub_pc_partition_map_init',
|
||||
`grub_amiga_partition_map_init' and
|
||||
`grub_apple_partition_map_init' and deinitialize afterwards.
|
||||
* util/i386/pc/biosdisk.c: Include `#include
|
||||
<grub/partition.h>' and `include <grub/pc_partition.h>' instead of
|
||||
`<grub/machine/partition.h>'.
|
||||
* util/i386/pc/grub-setup.c: Likewise.
|
||||
* util/i386/pc/biosdisk.c: Likewise.
|
||||
(grub_util_biosdisk_get_grub_dev): Only access the PC specific
|
||||
partition information in case of a PC partition.
|
||||
* util/i386/pc/grub-setup.c: Include `#include
|
||||
<grub/partition.h>' and `include <grub/pc_partition.h>' instead of
|
||||
`<grub/machine/partition.h>'.
|
||||
(setup): Only access the PC specific partition information in case
|
||||
of a PC partition.
|
||||
|
||||
2004-11-17 Hollis Blanchard <hollis@penguinppc.org>
|
||||
|
||||
* kern/powerpc/ieee1275/init.c (grub_setjmp): Remove function.
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/machine/partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/file.h>
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
|
|
232
conf/i386-pc.mk
232
conf/i386-pc.mk
|
@ -76,17 +76,17 @@ diskboot_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8000
|
|||
kernel_img_SOURCES = kern/i386/pc/startup.S kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
|
||||
kern/i386/dl.c kern/i386/pc/init.c disk/i386/pc/partition.c \
|
||||
kern/i386/dl.c kern/i386/pc/init.c kern/partition.c \
|
||||
kern/env.c disk/i386/pc/biosdisk.c \
|
||||
term/i386/pc/console.c \
|
||||
symlist.c
|
||||
CLEANFILES += kernel.img kernel.exec kernel_img-kern_i386_pc_startup.o kernel_img-kern_main.o kernel_img-kern_device.o kernel_img-kern_disk.o kernel_img-kern_dl.o kernel_img-kern_file.o kernel_img-kern_fs.o kernel_img-kern_err.o kernel_img-kern_misc.o kernel_img-kern_mm.o kernel_img-kern_loader.o kernel_img-kern_rescue.o kernel_img-kern_term.o kernel_img-kern_i386_dl.o kernel_img-kern_i386_pc_init.o kernel_img-disk_i386_pc_partition.o kernel_img-kern_env.o kernel_img-disk_i386_pc_biosdisk.o kernel_img-term_i386_pc_console.o kernel_img-symlist.o
|
||||
MOSTLYCLEANFILES += kernel_img-kern_i386_pc_startup.d kernel_img-kern_main.d kernel_img-kern_device.d kernel_img-kern_disk.d kernel_img-kern_dl.d kernel_img-kern_file.d kernel_img-kern_fs.d kernel_img-kern_err.d kernel_img-kern_misc.d kernel_img-kern_mm.d kernel_img-kern_loader.d kernel_img-kern_rescue.d kernel_img-kern_term.d kernel_img-kern_i386_dl.d kernel_img-kern_i386_pc_init.d kernel_img-disk_i386_pc_partition.d kernel_img-kern_env.d kernel_img-disk_i386_pc_biosdisk.d kernel_img-term_i386_pc_console.d kernel_img-symlist.d
|
||||
CLEANFILES += kernel.img kernel.exec kernel_img-kern_i386_pc_startup.o kernel_img-kern_main.o kernel_img-kern_device.o kernel_img-kern_disk.o kernel_img-kern_dl.o kernel_img-kern_file.o kernel_img-kern_fs.o kernel_img-kern_err.o kernel_img-kern_misc.o kernel_img-kern_mm.o kernel_img-kern_loader.o kernel_img-kern_rescue.o kernel_img-kern_term.o kernel_img-kern_i386_dl.o kernel_img-kern_i386_pc_init.o kernel_img-kern_partition.o kernel_img-kern_env.o kernel_img-disk_i386_pc_biosdisk.o kernel_img-term_i386_pc_console.o kernel_img-symlist.o
|
||||
MOSTLYCLEANFILES += kernel_img-kern_i386_pc_startup.d kernel_img-kern_main.d kernel_img-kern_device.d kernel_img-kern_disk.d kernel_img-kern_dl.d kernel_img-kern_file.d kernel_img-kern_fs.d kernel_img-kern_err.d kernel_img-kern_misc.d kernel_img-kern_mm.d kernel_img-kern_loader.d kernel_img-kern_rescue.d kernel_img-kern_term.d kernel_img-kern_i386_dl.d kernel_img-kern_i386_pc_init.d kernel_img-kern_partition.d kernel_img-kern_env.d kernel_img-disk_i386_pc_biosdisk.d kernel_img-term_i386_pc_console.d kernel_img-symlist.d
|
||||
|
||||
kernel.img: kernel.exec
|
||||
$(OBJCOPY) -O binary -R .note -R .comment $< $@
|
||||
|
||||
kernel.exec: kernel_img-kern_i386_pc_startup.o kernel_img-kern_main.o kernel_img-kern_device.o kernel_img-kern_disk.o kernel_img-kern_dl.o kernel_img-kern_file.o kernel_img-kern_fs.o kernel_img-kern_err.o kernel_img-kern_misc.o kernel_img-kern_mm.o kernel_img-kern_loader.o kernel_img-kern_rescue.o kernel_img-kern_term.o kernel_img-kern_i386_dl.o kernel_img-kern_i386_pc_init.o kernel_img-disk_i386_pc_partition.o kernel_img-kern_env.o kernel_img-disk_i386_pc_biosdisk.o kernel_img-term_i386_pc_console.o kernel_img-symlist.o
|
||||
kernel.exec: kernel_img-kern_i386_pc_startup.o kernel_img-kern_main.o kernel_img-kern_device.o kernel_img-kern_disk.o kernel_img-kern_dl.o kernel_img-kern_file.o kernel_img-kern_fs.o kernel_img-kern_err.o kernel_img-kern_misc.o kernel_img-kern_mm.o kernel_img-kern_loader.o kernel_img-kern_rescue.o kernel_img-kern_term.o kernel_img-kern_i386_dl.o kernel_img-kern_i386_pc_init.o kernel_img-kern_partition.o kernel_img-kern_env.o kernel_img-disk_i386_pc_biosdisk.o kernel_img-term_i386_pc_console.o kernel_img-symlist.o
|
||||
$(CC) -o $@ $^ $(LDFLAGS) $(kernel_img_LDFLAGS)
|
||||
|
||||
kernel_img-kern_i386_pc_startup.o: kern/i386/pc/startup.S
|
||||
|
@ -209,13 +209,13 @@ kernel_img-kern_i386_pc_init.d: kern/i386/pc/init.c
|
|||
|
||||
-include kernel_img-kern_i386_pc_init.d
|
||||
|
||||
kernel_img-disk_i386_pc_partition.o: disk/i386/pc/partition.c
|
||||
$(CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(CPPFLAGS) $(CFLAGS) $(kernel_img_CFLAGS) -c -o $@ $<
|
||||
kernel_img-kern_partition.o: kern/partition.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_img_CFLAGS) -c -o $@ $<
|
||||
|
||||
kernel_img-disk_i386_pc_partition.d: disk/i386/pc/partition.c
|
||||
set -e; $(CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(CPPFLAGS) $(CFLAGS) $(kernel_img_CFLAGS) -M $< | sed 's,partition\.o[ :]*,kernel_img-disk_i386_pc_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
kernel_img-kern_partition.d: kern/partition.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_img_CFLAGS) -M $< | sed 's,partition\.o[ :]*,kernel_img-kern_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include kernel_img-disk_i386_pc_partition.d
|
||||
-include kernel_img-kern_partition.d
|
||||
|
||||
kernel_img-kern_env.o: kern/env.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(kernel_img_CFLAGS) -c -o $@ $<
|
||||
|
@ -253,7 +253,7 @@ kernel_img_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \
|
|||
file.h fs.h kernel.h loader.h misc.h mm.h net.h rescue.h symbol.h \
|
||||
term.h types.h machine/biosdisk.h machine/boot.h \
|
||||
machine/console.h machine/init.h machine/memory.h \
|
||||
machine/loader.h machine/partition.h machine/time.h machine/vga.h
|
||||
machine/loader.h partition.h pc_partition.h machine/time.h machine/vga.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8200
|
||||
|
@ -310,12 +310,13 @@ grub_mkimage_LDFLAGS = -llzo
|
|||
# For grub-setup.
|
||||
grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
|
||||
util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
|
||||
kern/err.c kern/misc.c disk/i386/pc/partition.c fs/fat.c fs/ext2.c \
|
||||
kern/err.c kern/misc.c fs/fat.c fs/ext2.c \
|
||||
kern/partition.c partmap/amiga.c partmap/apple.c partmap/pc.c \
|
||||
fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c fs/fshelp.c
|
||||
CLEANFILES += grub-setup grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-disk_i386_pc_partition.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_hfs.o grub_setup-fs_jfs.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o grub_setup-fs_fshelp.o
|
||||
MOSTLYCLEANFILES += grub_setup-util_i386_pc_grub_setup.d grub_setup-util_i386_pc_biosdisk.d grub_setup-util_misc.d grub_setup-util_i386_pc_getroot.d grub_setup-kern_device.d grub_setup-kern_disk.d grub_setup-kern_err.d grub_setup-kern_misc.d grub_setup-disk_i386_pc_partition.d grub_setup-fs_fat.d grub_setup-fs_ext2.d grub_setup-fs_ufs.d grub_setup-fs_minix.d grub_setup-fs_hfs.d grub_setup-fs_jfs.d grub_setup-kern_file.d grub_setup-kern_fs.d grub_setup-kern_env.d grub_setup-fs_fshelp.d
|
||||
CLEANFILES += grub-setup grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-kern_partition.o grub_setup-partmap_amiga.o grub_setup-partmap_apple.o grub_setup-partmap_pc.o grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_hfs.o grub_setup-fs_jfs.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o grub_setup-fs_fshelp.o
|
||||
MOSTLYCLEANFILES += grub_setup-util_i386_pc_grub_setup.d grub_setup-util_i386_pc_biosdisk.d grub_setup-util_misc.d grub_setup-util_i386_pc_getroot.d grub_setup-kern_device.d grub_setup-kern_disk.d grub_setup-kern_err.d grub_setup-kern_misc.d grub_setup-fs_fat.d grub_setup-fs_ext2.d grub_setup-kern_partition.d grub_setup-partmap_amiga.d grub_setup-partmap_apple.d grub_setup-partmap_pc.d grub_setup-fs_ufs.d grub_setup-fs_minix.d grub_setup-fs_hfs.d grub_setup-fs_jfs.d grub_setup-kern_file.d grub_setup-kern_fs.d grub_setup-kern_env.d grub_setup-fs_fshelp.d
|
||||
|
||||
grub-setup: grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-disk_i386_pc_partition.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_hfs.o grub_setup-fs_jfs.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o grub_setup-fs_fshelp.o
|
||||
grub-setup: grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-kern_partition.o grub_setup-partmap_amiga.o grub_setup-partmap_apple.o grub_setup-partmap_pc.o grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_hfs.o grub_setup-fs_jfs.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o grub_setup-fs_fshelp.o
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_setup_LDFLAGS)
|
||||
|
||||
grub_setup-util_i386_pc_grub_setup.o: util/i386/pc/grub-setup.c
|
||||
|
@ -382,14 +383,6 @@ grub_setup-kern_misc.d: kern/misc.c
|
|||
|
||||
-include grub_setup-kern_misc.d
|
||||
|
||||
grub_setup-disk_i386_pc_partition.o: disk/i386/pc/partition.c
|
||||
$(BUILD_CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_setup-disk_i386_pc_partition.d: disk/i386/pc/partition.c
|
||||
set -e; $(BUILD_CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grub_setup-disk_i386_pc_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_setup-disk_i386_pc_partition.d
|
||||
|
||||
grub_setup-fs_fat.o: fs/fat.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $<
|
||||
|
||||
|
@ -406,6 +399,38 @@ grub_setup-fs_ext2.d: fs/ext2.c
|
|||
|
||||
-include grub_setup-fs_ext2.d
|
||||
|
||||
grub_setup-kern_partition.o: kern/partition.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_setup-kern_partition.d: kern/partition.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grub_setup-kern_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_setup-kern_partition.d
|
||||
|
||||
grub_setup-partmap_amiga.o: partmap/amiga.c
|
||||
$(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_setup-partmap_amiga.d: partmap/amiga.c
|
||||
set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,amiga\.o[ :]*,grub_setup-partmap_amiga.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_setup-partmap_amiga.d
|
||||
|
||||
grub_setup-partmap_apple.o: partmap/apple.c
|
||||
$(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_setup-partmap_apple.d: partmap/apple.c
|
||||
set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,apple\.o[ :]*,grub_setup-partmap_apple.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_setup-partmap_apple.d
|
||||
|
||||
grub_setup-partmap_pc.o: partmap/pc.c
|
||||
$(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_setup-partmap_pc.d: partmap/pc.c
|
||||
set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,pc\.o[ :]*,grub_setup-partmap_pc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_setup-partmap_pc.d
|
||||
|
||||
grub_setup-fs_ufs.o: fs/ufs.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $<
|
||||
|
||||
|
@ -475,15 +500,16 @@ grub_setup-fs_fshelp.d: fs/fshelp.c
|
|||
grub_emu_SOURCES = kern/main.c kern/device.c fs/fshelp.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/loader.c kern/rescue.c kern/term.c \
|
||||
disk/i386/pc/partition.c kern/env.c commands/ls.c \
|
||||
kern/partition.c kern/env.c commands/ls.c partmap/amiga.c \
|
||||
partmap/pc.c partmap/apple.c \
|
||||
commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c \
|
||||
util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/iso9660.c \
|
||||
normal/cmdline.c normal/command.c normal/main.c normal/menu.c normal/arg.c \
|
||||
util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c
|
||||
CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-fs_fshelp.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-disk_i386_pc_partition.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o
|
||||
MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d grub_emu-fs_fshelp.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-disk_i386_pc_partition.d grub_emu-kern_env.d grub_emu-commands_ls.d grub_emu-commands_terminal.d grub_emu-commands_boot.d grub_emu-commands_cmp.d grub_emu-commands_cat.d grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-fs_ufs.d grub_emu-fs_minix.d grub_emu-fs_hfs.d grub_emu-fs_jfs.d grub_emu-fs_iso9660.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_arg.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_getroot.d
|
||||
CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-fs_fshelp.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-kern_partition.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o
|
||||
MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d grub_emu-fs_fshelp.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-kern_partition.d grub_emu-kern_env.d grub_emu-commands_ls.d grub_emu-partmap_amiga.d grub_emu-partmap_pc.d grub_emu-partmap_apple.d grub_emu-commands_terminal.d grub_emu-commands_boot.d grub_emu-commands_cmp.d grub_emu-commands_cat.d grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-fs_ufs.d grub_emu-fs_minix.d grub_emu-fs_hfs.d grub_emu-fs_jfs.d grub_emu-fs_iso9660.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_arg.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_getroot.d
|
||||
|
||||
grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-fs_fshelp.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-disk_i386_pc_partition.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o
|
||||
grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-fs_fshelp.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-kern_partition.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
|
||||
|
||||
grub_emu-kern_main.o: kern/main.c
|
||||
|
@ -582,13 +608,13 @@ grub_emu-kern_term.d: kern/term.c
|
|||
|
||||
-include grub_emu-kern_term.d
|
||||
|
||||
grub_emu-disk_i386_pc_partition.o: disk/i386/pc/partition.c
|
||||
$(BUILD_CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
grub_emu-kern_partition.o: kern/partition.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_emu-disk_i386_pc_partition.d: disk/i386/pc/partition.c
|
||||
set -e; $(BUILD_CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grub_emu-disk_i386_pc_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
grub_emu-kern_partition.d: kern/partition.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grub_emu-kern_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-disk_i386_pc_partition.d
|
||||
-include grub_emu-kern_partition.d
|
||||
|
||||
grub_emu-kern_env.o: kern/env.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
@ -606,6 +632,30 @@ grub_emu-commands_ls.d: commands/ls.c
|
|||
|
||||
-include grub_emu-commands_ls.d
|
||||
|
||||
grub_emu-partmap_amiga.o: partmap/amiga.c
|
||||
$(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_emu-partmap_amiga.d: partmap/amiga.c
|
||||
set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,amiga\.o[ :]*,grub_emu-partmap_amiga.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-partmap_amiga.d
|
||||
|
||||
grub_emu-partmap_pc.o: partmap/pc.c
|
||||
$(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_emu-partmap_pc.d: partmap/pc.c
|
||||
set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,pc\.o[ :]*,grub_emu-partmap_pc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-partmap_pc.d
|
||||
|
||||
grub_emu-partmap_apple.o: partmap/apple.c
|
||||
$(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_emu-partmap_apple.d: partmap/apple.c
|
||||
set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,apple\.o[ :]*,grub_emu-partmap_apple.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-partmap_apple.d
|
||||
|
||||
grub_emu-commands_terminal.o: commands/terminal.c
|
||||
$(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
|
@ -796,7 +846,8 @@ genmoddep-util_genmoddep.d: util/genmoddep.c
|
|||
# Modules.
|
||||
pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
|
||||
hfs.mod jfs.mod normal.mod hello.mod vga.mod font.mod _multiboot.mod ls.mod \
|
||||
boot.mod cmp.mod cat.mod terminal.mod fshelp.mod chain.mod multiboot.mod
|
||||
boot.mod cmp.mod cat.mod terminal.mod fshelp.mod chain.mod multiboot.mod \
|
||||
amiga.mod apple.mod pc.mod
|
||||
|
||||
# For _chain.mod.
|
||||
_chain_mod_SOURCES = loader/i386/pc/chainloader.c
|
||||
|
@ -1701,6 +1752,123 @@ multiboot_mod-loader_i386_pc_multiboot_normal.d: loader/i386/pc/multiboot_normal
|
|||
-include multiboot_mod-loader_i386_pc_multiboot_normal.d
|
||||
|
||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For amiga.mod
|
||||
amiga_mod_SOURCES = partmap/amiga.c
|
||||
CLEANFILES += amiga.mod mod-amiga.o mod-amiga.c pre-amiga.o amiga_mod-partmap_amiga.o def-amiga.lst und-amiga.lst
|
||||
MOSTLYCLEANFILES += amiga_mod-partmap_amiga.d
|
||||
DEFSYMFILES += def-amiga.lst
|
||||
UNDSYMFILES += und-amiga.lst
|
||||
|
||||
amiga.mod: pre-amiga.o mod-amiga.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-amiga.o: amiga_mod-partmap_amiga.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
|
||||
mod-amiga.o: mod-amiga.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(amiga_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-amiga.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'amiga' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
def-amiga.lst: pre-amiga.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 amiga/' > $@
|
||||
|
||||
und-amiga.lst: pre-amiga.o
|
||||
echo 'amiga' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
amiga_mod-partmap_amiga.o: partmap/amiga.c
|
||||
$(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(amiga_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
amiga_mod-partmap_amiga.d: partmap/amiga.c
|
||||
set -e; $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(amiga_mod_CFLAGS) -M $< | sed 's,amiga\.o[ :]*,amiga_mod-partmap_amiga.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include amiga_mod-partmap_amiga.d
|
||||
|
||||
amiga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For apple.mod
|
||||
apple_mod_SOURCES = partmap/apple.c
|
||||
CLEANFILES += apple.mod mod-apple.o mod-apple.c pre-apple.o apple_mod-partmap_apple.o def-apple.lst und-apple.lst
|
||||
MOSTLYCLEANFILES += apple_mod-partmap_apple.d
|
||||
DEFSYMFILES += def-apple.lst
|
||||
UNDSYMFILES += und-apple.lst
|
||||
|
||||
apple.mod: pre-apple.o mod-apple.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-apple.o: apple_mod-partmap_apple.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
|
||||
mod-apple.o: mod-apple.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(apple_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-apple.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'apple' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
def-apple.lst: pre-apple.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 apple/' > $@
|
||||
|
||||
und-apple.lst: pre-apple.o
|
||||
echo 'apple' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
apple_mod-partmap_apple.o: partmap/apple.c
|
||||
$(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(apple_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
apple_mod-partmap_apple.d: partmap/apple.c
|
||||
set -e; $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(apple_mod_CFLAGS) -M $< | sed 's,apple\.o[ :]*,apple_mod-partmap_apple.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include apple_mod-partmap_apple.d
|
||||
|
||||
apple_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For pc.mod
|
||||
pc_mod_SOURCES = partmap/pc.c
|
||||
CLEANFILES += pc.mod mod-pc.o mod-pc.c pre-pc.o pc_mod-partmap_pc.o def-pc.lst und-pc.lst
|
||||
MOSTLYCLEANFILES += pc_mod-partmap_pc.d
|
||||
DEFSYMFILES += def-pc.lst
|
||||
UNDSYMFILES += und-pc.lst
|
||||
|
||||
pc.mod: pre-pc.o mod-pc.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-pc.o: pc_mod-partmap_pc.o
|
||||
-rm -f $@
|
||||
$(LD) -r -o $@ $^
|
||||
|
||||
mod-pc.o: mod-pc.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(pc_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-pc.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'pc' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
def-pc.lst: pre-pc.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 pc/' > $@
|
||||
|
||||
und-pc.lst: pre-pc.o
|
||||
echo 'pc' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
pc_mod-partmap_pc.o: partmap/pc.c
|
||||
$(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(pc_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
pc_mod-partmap_pc.d: partmap/pc.c
|
||||
set -e; $(CC) -Ipartmap -I$(srcdir)/partmap $(CPPFLAGS) $(CFLAGS) $(pc_mod_CFLAGS) -M $< | sed 's,pc\.o[ :]*,pc_mod-partmap_pc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include pc_mod-partmap_pc.d
|
||||
|
||||
pc_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
CLEANFILES += moddep.lst
|
||||
pkgdata_DATA += moddep.lst
|
||||
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep
|
||||
|
|
|
@ -25,7 +25,7 @@ diskboot_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8000
|
|||
kernel_img_SOURCES = kern/i386/pc/startup.S kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
|
||||
kern/i386/dl.c kern/i386/pc/init.c disk/i386/pc/partition.c \
|
||||
kern/i386/dl.c kern/i386/pc/init.c kern/partition.c \
|
||||
kern/env.c disk/i386/pc/biosdisk.c \
|
||||
term/i386/pc/console.c \
|
||||
symlist.c
|
||||
|
@ -33,7 +33,7 @@ kernel_img_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \
|
|||
file.h fs.h kernel.h loader.h misc.h mm.h net.h rescue.h symbol.h \
|
||||
term.h types.h machine/biosdisk.h machine/boot.h \
|
||||
machine/console.h machine/init.h machine/memory.h \
|
||||
machine/loader.h machine/partition.h machine/time.h machine/vga.h
|
||||
machine/loader.h partition.h pc_partition.h machine/time.h machine/vga.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8200
|
||||
|
@ -60,14 +60,16 @@ grub_mkimage_LDFLAGS = -llzo
|
|||
# For grub-setup.
|
||||
grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
|
||||
util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
|
||||
kern/err.c kern/misc.c disk/i386/pc/partition.c fs/fat.c fs/ext2.c \
|
||||
kern/err.c kern/misc.c fs/fat.c fs/ext2.c \
|
||||
kern/partition.c partmap/amiga.c partmap/apple.c partmap/pc.c \
|
||||
fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c fs/fshelp.c
|
||||
|
||||
# For grub
|
||||
grub_emu_SOURCES = kern/main.c kern/device.c fs/fshelp.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/loader.c kern/rescue.c kern/term.c \
|
||||
disk/i386/pc/partition.c kern/env.c commands/ls.c \
|
||||
kern/partition.c kern/env.c commands/ls.c partmap/amiga.c \
|
||||
partmap/pc.c partmap/apple.c \
|
||||
commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c \
|
||||
util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/iso9660.c \
|
||||
normal/cmdline.c normal/command.c normal/main.c normal/menu.c normal/arg.c \
|
||||
|
@ -80,7 +82,8 @@ genmoddep_SOURCES = util/genmoddep.c
|
|||
# Modules.
|
||||
pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
|
||||
hfs.mod jfs.mod normal.mod hello.mod vga.mod font.mod _multiboot.mod ls.mod \
|
||||
boot.mod cmp.mod cat.mod terminal.mod fshelp.mod chain.mod multiboot.mod
|
||||
boot.mod cmp.mod cat.mod terminal.mod fshelp.mod chain.mod multiboot.mod \
|
||||
amiga.mod apple.mod pc.mod
|
||||
|
||||
# For _chain.mod.
|
||||
_chain_mod_SOURCES = loader/i386/pc/chainloader.c
|
||||
|
@ -175,3 +178,15 @@ _multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
# For multiboot.mod.
|
||||
multiboot_mod_SOURCES = loader/i386/pc/multiboot_normal.c
|
||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For amiga.mod
|
||||
amiga_mod_SOURCES = partmap/amiga.c
|
||||
amiga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For apple.mod
|
||||
apple_mod_SOURCES = partmap/apple.c
|
||||
apple_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For pc.mod
|
||||
pc_mod_SOURCES = partmap/pc.c
|
||||
pc_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
|
|
@ -24,18 +24,18 @@ noinst_UTILITIES = genmoddep
|
|||
grub_emu_SOURCES = kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/loader.c kern/rescue.c kern/term.c \
|
||||
disk/powerpc/ieee1275/partition.c fs/fshelp.c \
|
||||
partmap/amiga.c partmap/pc.c partmap/apple.c fs/fshelp.c \
|
||||
util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c \
|
||||
fs/jfs.c fs/iso9660.c \
|
||||
normal/cmdline.c normal/command.c normal/main.c normal/menu.c \
|
||||
normal/arg.c \
|
||||
normal/arg.c kern/partition.c \
|
||||
util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c \
|
||||
kern/env.c commands/ls.c \
|
||||
commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c
|
||||
CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-disk_powerpc_ieee1275_partition.o grub_emu-fs_fshelp.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
|
||||
MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-disk_powerpc_ieee1275_partition.d grub_emu-fs_fshelp.d grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-fs_ufs.d grub_emu-fs_minix.d grub_emu-fs_hfs.d grub_emu-fs_jfs.d grub_emu-fs_iso9660.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_arg.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_getroot.d grub_emu-kern_env.d grub_emu-commands_ls.d grub_emu-commands_terminal.d grub_emu-commands_boot.d grub_emu-commands_cmp.d grub_emu-commands_cat.d
|
||||
CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-fs_fshelp.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-kern_partition.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
|
||||
MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-partmap_amiga.d grub_emu-partmap_pc.d grub_emu-partmap_apple.d grub_emu-fs_fshelp.d grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-fs_ufs.d grub_emu-fs_minix.d grub_emu-fs_hfs.d grub_emu-fs_jfs.d grub_emu-fs_iso9660.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_arg.d grub_emu-kern_partition.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_getroot.d grub_emu-kern_env.d grub_emu-commands_ls.d grub_emu-commands_terminal.d grub_emu-commands_boot.d grub_emu-commands_cmp.d grub_emu-commands_cat.d
|
||||
|
||||
grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-disk_powerpc_ieee1275_partition.o grub_emu-fs_fshelp.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
|
||||
grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o grub_emu-partmap_apple.o grub_emu-fs_fshelp.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-kern_partition.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
|
||||
|
||||
grub_emu-kern_main.o: kern/main.c
|
||||
|
@ -126,13 +126,29 @@ grub_emu-kern_term.d: kern/term.c
|
|||
|
||||
-include grub_emu-kern_term.d
|
||||
|
||||
grub_emu-disk_powerpc_ieee1275_partition.o: disk/powerpc/ieee1275/partition.c
|
||||
$(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
grub_emu-partmap_amiga.o: partmap/amiga.c
|
||||
$(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_emu-disk_powerpc_ieee1275_partition.d: disk/powerpc/ieee1275/partition.c
|
||||
set -e; $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grub_emu-disk_powerpc_ieee1275_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
grub_emu-partmap_amiga.d: partmap/amiga.c
|
||||
set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,amiga\.o[ :]*,grub_emu-partmap_amiga.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-disk_powerpc_ieee1275_partition.d
|
||||
-include grub_emu-partmap_amiga.d
|
||||
|
||||
grub_emu-partmap_pc.o: partmap/pc.c
|
||||
$(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_emu-partmap_pc.d: partmap/pc.c
|
||||
set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,pc\.o[ :]*,grub_emu-partmap_pc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-partmap_pc.d
|
||||
|
||||
grub_emu-partmap_apple.o: partmap/apple.c
|
||||
$(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_emu-partmap_apple.d: partmap/apple.c
|
||||
set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,apple\.o[ :]*,grub_emu-partmap_apple.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-partmap_apple.d
|
||||
|
||||
grub_emu-fs_fshelp.o: fs/fshelp.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
@ -246,6 +262,14 @@ grub_emu-normal_arg.d: normal/arg.c
|
|||
|
||||
-include grub_emu-normal_arg.d
|
||||
|
||||
grub_emu-kern_partition.o: kern/partition.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_emu-kern_partition.d: kern/partition.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grub_emu-kern_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-kern_partition.d
|
||||
|
||||
grub_emu-util_console.o: util/console.c
|
||||
$(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
|
@ -335,14 +359,15 @@ grubof_SOURCES = boot/powerpc/ieee1275/crt0.S boot/powerpc/ieee1275/cmain.c \
|
|||
kern/powerpc/ieee1275/init.c term/powerpc/ieee1275/ofconsole.c \
|
||||
kern/powerpc/ieee1275/openfw.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c \
|
||||
fs/jfs.c normal/cmdline.c normal/command.c normal/main.c normal/menu.c \
|
||||
disk/powerpc/ieee1275/ofdisk.c disk/powerpc/ieee1275/partition.c \
|
||||
disk/powerpc/ieee1275/ofdisk.c partmap/amiga.c partmap/pc.c \
|
||||
partmap/apple.c kern/partition.c \
|
||||
kern/env.c normal/arg.c loader/powerpc/ieee1275/linux.c \
|
||||
loader/powerpc/ieee1275/linux_normal.c commands/boot.c \
|
||||
normal/powerpc/setjmp.S
|
||||
CLEANFILES += grubof grubof-boot_powerpc_ieee1275_crt0.o grubof-boot_powerpc_ieee1275_cmain.o grubof-boot_powerpc_ieee1275_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-fs_fshelp.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_powerpc_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-fs_ext2.o grubof-fs_ufs.o grubof-fs_minix.o grubof-fs_hfs.o grubof-fs_jfs.o grubof-normal_cmdline.o grubof-normal_command.o grubof-normal_main.o grubof-normal_menu.o grubof-disk_powerpc_ieee1275_ofdisk.o grubof-disk_powerpc_ieee1275_partition.o grubof-kern_env.o grubof-normal_arg.o grubof-loader_powerpc_ieee1275_linux.o grubof-loader_powerpc_ieee1275_linux_normal.o grubof-commands_boot.o grubof-normal_powerpc_setjmp.o
|
||||
MOSTLYCLEANFILES += grubof-boot_powerpc_ieee1275_crt0.d grubof-boot_powerpc_ieee1275_cmain.d grubof-boot_powerpc_ieee1275_ieee1275.d grubof-kern_main.d grubof-kern_device.d grubof-kern_disk.d grubof-kern_dl.d grubof-kern_file.d grubof-kern_fs.d grubof-kern_err.d grubof-fs_fshelp.d grubof-kern_misc.d grubof-kern_mm.d grubof-kern_loader.d grubof-kern_rescue.d grubof-kern_term.d grubof-kern_powerpc_ieee1275_init.d grubof-term_powerpc_ieee1275_ofconsole.d grubof-kern_powerpc_ieee1275_openfw.d grubof-fs_ext2.d grubof-fs_ufs.d grubof-fs_minix.d grubof-fs_hfs.d grubof-fs_jfs.d grubof-normal_cmdline.d grubof-normal_command.d grubof-normal_main.d grubof-normal_menu.d grubof-disk_powerpc_ieee1275_ofdisk.d grubof-disk_powerpc_ieee1275_partition.d grubof-kern_env.d grubof-normal_arg.d grubof-loader_powerpc_ieee1275_linux.d grubof-loader_powerpc_ieee1275_linux_normal.d grubof-commands_boot.d grubof-normal_powerpc_setjmp.d
|
||||
CLEANFILES += grubof grubof-boot_powerpc_ieee1275_crt0.o grubof-boot_powerpc_ieee1275_cmain.o grubof-boot_powerpc_ieee1275_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-fs_fshelp.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_powerpc_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-fs_ext2.o grubof-fs_ufs.o grubof-fs_minix.o grubof-fs_hfs.o grubof-fs_jfs.o grubof-normal_cmdline.o grubof-normal_command.o grubof-normal_main.o grubof-normal_menu.o grubof-disk_powerpc_ieee1275_ofdisk.o grubof-partmap_amiga.o grubof-partmap_pc.o grubof-partmap_apple.o grubof-kern_partition.o grubof-kern_env.o grubof-normal_arg.o grubof-loader_powerpc_ieee1275_linux.o grubof-loader_powerpc_ieee1275_linux_normal.o grubof-commands_boot.o grubof-normal_powerpc_setjmp.o
|
||||
MOSTLYCLEANFILES += grubof-boot_powerpc_ieee1275_crt0.d grubof-boot_powerpc_ieee1275_cmain.d grubof-boot_powerpc_ieee1275_ieee1275.d grubof-kern_main.d grubof-kern_device.d grubof-kern_disk.d grubof-kern_dl.d grubof-kern_file.d grubof-kern_fs.d grubof-kern_err.d grubof-fs_fshelp.d grubof-kern_misc.d grubof-kern_mm.d grubof-kern_loader.d grubof-kern_rescue.d grubof-kern_term.d grubof-kern_powerpc_ieee1275_init.d grubof-term_powerpc_ieee1275_ofconsole.d grubof-kern_powerpc_ieee1275_openfw.d grubof-fs_ext2.d grubof-fs_ufs.d grubof-fs_minix.d grubof-fs_hfs.d grubof-fs_jfs.d grubof-normal_cmdline.d grubof-normal_command.d grubof-normal_main.d grubof-normal_menu.d grubof-disk_powerpc_ieee1275_ofdisk.d grubof-partmap_amiga.d grubof-partmap_pc.d grubof-partmap_apple.d grubof-kern_partition.d grubof-kern_env.d grubof-normal_arg.d grubof-loader_powerpc_ieee1275_linux.d grubof-loader_powerpc_ieee1275_linux_normal.d grubof-commands_boot.d grubof-normal_powerpc_setjmp.d
|
||||
|
||||
grubof: grubof-boot_powerpc_ieee1275_crt0.o grubof-boot_powerpc_ieee1275_cmain.o grubof-boot_powerpc_ieee1275_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-fs_fshelp.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_powerpc_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-fs_ext2.o grubof-fs_ufs.o grubof-fs_minix.o grubof-fs_hfs.o grubof-fs_jfs.o grubof-normal_cmdline.o grubof-normal_command.o grubof-normal_main.o grubof-normal_menu.o grubof-disk_powerpc_ieee1275_ofdisk.o grubof-disk_powerpc_ieee1275_partition.o grubof-kern_env.o grubof-normal_arg.o grubof-loader_powerpc_ieee1275_linux.o grubof-loader_powerpc_ieee1275_linux_normal.o grubof-commands_boot.o grubof-normal_powerpc_setjmp.o
|
||||
grubof: grubof-boot_powerpc_ieee1275_crt0.o grubof-boot_powerpc_ieee1275_cmain.o grubof-boot_powerpc_ieee1275_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-fs_fshelp.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_powerpc_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-fs_ext2.o grubof-fs_ufs.o grubof-fs_minix.o grubof-fs_hfs.o grubof-fs_jfs.o grubof-normal_cmdline.o grubof-normal_command.o grubof-normal_main.o grubof-normal_menu.o grubof-disk_powerpc_ieee1275_ofdisk.o grubof-partmap_amiga.o grubof-partmap_pc.o grubof-partmap_apple.o grubof-kern_partition.o grubof-kern_env.o grubof-normal_arg.o grubof-loader_powerpc_ieee1275_linux.o grubof-loader_powerpc_ieee1275_linux_normal.o grubof-commands_boot.o grubof-normal_powerpc_setjmp.o
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grubof_LDFLAGS)
|
||||
|
||||
grubof-boot_powerpc_ieee1275_crt0.o: boot/powerpc/ieee1275/crt0.S
|
||||
|
@ -577,13 +602,37 @@ grubof-disk_powerpc_ieee1275_ofdisk.d: disk/powerpc/ieee1275/ofdisk.c
|
|||
|
||||
-include grubof-disk_powerpc_ieee1275_ofdisk.d
|
||||
|
||||
grubof-disk_powerpc_ieee1275_partition.o: disk/powerpc/ieee1275/partition.c
|
||||
$(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $<
|
||||
grubof-partmap_amiga.o: partmap/amiga.c
|
||||
$(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-disk_powerpc_ieee1275_partition.d: disk/powerpc/ieee1275/partition.c
|
||||
set -e; $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grubof-disk_powerpc_ieee1275_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
grubof-partmap_amiga.d: partmap/amiga.c
|
||||
set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,amiga\.o[ :]*,grubof-partmap_amiga.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-disk_powerpc_ieee1275_partition.d
|
||||
-include grubof-partmap_amiga.d
|
||||
|
||||
grubof-partmap_pc.o: partmap/pc.c
|
||||
$(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-partmap_pc.d: partmap/pc.c
|
||||
set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,pc\.o[ :]*,grubof-partmap_pc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-partmap_pc.d
|
||||
|
||||
grubof-partmap_apple.o: partmap/apple.c
|
||||
$(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-partmap_apple.d: partmap/apple.c
|
||||
set -e; $(BUILD_CC) -Ipartmap -I$(srcdir)/partmap $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,apple\.o[ :]*,grubof-partmap_apple.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-partmap_apple.d
|
||||
|
||||
grubof-kern_partition.o: kern/partition.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_partition.d: kern/partition.c
|
||||
set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grubof-kern_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_partition.d
|
||||
|
||||
grubof-kern_env.o: kern/env.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
|
|
@ -24,11 +24,11 @@ noinst_UTILITIES = genmoddep
|
|||
grub_emu_SOURCES = kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/loader.c kern/rescue.c kern/term.c \
|
||||
disk/powerpc/ieee1275/partition.c fs/fshelp.c \
|
||||
partmap/amiga.c partmap/pc.c partmap/apple.c fs/fshelp.c \
|
||||
util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c \
|
||||
fs/jfs.c fs/iso9660.c \
|
||||
normal/cmdline.c normal/command.c normal/main.c normal/menu.c \
|
||||
normal/arg.c \
|
||||
normal/arg.c kern/partition.c \
|
||||
util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c \
|
||||
kern/env.c commands/ls.c \
|
||||
commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c
|
||||
|
@ -41,7 +41,8 @@ grubof_SOURCES = boot/powerpc/ieee1275/crt0.S boot/powerpc/ieee1275/cmain.c \
|
|||
kern/powerpc/ieee1275/init.c term/powerpc/ieee1275/ofconsole.c \
|
||||
kern/powerpc/ieee1275/openfw.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c \
|
||||
fs/jfs.c normal/cmdline.c normal/command.c normal/main.c normal/menu.c \
|
||||
disk/powerpc/ieee1275/ofdisk.c disk/powerpc/ieee1275/partition.c \
|
||||
disk/powerpc/ieee1275/ofdisk.c partmap/amiga.c partmap/pc.c \
|
||||
partmap/apple.c kern/partition.c \
|
||||
kern/env.c normal/arg.c loader/powerpc/ieee1275/linux.c \
|
||||
loader/powerpc/ieee1275/linux_normal.c commands/boot.c \
|
||||
normal/powerpc/setjmp.S
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
/* partiton.c - Read macintosh partition tables. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <grub/disk.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/machine/partition.h>
|
||||
|
||||
grub_err_t
|
||||
grub_partition_iterate (grub_disk_t disk,
|
||||
int (*hook) (const grub_partition_t partition))
|
||||
{
|
||||
struct grub_partition part;
|
||||
struct grub_apple_part apart;
|
||||
struct grub_disk raw;
|
||||
int partno = 0;
|
||||
int pos = GRUB_DISK_SECTOR_SIZE;
|
||||
|
||||
/* Enforce raw disk access. */
|
||||
raw = *disk;
|
||||
raw.partition = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (grub_disk_read (&raw, pos / GRUB_DISK_SECTOR_SIZE,
|
||||
pos % GRUB_DISK_SECTOR_SIZE,
|
||||
sizeof (struct grub_apple_part), (char *) &apart))
|
||||
return grub_errno;
|
||||
|
||||
if (apart.magic != GRUB_APPLE_PART_MAGIC)
|
||||
break;
|
||||
|
||||
part.start = apart.first_phys_block;
|
||||
part.len = apart.blockcnt;
|
||||
part.offset = pos;
|
||||
part.index = partno;
|
||||
|
||||
if (hook (&part))
|
||||
return grub_errno;
|
||||
|
||||
if (apart.first_phys_block == GRUB_DISK_SECTOR_SIZE * 2)
|
||||
return 0;
|
||||
|
||||
pos += sizeof (struct grub_apple_part);
|
||||
partno++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_partition_t
|
||||
grub_partition_probe (grub_disk_t disk, const char *str)
|
||||
{
|
||||
grub_partition_t p = 0;
|
||||
int partnum = 0;
|
||||
char *s = (char *) str;
|
||||
|
||||
int find_func (const grub_partition_t partition)
|
||||
{
|
||||
if (partnum == partition->index)
|
||||
{
|
||||
p = (grub_partition_t) grub_malloc (sizeof (*p));
|
||||
if (! p)
|
||||
return 1;
|
||||
|
||||
grub_memcpy (p, partition, sizeof (*p));
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get the partition number. */
|
||||
partnum = grub_strtoul (s, 0, 10);
|
||||
if (grub_errno)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (grub_partition_iterate (disk, find_func))
|
||||
goto fail;
|
||||
|
||||
return p;
|
||||
|
||||
fail:
|
||||
grub_free (p);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
char *
|
||||
grub_partition_get_name (const grub_partition_t p)
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = grub_malloc (13);
|
||||
if (! name)
|
||||
return 0;
|
||||
|
||||
grub_sprintf (name, "%d", p->index);
|
||||
return name;
|
||||
}
|
|
@ -1,242 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 GRUB; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_PARTITION_HEADER
|
||||
#define GRUB_PARTITION_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
/* The signature. */
|
||||
#define GRUB_PARTITION_SIGNATURE 0xaa55
|
||||
|
||||
/* This is not a flag actually, but used as if it were a flag. */
|
||||
#define GRUB_PARTITION_TYPE_HIDDEN_FLAG 0x10
|
||||
|
||||
/* DOS partition types. */
|
||||
#define GRUB_PARTITION_TYPE_NONE 0
|
||||
#define GRUB_PARTITION_TYPE_FAT12 1
|
||||
#define GRUB_PARTITION_TYPE_FAT16_LT32M 4
|
||||
#define GRUB_PARTITION_TYPE_EXTENDED 5
|
||||
#define GRUB_PARTITION_TYPE_FAT16_GT32M 6
|
||||
#define GRUB_PARTITION_TYPE_FAT32 0xb
|
||||
#define GRUB_PARTITION_TYPE_FAT32_LBA 0xc
|
||||
#define GRUB_PARTITION_TYPE_FAT16_LBA 0xe
|
||||
#define GRUB_PARTITION_TYPE_WIN95_EXTENDED 0xf
|
||||
#define GRUB_PARTITION_TYPE_EZD 0x55
|
||||
#define GRUB_PARTITION_TYPE_MINIX 0x80
|
||||
#define GRUB_PARTITION_TYPE_LINUX_MINIX 0x81
|
||||
#define GRUB_PARTITION_TYPE_EXT2FS 0x83
|
||||
#define GRUB_PARTITION_TYPE_LINUX_EXTENDED 0x85
|
||||
#define GRUB_PARTITION_TYPE_VSTAFS 0x9e
|
||||
#define GRUB_PARTITION_TYPE_FREEBSD 0xa5
|
||||
#define GRUB_PARTITION_TYPE_OPENBSD 0xa6
|
||||
#define GRUB_PARTITION_TYPE_NETBSD 0xa9
|
||||
#define GRUB_PARTITION_TYPE_LINUX_RAID 0xfd
|
||||
|
||||
/* Constants for BSD disk label. */
|
||||
#define GRUB_PARTITION_BSD_LABEL_SECTOR 1
|
||||
#define GRUB_PARTITION_BSD_LABEL_MAGIC 0x82564557
|
||||
#define GRUB_PARTITION_BSD_MAX_ENTRIES 8
|
||||
|
||||
/* BSD partition types. */
|
||||
#define GRUB_PARTITION_BSD_TYPE_UNUSED 0
|
||||
#define GRUB_PARTITION_BSD_TYPE_SWAP 1
|
||||
#define GRUB_PARTITION_BSD_TYPE_V6 2
|
||||
#define GRUB_PARTITION_BSD_TYPE_V7 3
|
||||
#define GRUB_PARTITION_BSD_TYPE_SYSV 4
|
||||
#define GRUB_PARTITION_BSD_TYPE_V71K 5
|
||||
#define GRUB_PARTITION_BSD_TYPE_V8 6
|
||||
#define GRUB_PARTITION_BSD_TYPE_BSDFFS 7
|
||||
#define GRUB_PARTITION_BSD_TYPE_MSDOS 8
|
||||
#define GRUB_PARTITION_BSD_TYPE_BSDLFS 9
|
||||
#define GRUB_PARTITION_BSD_TYPE_OTHER 10
|
||||
#define GRUB_PARTITION_BSD_TYPE_HPFS 11
|
||||
#define GRUB_PARTITION_BSD_TYPE_ISO9660 12
|
||||
#define GRUB_PARTITION_BSD_TYPE_BOOT 13
|
||||
|
||||
/* FreeBSD-specific types. */
|
||||
#define GRUB_PARTITION_FREEBSD_TYPE_VINUM 14
|
||||
#define GRUB_PARTITION_FREEBSD_TYPE_RAID 15
|
||||
#define GRUB_PARTITION_FREEBSD_TYPE_JFS2 21
|
||||
|
||||
/* NetBSD-specific types. */
|
||||
#define GRUB_PARTITION_NETBSD_TYPE_ADOS 14
|
||||
#define GRUB_PARTITION_NETBSD_TYPE_HFS 15
|
||||
#define GRUB_PARTITION_NETBSD_TYPE_FILECORE 16
|
||||
#define GRUB_PARTITION_NETBSD_TYPE_EXT2FS 17
|
||||
#define GRUB_PARTITION_NETBSD_TYPE_NTFS 18
|
||||
#define GRUB_PARTITION_NETBSD_TYPE_RAID 19
|
||||
#define GRUB_PARTITION_NETBSD_TYPE_CCD 20
|
||||
#define GRUB_PARTITION_NETBSD_TYPE_JFS2 21
|
||||
#define GRUB_PARTITION_NETBSD_TYPE_APPLEUFS 22
|
||||
|
||||
/* OpenBSD-specific types. */
|
||||
#define GRUB_PARTITION_OPENBSD_TYPE_ADOS 14
|
||||
#define GRUB_PARTITION_OPENBSD_TYPE_HFS 15
|
||||
#define GRUB_PARTITION_OPENBSD_TYPE_FILECORE 16
|
||||
#define GRUB_PARTITION_OPENBSD_TYPE_EXT2FS 17
|
||||
#define GRUB_PARTITION_OPENBSD_TYPE_NTFS 18
|
||||
#define GRUB_PARTITION_OPENBSD_TYPE_RAID 19
|
||||
|
||||
/* The BSD partition entry. */
|
||||
struct grub_partition_bsd_entry
|
||||
{
|
||||
grub_uint32_t size;
|
||||
grub_uint32_t offset;
|
||||
grub_uint32_t fragment_size;
|
||||
grub_uint8_t fs_type;
|
||||
grub_uint8_t fs_fragments;
|
||||
grub_uint16_t fs_cylinders;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The BSD disk label. Only define members useful for GRUB. */
|
||||
struct grub_partition_disk_label
|
||||
{
|
||||
grub_uint32_t magic;
|
||||
grub_uint8_t padding[128];
|
||||
grub_uint32_t magic2;
|
||||
grub_uint16_t checksum;
|
||||
grub_uint16_t num_partitions;
|
||||
grub_uint32_t boot_size;
|
||||
grub_uint32_t superblock_size;
|
||||
struct grub_partition_bsd_entry entries[GRUB_PARTITION_BSD_MAX_ENTRIES];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The partition entry. */
|
||||
struct grub_partition_entry
|
||||
{
|
||||
/* If active, 0x80, otherwise, 0x00. */
|
||||
grub_uint8_t flag;
|
||||
|
||||
/* The head of the start. */
|
||||
grub_uint8_t start_head;
|
||||
|
||||
/* (S | ((C >> 2) & 0xC0)) where S is the sector of the start and C
|
||||
is the cylinder of the start. Note that S is counted from one. */
|
||||
grub_uint8_t start_sector;
|
||||
|
||||
/* (C & 0xFF) where C is the cylinder of the start. */
|
||||
grub_uint8_t start_cylinder;
|
||||
|
||||
/* The partition type. */
|
||||
grub_uint8_t type;
|
||||
|
||||
/* The end versions of start_head, start_sector and start_cylinder,
|
||||
respectively. */
|
||||
grub_uint8_t end_head;
|
||||
grub_uint8_t end_sector;
|
||||
grub_uint8_t end_cylinder;
|
||||
|
||||
/* The start sector. Note that this is counted from zero. */
|
||||
grub_uint32_t start;
|
||||
|
||||
/* The length in sector units. */
|
||||
grub_uint32_t length;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The structure of MBR. */
|
||||
struct grub_partition_mbr
|
||||
{
|
||||
/* The code area (actually, including BPB). */
|
||||
grub_uint8_t code[446];
|
||||
|
||||
/* Four partition entries. */
|
||||
struct grub_partition_entry entries[4];
|
||||
|
||||
/* The signature 0xaa55. */
|
||||
grub_uint16_t signature;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Partition description. */
|
||||
struct grub_partition
|
||||
{
|
||||
/* The start sector. */
|
||||
unsigned long start;
|
||||
|
||||
/* The length in sector units. */
|
||||
unsigned long len;
|
||||
|
||||
/* The offset of the partition table. */
|
||||
unsigned long offset;
|
||||
|
||||
/* The offset of the extended partition. */
|
||||
unsigned long ext_offset;
|
||||
|
||||
/* The index of this partition in the partition table. */
|
||||
int index;
|
||||
|
||||
/* The DOS partition number. */
|
||||
int dos_part;
|
||||
|
||||
/* The BSD partition number (a == 0). */
|
||||
int bsd_part;
|
||||
|
||||
/* The DOS partition type. */
|
||||
int dos_type;
|
||||
|
||||
/* The BSD partition type. */
|
||||
int bsd_type;
|
||||
};
|
||||
typedef struct grub_partition *grub_partition_t;
|
||||
|
||||
struct grub_disk;
|
||||
|
||||
grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk,
|
||||
const char *str);
|
||||
grub_err_t EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk,
|
||||
int (*hook) (const grub_partition_t partition));
|
||||
char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
|
||||
|
||||
static inline unsigned long
|
||||
grub_partition_get_start (const grub_partition_t p)
|
||||
{
|
||||
return p->start;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
grub_partition_get_len (const grub_partition_t p)
|
||||
{
|
||||
return p->len;
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_partition_is_empty (int type)
|
||||
{
|
||||
return (type == GRUB_PARTITION_TYPE_NONE);
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_partition_is_extended (int type)
|
||||
{
|
||||
return (type == GRUB_PARTITION_TYPE_EXTENDED
|
||||
|| type == GRUB_PARTITION_TYPE_WIN95_EXTENDED
|
||||
|| type == GRUB_PARTITION_TYPE_LINUX_EXTENDED);
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_partition_is_bsd (int type)
|
||||
{
|
||||
return (type == GRUB_PARTITION_TYPE_FREEBSD
|
||||
|| type == GRUB_PARTITION_TYPE_OPENBSD
|
||||
|| type == GRUB_PARTITION_TYPE_NETBSD);
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_PARTITION_HEADER */
|
106
include/grub/partition.h
Normal file
106
include/grub/partition.h
Normal file
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 GRUB; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_PART_HEADER
|
||||
#define GRUB_PART_HEADER 1
|
||||
|
||||
#include <grub/dl.h>
|
||||
|
||||
struct grub_disk;
|
||||
|
||||
typedef struct grub_partition *grub_partition_t;
|
||||
|
||||
/* Partition map type. */
|
||||
struct grub_partition_map
|
||||
{
|
||||
/* The name of the partition map type. */
|
||||
const char *name;
|
||||
|
||||
/* Call HOOK with each partition, until HOOK returns non-zero. */
|
||||
grub_err_t (*iterate) (struct grub_disk *disk,
|
||||
int (*hook) (const grub_partition_t partition));
|
||||
|
||||
/* Return the partition named STR on the disk DISK. */
|
||||
grub_partition_t (*probe) (struct grub_disk *disk,
|
||||
const char *str);
|
||||
|
||||
/* Return the name of the partition PARTITION. */
|
||||
char *(*get_name) (const grub_partition_t partition);
|
||||
|
||||
/* The next partition map type. */
|
||||
struct grub_partition_map *next;
|
||||
};
|
||||
typedef struct grub_partition_map *grub_partition_map_t;
|
||||
|
||||
/* Partition description. */
|
||||
struct grub_partition
|
||||
{
|
||||
/* The start sector. */
|
||||
unsigned long start;
|
||||
|
||||
/* The length in sector units. */
|
||||
unsigned long len;
|
||||
|
||||
/* The offset of the partition table. */
|
||||
unsigned long offset;
|
||||
|
||||
/* The index of this partition in the partition table. */
|
||||
int index;
|
||||
|
||||
/* Partition map type specific data. */
|
||||
void *data;
|
||||
|
||||
/* The type partition map. */
|
||||
grub_partition_map_t partmap;
|
||||
};
|
||||
|
||||
grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk,
|
||||
const char *str);
|
||||
grub_err_t EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk,
|
||||
int (*hook) (const grub_partition_t partition));
|
||||
char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
|
||||
|
||||
void EXPORT_FUNC(grub_partition_map_iterate) (int (*hook) (const grub_partition_map_t partmap));
|
||||
|
||||
void EXPORT_FUNC(grub_partition_map_register) (grub_partition_map_t partmap);
|
||||
|
||||
void EXPORT_FUNC(grub_partition_map_unregister) (grub_partition_map_t partmap);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
void grub_pc_partition_map_init (void);
|
||||
void grub_pc_partition_map_fini (void);
|
||||
void grub_amiga_partition_map_init (void);
|
||||
void grub_amiga_partition_map_fini (void);
|
||||
void grub_apple_partition_map_init (void);
|
||||
void grub_apple_partition_map_fini (void);
|
||||
#endif
|
||||
|
||||
static inline unsigned long
|
||||
grub_partition_get_start (const grub_partition_t p)
|
||||
{
|
||||
return p->start;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
grub_partition_get_len (const grub_partition_t p)
|
||||
{
|
||||
return p->len;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_PART_HEADER */
|
209
include/grub/pc_partition.h
Normal file
209
include/grub/pc_partition.h
Normal file
|
@ -0,0 +1,209 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 GRUB; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_PC_PARTITION_HEADER
|
||||
#define GRUB_PC_PARTITION_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
/* The signature. */
|
||||
#define GRUB_PC_PARTITION_SIGNATURE 0xaa55
|
||||
|
||||
/* This is not a flag actually, but used as if it were a flag. */
|
||||
#define GRUB_PC_PARTITION_TYPE_HIDDEN_FLAG 0x10
|
||||
|
||||
/* DOS partition types. */
|
||||
#define GRUB_PC_PARTITION_TYPE_NONE 0
|
||||
#define GRUB_PC_PARTITION_TYPE_FAT12 1
|
||||
#define GRUB_PC_PARTITION_TYPE_FAT16_LT32M 4
|
||||
#define GRUB_PC_PARTITION_TYPE_EXTENDED 5
|
||||
#define GRUB_PC_PARTITION_TYPE_FAT16_GT32M 6
|
||||
#define GRUB_PC_PARTITION_TYPE_FAT32 0xb
|
||||
#define GRUB_PC_PARTITION_TYPE_FAT32_LBA 0xc
|
||||
#define GRUB_PC_PARTITION_TYPE_FAT16_LBA 0xe
|
||||
#define GRUB_PC_PARTITION_TYPE_WIN95_EXTENDED 0xf
|
||||
#define GRUB_PC_PARTITION_TYPE_EZD 0x55
|
||||
#define GRUB_PC_PARTITION_TYPE_MINIX 0x80
|
||||
#define GRUB_PC_PARTITION_TYPE_LINUX_MINIX 0x81
|
||||
#define GRUB_PC_PARTITION_TYPE_EXT2FS 0x83
|
||||
#define GRUB_PC_PARTITION_TYPE_LINUX_EXTENDED 0x85
|
||||
#define GRUB_PC_PARTITION_TYPE_VSTAFS 0x9e
|
||||
#define GRUB_PC_PARTITION_TYPE_FREEBSD 0xa5
|
||||
#define GRUB_PC_PARTITION_TYPE_OPENBSD 0xa6
|
||||
#define GRUB_PC_PARTITION_TYPE_NETBSD 0xa9
|
||||
#define GRUB_PC_PARTITION_TYPE_LINUX_RAID 0xfd
|
||||
|
||||
/* Constants for BSD disk label. */
|
||||
#define GRUB_PC_PARTITION_BSD_LABEL_SECTOR 1
|
||||
#define GRUB_PC_PARTITION_BSD_LABEL_MAGIC 0x82564557
|
||||
#define GRUB_PC_PARTITION_BSD_MAX_ENTRIES 8
|
||||
|
||||
/* BSD partition types. */
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_UNUSED 0
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_SWAP 1
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_V6 2
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_V7 3
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_SYSV 4
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_V71K 5
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_V8 6
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_BSDFFS 7
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_MSDOS 8
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_BSDLFS 9
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_OTHER 10
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_HPFS 11
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_ISO9660 12
|
||||
#define GRUB_PC_PARTITION_BSD_TYPE_BOOT 13
|
||||
|
||||
/* FreeBSD-specific types. */
|
||||
#define GRUB_PC_PARTITION_FREEBSD_TYPE_VINUM 14
|
||||
#define GRUB_PC_PARTITION_FREEBSD_TYPE_RAID 15
|
||||
#define GRUB_PC_PARTITION_FREEBSD_TYPE_JFS2 21
|
||||
|
||||
/* NetBSD-specific types. */
|
||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_ADOS 14
|
||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_HFS 15
|
||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_FILECORE 16
|
||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_EXT2FS 17
|
||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_NTFS 18
|
||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_RAID 19
|
||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_CCD 20
|
||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_JFS2 21
|
||||
#define GRUB_PC_PARTITION_NETBSD_TYPE_APPLEUFS 22
|
||||
|
||||
/* OpenBSD-specific types. */
|
||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_ADOS 14
|
||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_HFS 15
|
||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_FILECORE 16
|
||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_EXT2FS 17
|
||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_NTFS 18
|
||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_RAID 19
|
||||
|
||||
/* The BSD partition entry. */
|
||||
struct grub_pc_partition_bsd_entry
|
||||
{
|
||||
grub_uint32_t size;
|
||||
grub_uint32_t offset;
|
||||
grub_uint32_t fragment_size;
|
||||
grub_uint8_t fs_type;
|
||||
grub_uint8_t fs_fragments;
|
||||
grub_uint16_t fs_cylinders;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The BSD disk label. Only define members useful for GRUB. */
|
||||
struct grub_pc_partition_disk_label
|
||||
{
|
||||
grub_uint32_t magic;
|
||||
grub_uint8_t padding[128];
|
||||
grub_uint32_t magic2;
|
||||
grub_uint16_t checksum;
|
||||
grub_uint16_t num_partitions;
|
||||
grub_uint32_t boot_size;
|
||||
grub_uint32_t superblock_size;
|
||||
struct grub_pc_partition_bsd_entry entries[GRUB_PC_PARTITION_BSD_MAX_ENTRIES];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The partition entry. */
|
||||
struct grub_pc_partition_entry
|
||||
{
|
||||
/* If active, 0x80, otherwise, 0x00. */
|
||||
grub_uint8_t flag;
|
||||
|
||||
/* The head of the start. */
|
||||
grub_uint8_t start_head;
|
||||
|
||||
/* (S | ((C >> 2) & 0xC0)) where S is the sector of the start and C
|
||||
is the cylinder of the start. Note that S is counted from one. */
|
||||
grub_uint8_t start_sector;
|
||||
|
||||
/* (C & 0xFF) where C is the cylinder of the start. */
|
||||
grub_uint8_t start_cylinder;
|
||||
|
||||
/* The partition type. */
|
||||
grub_uint8_t type;
|
||||
|
||||
/* The end versions of start_head, start_sector and start_cylinder,
|
||||
respectively. */
|
||||
grub_uint8_t end_head;
|
||||
grub_uint8_t end_sector;
|
||||
grub_uint8_t end_cylinder;
|
||||
|
||||
/* The start sector. Note that this is counted from zero. */
|
||||
grub_uint32_t start;
|
||||
|
||||
/* The length in sector units. */
|
||||
grub_uint32_t length;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The structure of MBR. */
|
||||
struct grub_pc_partition_mbr
|
||||
{
|
||||
/* The code area (actually, including BPB). */
|
||||
grub_uint8_t code[446];
|
||||
|
||||
/* Four partition entries. */
|
||||
struct grub_pc_partition_entry entries[4];
|
||||
|
||||
/* The signature 0xaa55. */
|
||||
grub_uint16_t signature;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct grub_pc_partition
|
||||
{
|
||||
/* The DOS partition number. */
|
||||
int dos_part;
|
||||
|
||||
/* The BSD partition number (a == 0). */
|
||||
int bsd_part;
|
||||
|
||||
/* The DOS partition type. */
|
||||
int dos_type;
|
||||
|
||||
/* The BSD partition type. */
|
||||
int bsd_type;
|
||||
|
||||
/* The offset of the extended partition. */
|
||||
unsigned long ext_offset;
|
||||
};
|
||||
|
||||
static inline int
|
||||
grub_pc_partition_is_empty (int type)
|
||||
{
|
||||
return (type == GRUB_PC_PARTITION_TYPE_NONE);
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_pc_partition_is_extended (int type)
|
||||
{
|
||||
return (type == GRUB_PC_PARTITION_TYPE_EXTENDED
|
||||
|| type == GRUB_PC_PARTITION_TYPE_WIN95_EXTENDED
|
||||
|| type == GRUB_PC_PARTITION_TYPE_LINUX_EXTENDED);
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_pc_partition_is_bsd (int type)
|
||||
{
|
||||
return (type == GRUB_PC_PARTITION_TYPE_FREEBSD
|
||||
|| type == GRUB_PC_PARTITION_TYPE_OPENBSD
|
||||
|| type == GRUB_PC_PARTITION_TYPE_NETBSD);
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_PC_PARTITION_HEADER */
|
|
@ -1,140 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 GRUB; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_PARTITION_HEADER
|
||||
#define GRUB_PARTITION_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
#define GRUB_APPLE_PART_MAGIC 0x504D
|
||||
|
||||
struct grub_apple_part
|
||||
{
|
||||
/* The magic number to idenify this as a partition, it should have
|
||||
the value `0x504D'. */
|
||||
grub_uint16_t magic;
|
||||
|
||||
/* Reserved. */
|
||||
grub_uint16_t reserved;
|
||||
|
||||
/* The size of the partition map in blocks. */
|
||||
grub_uint32_t partmap_size;
|
||||
|
||||
/* The first physical block of the partition. */
|
||||
grub_uint32_t first_phys_block;
|
||||
|
||||
/* The amount of blocks. */
|
||||
grub_uint32_t blockcnt;
|
||||
|
||||
/* The partition name. */
|
||||
char partname[32];
|
||||
|
||||
/* The partition type. */
|
||||
char parttype[32];
|
||||
|
||||
/* The first datablock of the partition. */
|
||||
grub_uint32_t datablocks_first;
|
||||
|
||||
/* The amount datablocks. */
|
||||
grub_uint32_t datablocks_count;
|
||||
|
||||
/* The status of the partition. (???) */
|
||||
grub_uint32_t status;
|
||||
|
||||
/* The first block on which the bootcode can be found. */
|
||||
grub_uint32_t bootcode_pos;
|
||||
|
||||
/* The size of the bootcode in bytes. */
|
||||
grub_uint32_t bootcode_size;
|
||||
|
||||
/* The load address of the bootcode. */
|
||||
grub_uint32_t bootcode_loadaddr;
|
||||
|
||||
/* Reserved. */
|
||||
grub_uint32_t reserved2;
|
||||
|
||||
/* The entrypoint of the bootcode. */
|
||||
grub_uint32_t bootcode_entrypoint;
|
||||
|
||||
/* Reserved. */
|
||||
grub_uint32_t reserved3;
|
||||
|
||||
/* A checksum of the bootcode. */
|
||||
grub_uint32_t bootcode_checksum;
|
||||
|
||||
/* The processor type. */
|
||||
char processor[16];
|
||||
|
||||
/* Padding. */
|
||||
grub_uint16_t pad[187];
|
||||
};
|
||||
|
||||
/* Partition description. */
|
||||
struct grub_partition
|
||||
{
|
||||
/* The start sector. */
|
||||
unsigned long start;
|
||||
|
||||
/* The length in sector units. */
|
||||
unsigned long len;
|
||||
|
||||
/* The offset of the partition table. */
|
||||
unsigned long offset;
|
||||
|
||||
/* The index of this partition in the partition table. */
|
||||
int index;
|
||||
|
||||
/* The DOS partition number. */
|
||||
int dos_part;
|
||||
|
||||
/* The BSD partition number (a == 0). */
|
||||
int bsd_part;
|
||||
|
||||
/* The DOS partition type. */
|
||||
int dos_type;
|
||||
|
||||
/* The BSD partition type. */
|
||||
int bsd_type;
|
||||
};
|
||||
typedef struct grub_partition *grub_partition_t;
|
||||
|
||||
struct grub_disk;
|
||||
|
||||
grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk,
|
||||
const char *str);
|
||||
grub_err_t EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk,
|
||||
int (*hook) (const grub_partition_t partition));
|
||||
char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
|
||||
|
||||
|
||||
static inline unsigned long
|
||||
grub_partition_get_start (const grub_partition_t p)
|
||||
{
|
||||
return p->start;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
grub_partition_get_len (const grub_partition_t p)
|
||||
{
|
||||
return p->len;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_PARTITION_HEADER */
|
|
@ -21,7 +21,7 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/machine/partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/machine/time.h>
|
||||
#include <grub/file.h>
|
||||
|
|
95
kern/partition.c
Normal file
95
kern/partition.c
Normal file
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 GRUB; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <grub/partition.h>
|
||||
#include <grub/disk.h>
|
||||
|
||||
static grub_partition_map_t grub_partition_map_list;
|
||||
|
||||
void
|
||||
grub_partition_map_register (grub_partition_map_t partmap)
|
||||
{
|
||||
partmap->next = grub_partition_map_list;
|
||||
grub_partition_map_list = partmap;
|
||||
}
|
||||
|
||||
void
|
||||
grub_partition_map_unregister (grub_partition_map_t partmap)
|
||||
{
|
||||
grub_partition_map_t *p, q;
|
||||
|
||||
for (p = &grub_partition_map_list, q = *p; q; p = &(q->next), q = q->next)
|
||||
if (q == partmap)
|
||||
{
|
||||
*p = q->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
grub_partition_map_iterate (int (*hook) (const grub_partition_map_t partmap))
|
||||
{
|
||||
grub_partition_map_t p;
|
||||
|
||||
for (p = grub_partition_map_list; p; p = p->next)
|
||||
if (hook (p))
|
||||
break;
|
||||
}
|
||||
|
||||
grub_partition_t
|
||||
grub_partition_probe (struct grub_disk *disk, const char *str)
|
||||
{
|
||||
grub_partition_t part;
|
||||
|
||||
auto int part_map_probe (const grub_partition_map_t partmap);
|
||||
|
||||
int part_map_probe (const grub_partition_map_t partmap)
|
||||
{
|
||||
part = partmap->probe (disk, str);
|
||||
if (part)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Use the first partition map type found. */
|
||||
grub_partition_map_iterate (part_map_probe);
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_partition_iterate (struct grub_disk *disk,
|
||||
int (*hook) (const grub_partition_t partition))
|
||||
{
|
||||
auto int part_map_iterate (const grub_partition_map_t partmap);
|
||||
|
||||
int part_map_iterate (const grub_partition_map_t partmap)
|
||||
{
|
||||
return partmap->iterate (disk, hook);
|
||||
}
|
||||
|
||||
grub_partition_map_iterate (part_map_iterate);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
char *
|
||||
grub_partition_get_name (const grub_partition_t partition)
|
||||
{
|
||||
return partition->partmap->get_name (partition);
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/machine/partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/machine/ieee1275.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/fs.h>
|
||||
|
@ -78,6 +78,9 @@ grub_machine_init (void)
|
|||
grub_boot_init ();
|
||||
grub_linux_init ();
|
||||
grub_linux_normal_init ();
|
||||
grub_pc_partition_map_init ();
|
||||
grub_amiga_partition_map_init ();
|
||||
grub_apple_partition_map_init ();
|
||||
grub_ofdisk_init ();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/loader.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/machine/partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/env.h>
|
||||
|
||||
#define GRUB_RESCUE_BUF_SIZE 256
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/machine/init.h>
|
||||
#include <grub/machine/partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/rescue.h>
|
||||
#include <grub/dl.h>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/machine/partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/env.h>
|
||||
|
|
229
partmap/amiga.c
Normal file
229
partmap/amiga.c
Normal file
|
@ -0,0 +1,229 @@
|
|||
/* amiga.c - Read amiga partition tables (RDB). */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <grub/disk.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
struct grub_amiga_rdsk
|
||||
{
|
||||
/* "RDSK". */
|
||||
grub_uint8_t magic[4];
|
||||
grub_uint32_t size;
|
||||
grub_int32_t checksum;
|
||||
grub_uint32_t scsihost;
|
||||
grub_uint32_t blksz;
|
||||
grub_uint32_t flags;
|
||||
grub_uint32_t badblcklst;
|
||||
grub_uint32_t partitionlst;
|
||||
grub_uint32_t fslst;
|
||||
|
||||
/* The other information is not important for us. */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_amiga_partition
|
||||
{
|
||||
/* "PART". */
|
||||
grub_uint8_t magic[4];
|
||||
grub_int32_t size;
|
||||
grub_int32_t checksum;
|
||||
grub_uint32_t scsihost;
|
||||
grub_uint32_t next;
|
||||
grub_uint32_t flags;
|
||||
grub_uint32_t unused1[2];
|
||||
grub_uint32_t devflags;
|
||||
grub_uint8_t namelen;
|
||||
grub_uint8_t name[31];
|
||||
grub_uint32_t unused2[15];
|
||||
|
||||
grub_uint32_t unused3[3];
|
||||
grub_uint32_t heads;
|
||||
grub_uint32_t unused4;
|
||||
grub_uint32_t block_per_track;
|
||||
grub_uint32_t unused5[3];
|
||||
grub_uint32_t lowcyl;
|
||||
grub_uint32_t highcyl;
|
||||
|
||||
grub_uint32_t firstcyl;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
static struct grub_partition_map grub_amiga_partition_map;
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
static grub_dl_t my_mod;
|
||||
#endif
|
||||
|
||||
static grub_err_t
|
||||
amiga_partition_map_iterate (grub_disk_t disk,
|
||||
int (*hook) (const grub_partition_t partition))
|
||||
{
|
||||
struct grub_partition part;
|
||||
struct grub_amiga_rdsk rdsk;
|
||||
struct grub_disk raw;
|
||||
int partno = 0;
|
||||
int next = -1;
|
||||
int pos;
|
||||
|
||||
/* Enforce raw disk access. */
|
||||
raw = *disk;
|
||||
raw.partition = 0;
|
||||
|
||||
/* The RDSK block is one of the first 15 blocks. */
|
||||
for (pos = 0; pos < 15; pos++)
|
||||
{
|
||||
/* Read the RDSK block which is a descriptor for the entire disk. */
|
||||
if (grub_disk_read (&raw, pos, 0,
|
||||
sizeof (rdsk), (char *) &rdsk))
|
||||
return grub_errno;
|
||||
|
||||
if (!grub_strcmp (rdsk.magic, "RDSK"))
|
||||
{
|
||||
/* Found the first PART block. */
|
||||
next = grub_be_to_cpu32 (rdsk.partitionlst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The end of the partition list is marked using "-1". */
|
||||
while (next != -1)
|
||||
{
|
||||
struct grub_amiga_partition apart;
|
||||
|
||||
/* Read the RDSK block which is a descriptor for the entire disk. */
|
||||
if (grub_disk_read (&raw, next, 0,
|
||||
sizeof (apart), (char *) &apart))
|
||||
return grub_errno;
|
||||
|
||||
/* Calculate the first block and the size of the partition. */
|
||||
part.start = (grub_be_to_cpu32 (apart.lowcyl)
|
||||
* grub_be_to_cpu32 (apart.heads)
|
||||
* grub_be_to_cpu32 (apart.block_per_track));
|
||||
part.len = ((grub_be_to_cpu32 (apart.highcyl)
|
||||
- grub_be_to_cpu32 (apart.lowcyl) + 1)
|
||||
* grub_be_to_cpu32 (apart.heads)
|
||||
* grub_be_to_cpu32 (apart.block_per_track));
|
||||
|
||||
part.offset = next * 512;
|
||||
part.index = partno;
|
||||
part.partmap = &grub_amiga_partition_map;
|
||||
|
||||
if (hook (&part))
|
||||
return grub_errno;
|
||||
|
||||
next = grub_be_to_cpu32 (apart.next);
|
||||
partno++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static grub_partition_t
|
||||
amiga_partition_map_probe (grub_disk_t disk, const char *str)
|
||||
{
|
||||
grub_partition_t p = 0;
|
||||
int partnum = 0;
|
||||
char *s = (char *) str;
|
||||
|
||||
auto int find_func (const grub_partition_t partition);
|
||||
|
||||
int find_func (const grub_partition_t partition)
|
||||
{
|
||||
if (partnum == partition->index)
|
||||
{
|
||||
p = (grub_partition_t) grub_malloc (sizeof (*p));
|
||||
if (! p)
|
||||
return 1;
|
||||
|
||||
grub_memcpy (p, partition, sizeof (*p));
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get the partition number. */
|
||||
partnum = grub_strtoul (s, 0, 10);
|
||||
if (grub_errno)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (amiga_partition_map_iterate (disk, find_func))
|
||||
goto fail;
|
||||
|
||||
return p;
|
||||
|
||||
fail:
|
||||
grub_free (p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
amiga_partition_map_get_name (const grub_partition_t p)
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = grub_malloc (13);
|
||||
if (! name)
|
||||
return 0;
|
||||
|
||||
grub_sprintf (name, "%d", p->index);
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/* Partition map type. */
|
||||
static struct grub_partition_map grub_amiga_partition_map =
|
||||
{
|
||||
.name = "amiga_partition_map",
|
||||
.iterate = amiga_partition_map_iterate,
|
||||
.probe = amiga_partition_map_probe,
|
||||
.get_name = amiga_partition_map_get_name
|
||||
};
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
void
|
||||
grub_amiga_partition_map_init (void)
|
||||
{
|
||||
grub_partition_map_register (&grub_amiga_partition_map);
|
||||
}
|
||||
|
||||
void
|
||||
grub_amiga_partition_map_fini (void)
|
||||
{
|
||||
grub_partition_map_unregister (&grub_amiga_partition_map);
|
||||
}
|
||||
#else
|
||||
GRUB_MOD_INIT
|
||||
{
|
||||
grub_partition_map_register (&grub_amiga_partition_map);
|
||||
my_mod = mod;
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI
|
||||
{
|
||||
grub_partition_map_unregister (&grub_amiga_partition_map);
|
||||
}
|
||||
#endif
|
231
partmap/apple.c
Normal file
231
partmap/apple.c
Normal file
|
@ -0,0 +1,231 @@
|
|||
/* apple.c - Read macintosh partition tables. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <grub/disk.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/partition.h>
|
||||
|
||||
#define GRUB_APPLE_PART_MAGIC 0x504D
|
||||
|
||||
struct grub_apple_part
|
||||
{
|
||||
/* The magic number to idenify this as a partition, it should have
|
||||
the value `0x504D'. */
|
||||
grub_uint16_t magic;
|
||||
|
||||
/* Reserved. */
|
||||
grub_uint16_t reserved;
|
||||
|
||||
/* The size of the partition map in blocks. */
|
||||
grub_uint32_t partmap_size;
|
||||
|
||||
/* The first physical block of the partition. */
|
||||
grub_uint32_t first_phys_block;
|
||||
|
||||
/* The amount of blocks. */
|
||||
grub_uint32_t blockcnt;
|
||||
|
||||
/* The partition name. */
|
||||
char partname[32];
|
||||
|
||||
/* The partition type. */
|
||||
char parttype[32];
|
||||
|
||||
/* The first datablock of the partition. */
|
||||
grub_uint32_t datablocks_first;
|
||||
|
||||
/* The amount datablocks. */
|
||||
grub_uint32_t datablocks_count;
|
||||
|
||||
/* The status of the partition. (???) */
|
||||
grub_uint32_t status;
|
||||
|
||||
/* The first block on which the bootcode can be found. */
|
||||
grub_uint32_t bootcode_pos;
|
||||
|
||||
/* The size of the bootcode in bytes. */
|
||||
grub_uint32_t bootcode_size;
|
||||
|
||||
/* The load address of the bootcode. */
|
||||
grub_uint32_t bootcode_loadaddr;
|
||||
|
||||
/* Reserved. */
|
||||
grub_uint32_t reserved2;
|
||||
|
||||
/* The entrypoint of the bootcode. */
|
||||
grub_uint32_t bootcode_entrypoint;
|
||||
|
||||
/* Reserved. */
|
||||
grub_uint32_t reserved3;
|
||||
|
||||
/* A checksum of the bootcode. */
|
||||
grub_uint32_t bootcode_checksum;
|
||||
|
||||
/* The processor type. */
|
||||
char processor[16];
|
||||
|
||||
/* Padding. */
|
||||
grub_uint16_t pad[187];
|
||||
};
|
||||
|
||||
static struct grub_partition_map grub_apple_partition_map;
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
static grub_dl_t my_mod;
|
||||
#endif
|
||||
|
||||
|
||||
static grub_err_t
|
||||
apple_partition_map_iterate (grub_disk_t disk,
|
||||
int (*hook) (const grub_partition_t partition))
|
||||
{
|
||||
struct grub_partition part;
|
||||
struct grub_apple_part apart;
|
||||
struct grub_disk raw;
|
||||
int partno = 0;
|
||||
int pos = GRUB_DISK_SECTOR_SIZE;
|
||||
|
||||
/* Enforce raw disk access. */
|
||||
raw = *disk;
|
||||
raw.partition = 0;
|
||||
|
||||
part.partmap = &grub_apple_partition_map;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (grub_disk_read (&raw, pos / GRUB_DISK_SECTOR_SIZE,
|
||||
pos % GRUB_DISK_SECTOR_SIZE,
|
||||
sizeof (struct grub_apple_part), (char *) &apart))
|
||||
return grub_errno;
|
||||
|
||||
if (apart.magic != GRUB_APPLE_PART_MAGIC)
|
||||
break;
|
||||
|
||||
part.start = apart.first_phys_block;
|
||||
part.len = apart.blockcnt;
|
||||
part.offset = pos;
|
||||
part.index = partno;
|
||||
|
||||
if (hook (&part))
|
||||
return grub_errno;
|
||||
|
||||
if (apart.first_phys_block == GRUB_DISK_SECTOR_SIZE * 2)
|
||||
return 0;
|
||||
|
||||
pos += sizeof (struct grub_apple_part);
|
||||
partno++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static grub_partition_t
|
||||
apple_partition_map_probe (grub_disk_t disk, const char *str)
|
||||
{
|
||||
grub_partition_t p = 0;
|
||||
int partnum = 0;
|
||||
char *s = (char *) str;
|
||||
|
||||
auto int find_func (const grub_partition_t partition);
|
||||
|
||||
int find_func (const grub_partition_t partition)
|
||||
{
|
||||
if (partnum == partition->index)
|
||||
{
|
||||
p = (grub_partition_t) grub_malloc (sizeof (*p));
|
||||
if (! p)
|
||||
return 1;
|
||||
|
||||
grub_memcpy (p, partition, sizeof (*p));
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get the partition number. */
|
||||
partnum = grub_strtoul (s, 0, 10);
|
||||
if (grub_errno)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (apple_partition_map_iterate (disk, find_func))
|
||||
goto fail;
|
||||
|
||||
return p;
|
||||
|
||||
fail:
|
||||
grub_free (p);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
apple_partition_map_get_name (const grub_partition_t p)
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = grub_malloc (13);
|
||||
if (! name)
|
||||
return 0;
|
||||
|
||||
grub_sprintf (name, "%d", p->index);
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/* Partition map type. */
|
||||
static struct grub_partition_map grub_apple_partition_map =
|
||||
{
|
||||
.name = "apple_partition_map",
|
||||
.iterate = apple_partition_map_iterate,
|
||||
.probe = apple_partition_map_probe,
|
||||
.get_name = apple_partition_map_get_name
|
||||
};
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
void
|
||||
grub_apple_partition_map_init (void)
|
||||
{
|
||||
grub_partition_map_register (&grub_apple_partition_map);
|
||||
}
|
||||
|
||||
void
|
||||
grub_apple_partition_map_fini (void)
|
||||
{
|
||||
grub_partition_map_unregister (&grub_apple_partition_map);
|
||||
}
|
||||
#else
|
||||
GRUB_MOD_INIT
|
||||
{
|
||||
grub_partition_map_register (&grub_apple_partition_map);
|
||||
my_mod = mod;
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI
|
||||
{
|
||||
grub_partition_map_unregister (&grub_apple_partition_map);
|
||||
}
|
||||
#endif
|
|
@ -1,6 +1,7 @@
|
|||
/* pc.c - Read PC style partition tables. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,32 +18,50 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <grub/machine/partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
static struct grub_partition_map grub_pc_partition_map;
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
static grub_dl_t my_mod;
|
||||
#endif
|
||||
|
||||
|
||||
/* Parse the partition representation in STR and return a partition. */
|
||||
static grub_partition_t
|
||||
grub_partition_parse (const char *str)
|
||||
{
|
||||
grub_partition_t p;
|
||||
struct grub_pc_partition *pcdata;
|
||||
|
||||
char *s = (char *) str;
|
||||
|
||||
p = (grub_partition_t) grub_malloc (sizeof (*p));
|
||||
if (! p)
|
||||
return 0;
|
||||
|
||||
|
||||
pcdata = (struct grub_pc_partition *) grub_malloc (sizeof (*pcdata));
|
||||
if (! pcdata)
|
||||
goto fail;
|
||||
|
||||
p->data = pcdata;
|
||||
p->partmap = &grub_pc_partition_map;
|
||||
|
||||
/* Initialize some of the fields with invalid values. */
|
||||
p->bsd_part = p->dos_type = p->bsd_type = p->index = -1;
|
||||
pcdata->bsd_part = pcdata->dos_type = pcdata->bsd_type = p->index = -1;
|
||||
|
||||
/* Get the DOS partition number. */
|
||||
p->dos_part = grub_strtoul (s, &s, 0);
|
||||
pcdata->dos_part = grub_strtoul (s, &s, 0);
|
||||
|
||||
if (grub_errno)
|
||||
{
|
||||
/* Not found. Maybe only a BSD label is specified. */
|
||||
p->dos_part = -1;
|
||||
pcdata->dos_part = -1;
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
else if (*s == ',')
|
||||
|
@ -52,7 +71,7 @@ grub_partition_parse (const char *str)
|
|||
{
|
||||
if (*s >= 'a' && *s <= 'h')
|
||||
{
|
||||
p->bsd_part = *s - 'a';
|
||||
pcdata->bsd_part = *s - 'a';
|
||||
s++;
|
||||
}
|
||||
|
||||
|
@ -60,24 +79,26 @@ grub_partition_parse (const char *str)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (p->dos_part == -1 && p->bsd_part == -1)
|
||||
if (pcdata->dos_part == -1 && pcdata->bsd_part == -1)
|
||||
goto fail;
|
||||
|
||||
return p;
|
||||
|
||||
fail:
|
||||
grub_free (p);
|
||||
grub_free (pcdata);
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition");
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_partition_iterate (grub_disk_t disk,
|
||||
int (*hook) (const grub_partition_t partition))
|
||||
static grub_err_t
|
||||
pc_partition_map_iterate (grub_disk_t disk,
|
||||
int (*hook) (const grub_partition_t partition))
|
||||
{
|
||||
struct grub_partition p;
|
||||
struct grub_partition_mbr mbr;
|
||||
struct grub_partition_disk_label label;
|
||||
struct grub_pc_partition pcdata;
|
||||
struct grub_pc_partition_mbr mbr;
|
||||
struct grub_pc_partition_disk_label label;
|
||||
struct grub_disk raw;
|
||||
|
||||
/* Enforce raw disk access. */
|
||||
|
@ -85,20 +106,22 @@ grub_partition_iterate (grub_disk_t disk,
|
|||
raw.partition = 0;
|
||||
|
||||
p.offset = 0;
|
||||
p.ext_offset = 0;
|
||||
p.dos_part = -1;
|
||||
pcdata.ext_offset = 0;
|
||||
pcdata.dos_part = -1;
|
||||
p.data = &pcdata;
|
||||
p.partmap = &grub_pc_partition_map;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int i;
|
||||
struct grub_partition_entry *e;
|
||||
struct grub_pc_partition_entry *e;
|
||||
|
||||
/* Read the MBR. */
|
||||
if (grub_disk_read (&raw, p.offset, 0, sizeof (mbr), (char *) &mbr))
|
||||
goto finish;
|
||||
|
||||
/* Check if it is valid. */
|
||||
if (mbr.signature != grub_cpu_to_le16 (GRUB_PARTITION_SIGNATURE))
|
||||
if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
|
||||
|
||||
/* Analyze DOS partitions. */
|
||||
|
@ -108,31 +131,31 @@ grub_partition_iterate (grub_disk_t disk,
|
|||
|
||||
p.start = p.offset + grub_le_to_cpu32 (e->start);
|
||||
p.len = grub_le_to_cpu32 (e->length);
|
||||
p.bsd_part = -1;
|
||||
p.dos_type = e->type;
|
||||
p.bsd_type = -1;
|
||||
pcdata.bsd_part = -1;
|
||||
pcdata.dos_type = e->type;
|
||||
pcdata.bsd_type = -1;
|
||||
|
||||
/* If this partition is a normal one, call the hook. */
|
||||
if (! grub_partition_is_empty (e->type)
|
||||
&& ! grub_partition_is_extended (e->type))
|
||||
if (! grub_pc_partition_is_empty (e->type)
|
||||
&& ! grub_pc_partition_is_extended (e->type))
|
||||
{
|
||||
p.dos_part++;
|
||||
pcdata.dos_part++;
|
||||
|
||||
if (hook (&p))
|
||||
goto finish;
|
||||
|
||||
/* Check if this is a BSD partition. */
|
||||
if (grub_partition_is_bsd (e->type))
|
||||
if (grub_pc_partition_is_bsd (e->type))
|
||||
{
|
||||
/* Check if the BSD label is within the DOS partition. */
|
||||
if (p.len <= GRUB_PARTITION_BSD_LABEL_SECTOR)
|
||||
if (p.len <= GRUB_PC_PARTITION_BSD_LABEL_SECTOR)
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE,
|
||||
"no space for disk label");
|
||||
|
||||
/* Read the BSD label. */
|
||||
if (grub_disk_read (&raw,
|
||||
(p.start
|
||||
+ GRUB_PARTITION_BSD_LABEL_SECTOR),
|
||||
+ GRUB_PC_PARTITION_BSD_LABEL_SECTOR),
|
||||
0,
|
||||
sizeof (label),
|
||||
(char *) &label))
|
||||
|
@ -140,31 +163,31 @@ grub_partition_iterate (grub_disk_t disk,
|
|||
|
||||
/* Check if it is valid. */
|
||||
if (label.magic
|
||||
!= grub_cpu_to_le32 (GRUB_PARTITION_BSD_LABEL_MAGIC))
|
||||
!= grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE,
|
||||
"invalid disk label magic");
|
||||
|
||||
for (p.bsd_part = 0;
|
||||
p.bsd_part < grub_cpu_to_le16 (label.num_partitions);
|
||||
p.bsd_part++)
|
||||
for (pcdata.bsd_part = 0;
|
||||
pcdata.bsd_part < grub_cpu_to_le16 (label.num_partitions);
|
||||
pcdata.bsd_part++)
|
||||
{
|
||||
struct grub_partition_bsd_entry *be
|
||||
= label.entries + p.bsd_part;
|
||||
struct grub_pc_partition_bsd_entry *be
|
||||
= label.entries + pcdata.bsd_part;
|
||||
|
||||
p.start = grub_le_to_cpu32 (be->offset);
|
||||
p.len = grub_le_to_cpu32 (be->size);
|
||||
p.bsd_type = be->fs_type;
|
||||
pcdata.bsd_type = be->fs_type;
|
||||
|
||||
if (be->fs_type != GRUB_PARTITION_BSD_TYPE_UNUSED)
|
||||
if (be->fs_type != GRUB_PC_PARTITION_BSD_TYPE_UNUSED)
|
||||
if (hook (&p))
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (p.dos_part < 4)
|
||||
else if (pcdata.dos_part < 4)
|
||||
/* If this partition is a logical one, shouldn't increase the
|
||||
partition number. */
|
||||
p.dos_part++;
|
||||
pcdata.dos_part++;
|
||||
}
|
||||
|
||||
/* Find an extended partition. */
|
||||
|
@ -172,11 +195,11 @@ grub_partition_iterate (grub_disk_t disk,
|
|||
{
|
||||
e = mbr.entries + i;
|
||||
|
||||
if (grub_partition_is_extended (e->type))
|
||||
if (grub_pc_partition_is_extended (e->type))
|
||||
{
|
||||
p.offset = p.ext_offset + grub_le_to_cpu32 (e->start);
|
||||
if (! p.ext_offset)
|
||||
p.ext_offset = p.offset;
|
||||
p.offset = pcdata.ext_offset + grub_le_to_cpu32 (e->start);
|
||||
if (! pcdata.ext_offset)
|
||||
pcdata.ext_offset = p.offset;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -191,18 +214,23 @@ grub_partition_iterate (grub_disk_t disk,
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_partition_t
|
||||
grub_partition_probe (grub_disk_t disk, const char *str)
|
||||
|
||||
static grub_partition_t
|
||||
pc_partition_map_probe (grub_disk_t disk, const char *str)
|
||||
{
|
||||
grub_partition_t p;
|
||||
struct grub_pc_partition *pcdata;
|
||||
|
||||
auto int find_func (const grub_partition_t partition);
|
||||
|
||||
int find_func (const grub_partition_t partition)
|
||||
{
|
||||
if ((p->dos_part == partition->dos_part || p->dos_part == -1)
|
||||
&& p->bsd_part == partition->bsd_part)
|
||||
struct grub_pc_partition *partdata = partition->data;
|
||||
if ((pcdata->dos_part == partdata->dos_part || pcdata->dos_part == -1)
|
||||
&& pcdata->bsd_part == partdata->bsd_part)
|
||||
{
|
||||
grub_memcpy (p, partition, sizeof (*p));
|
||||
grub_memcpy (pcdata, partdata, sizeof (*pcdata));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -212,9 +240,9 @@ grub_partition_probe (grub_disk_t disk, const char *str)
|
|||
p = grub_partition_parse (str);
|
||||
if (! p)
|
||||
return 0;
|
||||
|
||||
|
||||
if (grub_partition_iterate (disk, find_func))
|
||||
|
||||
pcdata = p->data;
|
||||
if (pc_partition_map_iterate (disk, find_func))
|
||||
goto fail;
|
||||
|
||||
if (p->index < 0)
|
||||
|
@ -227,22 +255,60 @@ grub_partition_probe (grub_disk_t disk, const char *str)
|
|||
|
||||
fail:
|
||||
grub_free (p);
|
||||
grub_free (pcdata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
grub_partition_get_name (const grub_partition_t p)
|
||||
|
||||
static char *
|
||||
pc_partition_map_get_name (const grub_partition_t p)
|
||||
{
|
||||
char *name;
|
||||
|
||||
struct grub_pc_partition *pcdata = p->data;
|
||||
|
||||
name = grub_malloc (13);
|
||||
if (! name)
|
||||
return 0;
|
||||
|
||||
if (p->bsd_part < 0)
|
||||
grub_sprintf (name, "%d", p->dos_part);
|
||||
if (pcdata->bsd_part < 0)
|
||||
grub_sprintf (name, "%d", pcdata->dos_part);
|
||||
else
|
||||
grub_sprintf (name, "%d,%c", p->dos_part, p->bsd_part + 'a');
|
||||
grub_sprintf (name, "%d,%c", pcdata->dos_part, pcdata->bsd_part + 'a');
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/* Partition map type. */
|
||||
static struct grub_partition_map grub_pc_partition_map =
|
||||
{
|
||||
.name = "pc_partition_map",
|
||||
.iterate = pc_partition_map_iterate,
|
||||
.probe = pc_partition_map_probe,
|
||||
.get_name = pc_partition_map_get_name
|
||||
};
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
void
|
||||
grub_pc_partition_map_init (void)
|
||||
{
|
||||
grub_partition_map_register (&grub_pc_partition_map);
|
||||
}
|
||||
|
||||
void
|
||||
grub_pc_partition_map_fini (void)
|
||||
{
|
||||
grub_partition_map_unregister (&grub_pc_partition_map);
|
||||
}
|
||||
#else
|
||||
GRUB_MOD_INIT
|
||||
{
|
||||
grub_partition_map_register (&grub_pc_partition_map);
|
||||
my_mod = mod;
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI
|
||||
{
|
||||
grub_partition_map_unregister (&grub_pc_partition_map);
|
||||
}
|
||||
#endif
|
|
@ -34,6 +34,7 @@
|
|||
#include <grub/normal.h>
|
||||
#include <grub/util/getroot.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/partition.h>
|
||||
|
||||
#ifdef __NetBSD__
|
||||
/* NetBSD uses /boot for its boot block. */
|
||||
|
@ -154,6 +155,9 @@ main (int argc, char *argv[])
|
|||
|
||||
/* XXX: This is a bit unportable. */
|
||||
grub_util_biosdisk_init (args.dev_map);
|
||||
grub_pc_partition_map_init ();
|
||||
grub_amiga_partition_map_init ();
|
||||
grub_apple_partition_map_init ();
|
||||
|
||||
/* Initialize the default modules. */
|
||||
grub_iso9660_init ();
|
||||
|
@ -187,6 +191,9 @@ main (int argc, char *argv[])
|
|||
grub_cmp_fini ();
|
||||
grub_cat_fini ();
|
||||
grub_terminal_fini ();
|
||||
|
||||
grub_amiga_partition_map_fini ();
|
||||
grub_pc_partition_map_fini ();
|
||||
grub_apple_partition_map_fini ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
#include <grub/machine/biosdisk.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/machine/partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/util/misc.h>
|
||||
|
@ -736,18 +737,34 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
|
||||
int find_partition (const grub_partition_t partition)
|
||||
{
|
||||
if (partition->bsd_part < 0)
|
||||
grub_util_info ("DOS partition %d starts from %lu",
|
||||
partition->dos_part, partition->start);
|
||||
else
|
||||
grub_util_info ("BSD partition %d,%c starts from %lu",
|
||||
partition->dos_part, partition->bsd_part + 'a',
|
||||
partition->start);
|
||||
struct grub_pc_partition *pcdata = 0;
|
||||
|
||||
if (!strcmp (partition->partmap->name, "pc"))
|
||||
pcdata = partition->data;
|
||||
|
||||
if (pcdata)
|
||||
{
|
||||
if (pcdata->bsd_part < 0)
|
||||
grub_util_info ("DOS partition %d starts from %lu",
|
||||
pcdata->dos_part, partition->start);
|
||||
else
|
||||
grub_util_info ("BSD partition %d,%c starts from %lu",
|
||||
pcdata->dos_part, pcdata->bsd_part + 'a',
|
||||
partition->start);
|
||||
}
|
||||
|
||||
if (hdg.start == partition->start)
|
||||
{
|
||||
dos_part = partition->dos_part;
|
||||
bsd_part = partition->bsd_part;
|
||||
if (pcdata)
|
||||
{
|
||||
dos_part = pcdata->dos_part;
|
||||
bsd_part = pcdata->bsd_part;
|
||||
}
|
||||
else
|
||||
{
|
||||
dos_part = 0;
|
||||
bsd_part = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/fs.h>
|
||||
#include <grub/machine/partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/machine/util/biosdisk.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
|
@ -107,8 +108,10 @@ setup (const char *prefix, const char *dir,
|
|||
|
||||
int find_first_partition_start (const grub_partition_t p)
|
||||
{
|
||||
if (! grub_partition_is_empty (p->dos_type)
|
||||
&& ! grub_partition_is_bsd (p->dos_type)
|
||||
struct grub_pc_partition *pcdata = p->data;
|
||||
|
||||
if (! grub_pc_partition_is_empty (pcdata->dos_type)
|
||||
&& ! grub_pc_partition_is_bsd (pcdata->dos_type)
|
||||
&& first_start > p->start)
|
||||
first_start = p->start;
|
||||
|
||||
|
@ -252,10 +255,16 @@ setup (const char *prefix, const char *dir,
|
|||
/* Embed information about the installed location. */
|
||||
if (root_dev->disk->partition)
|
||||
{
|
||||
struct grub_pc_partition *pcdata =
|
||||
root_dev->disk->partition->data;
|
||||
|
||||
if (strcmp (root_dev->disk->partition->partmap->name, "pc"))
|
||||
grub_util_error ("No PC style partitions found");
|
||||
|
||||
*install_dos_part
|
||||
= grub_cpu_to_le32 (root_dev->disk->partition->dos_part);
|
||||
= grub_cpu_to_le32 (pcdata->dos_part);
|
||||
*install_bsd_part
|
||||
= grub_cpu_to_le32 (root_dev->disk->partition->bsd_part);
|
||||
= grub_cpu_to_le32 (pcdata->bsd_part);
|
||||
}
|
||||
else
|
||||
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1);
|
||||
|
@ -400,10 +409,16 @@ setup (const char *prefix, const char *dir,
|
|||
/* Embed information about the installed location. */
|
||||
if (root_dev->disk->partition)
|
||||
{
|
||||
struct grub_pc_partition *pcdata =
|
||||
root_dev->disk->partition->data;
|
||||
|
||||
if (strcmp (root_dev->disk->partition->partmap->name, "pc"))
|
||||
grub_util_error ("No PC style partitions found");
|
||||
|
||||
*install_dos_part
|
||||
= grub_cpu_to_le32 (root_dev->disk->partition->dos_part);
|
||||
= grub_cpu_to_le32 (pcdata->dos_part);
|
||||
*install_bsd_part
|
||||
= grub_cpu_to_le32 (root_dev->disk->partition->bsd_part);
|
||||
= grub_cpu_to_le32 (pcdata->bsd_part);
|
||||
}
|
||||
else
|
||||
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1);
|
||||
|
|
Loading…
Reference in a new issue