Skip to contentSkip to conversation

idea: adjust conf file layout

DISCUSSION Bean 3 participants 3 messages Apr 27, 2009 – May 3, 2009

lore
Share & tools
lore

Bean

author
#0 lore raw

Hi,

Currently, the organization of conf files are not optimal. There are a lot of duplication in *.rmk files. For example, i386-efi.rmk and x86_64-efi.rmk are basically the same, and grub-emu appears in every rmk, but there is only minor difference between each one. Also, related item are scattered around, which make it more likely for casual mistakes, like forgeting to add files in grub_emu_SOURCES, etc. Here are some of my thoughts:

1, Fine tune rmk layout
rmk are split into different blocks accordding to function, such as common, commands, fs and partmap. Each block consists of generic and platform dependent parts. For example, for i386-efi, the full set of makefiles to be included is:

common-i386-efi.rmk
common-efi.rmk
common-i386.rmk
common.rmk
commands-i386-efi.rmk
commands-efi.rmk
commands-i386.rmk
commands.rmk
fs-i386-efi.rmk
fs-efi.rmk
fs-i386.rmk
fs.rmk
partmap-i386-efi.rmk
partmap-efi.rmk
partmap-i386.rmk
partmap.rmk

Of course, not all of them needs to be present, we can use -include to add them to the main makefile.

2, Group related items together

For example, for the fat module, we could write it like this:

# For fat.mod.
fat_mod_SOURCES = fs/fat.c
fat_mod_CFLAGS = $(COMMON_CFLAGS)
fat_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += fat.mod
grub_probe_SOURCES += fs/fat.c
grub_fstest_SOURCES += fs/fat.c
grub_emu_SOURCES += fs/fat.c

Signature · 1 line
Bean
#1 lore raw
Quoted 8 lines · Bean

Hi,

Currently, the organization of conf files are not optimal. There are a lot of duplication in *.rmk files. For example, i386-efi.rmk and x86_64-efi.rmk are basically the same, and grub-emu appears in every rmk, but there is only minor difference between each one. Also, related item are scattered around, which make it more likely for casual mistakes, like forgeting to add files in grub_emu_SOURCES, etc.

Basically I agree that it should be reorganized but some remarks follow

Quoted 26 lines

Here are some of my thoughts:

1, Fine tune rmk layout
rmk are split into different blocks accordding to function, such as common, commands, fs and partmap. Each block consists of generic and platform dependent parts. For example, for i386-efi, the full set of makefiles to be included is:

common-i386-efi.rmk
common-efi.rmk
common-i386.rmk
common.rmk
commands-i386-efi.rmk
commands-efi.rmk
commands-i386.rmk
commands.rmk
fs-i386-efi.rmk
fs-efi.rmk
fs-i386.rmk
fs.rmk
partmap-i386-efi.rmk
partmap-efi.rmk
partmap-i386.rmk
partmap.rmk

Quoted 3 lines

Of course, not all of them needs to be present, we can use -include to add them to the main makefile.

I'm not sure that fine-graining is really necessary. Basically the most important point is to eliminate duplication and group related things together
However it's a good thing to have a separate efi.rmk and perhaps same applies to ieee1275.rmk

Quoted 5 lines

2, Group related items together

For example, for the fat module, we could write it like this:

Quoted 8 lines

# For fat.mod.
fat_mod_SOURCES = fs/fat.c
fat_mod_CFLAGS = $(COMMON_CFLAGS)
fat_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += fat.mod
grub_probe_SOURCES += fs/fat.c
grub_fstest_SOURCES += fs/fat.c
grub_emu_SOURCES += fs/fat.c

It's better to unify the last three into a variable FS_SOURCES which will be added to tools sources in corresponding files. This is useful because different platforms provide different set of tools

Quoted 11 lines

--
Bean

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#2 lore raw
In reply to Bean
Quoted 4 lines · Bean

2, Group related items together

For example, for the fat module, we could write it like this:

Quoted 8 lines

# For fat.mod.
fat_mod_SOURCES = fs/fat.c
fat_mod_CFLAGS = $(COMMON_CFLAGS)
fat_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += fat.mod
grub_probe_SOURCES += fs/fat.c
grub_fstest_SOURCES += fs/fat.c
grub_emu_SOURCES += fs/fat.c

Or even:

FILESYSTEMS = .... fs/fat.c ....
grub_emu_SOURCES = ... $(FILESYSTEMS) ...

but be careful when doing untested stuff with make variables, they're not parsed only by make, and the ruby scripts are quite picky in some things.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."