split tar & cpio
PATCH 1/1 split tar & cpio
Hi,
I thought it would be a good idea to split tar & cpio into separate modules to save some space and make things easier to figure out for the users. I managed to do this without duplicating code, with a bit of pre-processor magic.
The saved size is not much, though (~400 bytes). But users looking for tar will find it more easily. How do you feel about this? Is it worth it?
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."
common.rmk +9 -4
@@ -17,7 +17,7 @@ grub_probe_SOURCES = util/grub-probe.c \ fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/xfs.c fs/afs.c \ + fs/ufs.c fs/xfs.c fs/afs.c fs/tar.c \ \ partmap/pc.c partmap/apple.c partmap/gpt.c \ kern/fs.c kern/env.c fs/fshelp.c \
@@ -37,7 +37,7 @@ grub_fstest_SOURCES = util/grub-fstest.c fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/xfs.c fs/afs.c \ + fs/ufs.c fs/xfs.c fs/afs.c fs/tar.c \ \ kern/partition.c partmap/pc.c partmap/apple.c partmap/gpt.c \ kern/fs.c kern/env.c fs/fshelp.c disk/lvm.c disk/raid.c \
@@ -150,8 +150,8 @@ grub-mkconfig_DATA += util/grub.d/README # Filing systems. pkglib_MODULES += fshelp.mod fat.mod ufs.mod ext2.mod ntfs.mod \ ntfscomp.mod minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod \ - affs.mod sfs.mod hfsplus.mod reiserfs.mod cpio.mod udf.mod \ - afs.mod + affs.mod sfs.mod hfsplus.mod reiserfs.mod cpio.mod tar.mod \ + udf.mod afs.mod # For fshelp.mod. fshelp_mod_SOURCES = fs/fshelp.c
@@ -233,6 +233,11 @@ cpio_mod_SOURCES = fs/cpio.c cpio_mod_CFLAGS = $(COMMON_CFLAGS) cpio_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For tar.mod. +tar_mod_SOURCES = fs/cpio.c +tar_mod_CFLAGS = $(COMMON_CFLAGS) -DMODE_USTAR +tar_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For udf.mod. udf_mod_SOURCES = fs/udf.c udf_mod_CFLAGS = $(COMMON_CFLAGS)
i386-pc.rmk +2 -2
@@ -99,7 +99,7 @@ grub_setup_SOURCES = util/i386/pc/grub-s fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/xfs.c fs/afs.c \ + fs/ufs.c fs/xfs.c fs/afs.c fs/tar.c \ \ partmap/pc.c partmap/gpt.c \ \
@@ -136,7 +136,7 @@ grub_emu_SOURCES = commands/boot.c comma fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/xfs.c fs/afs.c \ + fs/ufs.c fs/xfs.c fs/afs.c fs/tar.c \ \ util/console.c util/hostfs.c util/grub-emu.c util/misc.c \ util/hostdisk.c util/getroot.c \
i386-efi.rmk +1 -1
@@ -43,7 +43,7 @@ grub_emu_SOURCES = commands/boot.c comma fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/xfs.c fs/afs.c \ + fs/ufs.c fs/xfs.c fs/afs.c fs/tar.c \ \ io/gzio.c \ kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
powerpc-ieee1275.rmk +1 -1
@@ -48,7 +48,7 @@ grub_emu_SOURCES = commands/boot.c comma fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/xfs.c fs/afs.c \ + fs/ufs.c fs/xfs.c fs/afs.c fs/tar.c \ \ io/gzio.c \ kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
i386-coreboot.rmk +1 -1
@@ -65,7 +65,7 @@ grub_emu_SOURCES = commands/boot.c comma fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/xfs.c fs/afs.c \ + fs/ufs.c fs/xfs.c fs/afs.c fs/tar.c \ \ fs/fshelp.c \ io/gzio.c \
i386-ieee1275.rmk +1 -1
@@ -63,7 +63,7 @@ grub_emu_SOURCES = commands/boot.c comma fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/xfs.c fs/afs.c \ + fs/ufs.c fs/xfs.c fs/afs.c fs/tar.c \ \ fs/fshelp.c \ io/gzio.c \
tar.c +2 -0
@@ -0,0 +1,2 @@ +#define MODE_USTAR 1 +#include "fs/cpio.c"
cpio.c +27 -20
119 lines not on this page · raw message
i386/pc/grub-mkrescue.in +1 -1
@@ -138,7 +138,7 @@ if [ "x${image_type}" = xfloppy -o "x${e # build core.img core_img=`mktemp` - ${grub_mkimage} -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk cpio + ${grub_mkimage} -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk tar rm -f ${memdisk_img} # build floppy image
Quoted 10 lines · Robert Millan
Hi,
I thought it would be a good idea to split tar & cpio into separate modules to save some space and make things easier to figure out for the users. I managed to do this without duplicating code, with a bit of pre-processor magic.
The saved size is not much, though (~400 bytes). But users looking for tar will find it more easily. How do you feel about this? Is it worth it?
Committed.
coreboot users: if you're using tar to generate GRUB's memdisk image, with latest svn you need to include tar.mod instead of cpio.mod.
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."