From feb52f8edbb54c785e902ef595a2fe0b0f0d7fd6 Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Tue, 10 Nov 2009 23:18:00 +0100 Subject: [PATCH] hdt: Generating gzipped content in binary images Impact: Reduces image size Floppies & ISO are now using gzipped content to reduce the size --- com32/hdt/Makefile | 29 ++++++++++++++++++----------- com32/hdt/floppy/hdt.cfg | 2 +- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile index b3eb88d..0d753a9 100644 --- a/com32/hdt/Makefile +++ b/com32/hdt/Makefile @@ -29,11 +29,14 @@ OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) KERNEL_VERSION ?= $(shell uname -r) MODULES_ALIAS_FILE ?= /lib/modules/$(KERNEL_VERSION)/modules.alias +GZ_MODULES_ALIAS_FILE ?= modules.alias.gz MODULES_PCIMAP_FILE ?= /lib/modules/$(KERNEL_VERSION)/modules.pcimap +GZ_MODULES_PCIMAP_FILE ?= modules.pcimap.gz ISO_DIR ?= iso ISOLINUX_DIR ?= isolinux FLOPPY_DIR ?= floppy PCI_IDS_FILE ?= $(PWD)/$(FLOPPY_DIR)/pci.ids +GZ_PCI_IDS_FILE ?= $(PCI_IDS_FILE).gz REBOOT_COM32 ?= $(com32)/modules/reboot.c32 all: $(MODULES) $(TESTFILES) @@ -43,15 +46,15 @@ hdt.elf : $(OBJS) $(LIBS) $(C_LIBS) hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtools/syslinux $(REBOOT_COM32) rm -f hdt.img - MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MFORMAT) -v HDT -f 2880 -C a: + MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MFORMAT) -v HDT -f 1440 -C a: $(topdir)/mtools/syslinux hdt.img - -[ ! -f $(PCI_IDS_FILE) ] && cp /usr/share/hwdata/pci.ids $(PCI_IDS_FILE) - -[ ! -f $(PCI_IDS_FILE) ] && cp /usr/share/pci.ids $(PCI_IDS_FILE) - -[ -f $(MODULES_ALIAS_FILE) ] && MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(MODULES_ALIAS_FILE) a: - -[ -f $(MODULES_PCIMAP_FILE) ] && MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(MODULES_PCIMAP_FILE) a: + -[ ! -f $(GZ_PCI_IDS_FILE) ] && cp /usr/share/hwdata/pci.ids $(PCI_IDS_FILE) && $(GZIPPROG) $(PCI_IDS_FILE) + -[ ! -f $(GZ_PCI_IDS_FILE) ] && cp /usr/share/pci.ids $(PCI_IDS_FILE) && $(GZIPPROG) $(PCI_IDS_FILE) + -[ -f $(MODULES_ALIAS_FILE) ] && cat $(MODULES_ALIAS_FILE) | $(GZIPPROG) - -f | MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) - a:$(GZ_MODULES_ALIAS_FILE) + -[ -f $(MODULES_PCIMAP_FILE) ] && cat $(MODULES_PCIMAP_FILE) | $(GZIPPROG) - -f | MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) - a:$(GZ_MODULES_PCIMAP_FILE) MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) hdt.c32 a: MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(REBOOT_COM32) a: - @ [ -f $(PCI_IDS_FILE) ] && MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(PCI_IDS_FILE) a: || printf "\nThe $(FLOPPY_DIR)/pci.ids file is missing and can be downloaded from http://pciids.sourceforge.net and put in\nthe ./com32/hdt/$(FLOPPY_DIR) directory of the extracted Syslinux source.\n\n" + @ [ -f $(GZ_PCI_IDS_FILE) ] && MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(GZ_PCI_IDS_FILE) a: || printf "\nThe $(GZ_PCI_IDS_FILE) file is missing and can be downloaded from http://pciids.sourceforge.net and gzipped in\nthe ./com32/hdt/$(FLOPPY_DIR) directory of the extracted Syslinux source.\n\n" MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(FLOPPY_DIR)/hdt.cfg a:syslinux.cfg hdt.img.gz: hdt.img @@ -66,11 +69,15 @@ hdt.iso: hdt.c32 $(topdir)/core/isolinux.bin $(FLOPPY_DIR)/hdt.cfg cp $(FLOPPY_DIR)/hdt.cfg $(ISO_DIR)/$(ISOLINUX_DIR)/isolinux.cfg cp hdt.c32 $(ISO_DIR)/$(ISOLINUX_DIR) cp $(REBOOT_COM32) $(ISO_DIR)/$(ISOLINUX_DIR) - -[ ! -f $(PCI_IDS_FILE) ] && cp /usr/share/hwdata/pci.ids $(PCI_IDS_FILE) - -[ ! -f $(PCI_IDS_FILE) ] && cp /usr/share/pci.ids $(PCI_IDS_FILE) - -[ -f $(MODULES_ALIAS_FILE) ] && cp $(MODULES_ALIAS_FILE) $(ISO_DIR)/$(ISOLINUX_DIR) - -[ -f $(MODULES_PCIMAP_FILE) ] && cp $(MODULES_PCIMAP_FILE) $(ISO_DIR)/$(ISOLINUX_DIR) - -[ ! -f $(ISO_DIR)/$(ISOLINUX_DIR)/pci.ids ] && cp $(PCI_IDS_FILE) $(ISO_DIR)/$(ISOLINUX_DIR) + -[ ! -f $(GZ_PCI_IDS_FILE) ] && cp /usr/share/hwdata/pci.ids $(PCI_IDS_FILE) && $(GZIP) $(PCI_IDS_FILE) + -[ ! -f $(GZ_PCI_IDS_FILE) ] && cp /usr/share/pci.ids $(PCI_IDS_FILE) && $(GZIP) $(PCI_IDS_FILE) + -[ -f $(MODULES_ALIAS_FILE) ] && cp $(MODULES_ALIAS_FILE) $(ISO_DIR)/$(ISOLINUX_DIR)\ + && $(GZIPPROG) $(ISO_DIR)/$(ISOLINUX_DIR)/modules.alias\ + && mv $(ISO_DIR)/$(ISOLINUX_DIR)/modules.alias.gz $(ISO_DIR)/$(ISOLINUX_DIR)/modules.alias + -[ -f $(MODULES_PCIMAP_FILE) ] && cp $(MODULES_PCIMAP_FILE) $(ISO_DIR)/$(ISOLINUX_DIR)\ + && $(GZIPPROG) $(ISO_DIR)/$(ISOLINUX_DIR)/modules.pcimap\ + && mv $(ISO_DIR)/$(ISOLINUX_DIR)/modules.pcimap.gz $(ISO_DIR)/$(ISOLINUX_DIR)/modules.pcimap + -[ ! -f $(ISO_DIR)/$(ISOLINUX_DIR)/pci.ids.gz ] && cp $(GZ_PCI_IDS_FILE) $(ISO_DIR)/$(ISOLINUX_DIR)/pci.ids -[ ! -f $(ISO_DIR)/$(ISOLINUX_DIR)/pci.ids ] && printf "\nThe $(FLOPPY_DIR)/pci.ids file is missing and can be downloaded from http://pciids.sourceforge.net and put in\nthe ./com32/hdt/$(FLOPPY_DIR) directory of the extracted Syslinux source.\n\n" $(MKISOFS) -o hdt.iso -b $(ISOLINUX_DIR)/isolinux.bin -c $(ISOLINUX_DIR)/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table \ diff --git a/com32/hdt/floppy/hdt.cfg b/com32/hdt/floppy/hdt.cfg index 226bf75..d91e9ac 100644 --- a/com32/hdt/floppy/hdt.cfg +++ b/com32/hdt/floppy/hdt.cfg @@ -4,4 +4,4 @@ SERIAL 0 LABEL hdt COM32 hdt.c32 -APPEND modules_pcimap=modules.pcimap modules_alias=modules.alias pciids=pci.ids quiet +APPEND modules_pcimap=modules.pcimap.gz modules_alias=modules.alias.gz pciids=pci.ids.gz quiet -- 2.7.4