From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH 3/4] cdrom+flash-image: Move all temporary files to /tmp
Date: Tue, 10 Mar 2020 13:26:05 +0000 [thread overview]
Message-ID: <20200310132606.21372-4-michael.tremer@ipfire.org> (raw)
In-Reply-To: <20200310132606.21372-1-michael.tremer@ipfire.org>
[-- Attachment #1: Type: text/plain, Size: 7401 bytes --]
Since /tmp is now a ramdisk, we move all temporary files into it.
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
---
lfs/cdrom | 71 +++++++++++++++++++++++++-----------------------
lfs/flash-images | 8 +++---
2 files changed, 41 insertions(+), 38 deletions(-)
diff --git a/lfs/cdrom b/lfs/cdrom
index 836cae981..f18b80a03 100644
--- a/lfs/cdrom
+++ b/lfs/cdrom
@@ -150,8 +150,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
# since stage2 has been executed..
echo "$(SYSTEM_RELEASE)" > /etc/system-release
- rm -rf /install/cdrom
- mkdir -p /install/cdrom/doc
+ # Create a directory to authorise the CDROM in
+ rm -rf $(DIR_TMP)/cdrom && mkdir -p $(DIR_TMP)/cdrom
# Clear mtab (prevents .journal problems)
rm -vf /etc/mtab
@@ -171,40 +171,43 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
-C / --files-from=$(DIR_TMP)/ROOTFILES | tar -x -C $(DIR_TMP)/root
rm -f $(DIR_TMP)/ROOTFILES
mkdir $(DIR_TMP)/root/sys
- cd $(DIR_TMP)/root && tar cf - * | xz $(XZ_OPT) > /install/cdrom/distro.img
+ cd $(DIR_TMP)/root && tar cf - * | xz $(XZ_OPT) > $(DIR_TMP)/cdrom/distro.img
rm -rf $(DIR_TMP)/root
# Other files
- touch /install/cdrom/$(SNAME)-$(VERSION)-core$(CORE).media
- sed 's/VERSION/$(VERSION)/' $(DIR_SRC)/config/cdrom/README.txt > /install/cdrom/README.txt
- cp $(DIR_SRC)/doc/COPYING /install/cdrom/
- cp $(DIR_SRC)/doc/{ChangeLog,packages-list.txt} /install/cdrom/doc
+ touch $(DIR_TMP)/cdrom/$(SNAME)-$(VERSION)-core$(CORE).media
+ sed 's/VERSION/$(VERSION)/' $(DIR_SRC)/config/cdrom/README.txt > $(DIR_TMP)/cdrom/README.txt
+ cp $(DIR_SRC)/doc/COPYING $(DIR_TMP)/cdrom/
- mkdir -p /install/cdrom/boot/isolinux
+ # Install documentation
+ -mkdir -pv $(DIR_TMP)/cdrom/doc
+ cp $(DIR_SRC)/doc/{ChangeLog,packages-list.txt} $(DIR_TMP)/cdrom/doc
+
+ mkdir -p $(DIR_TMP)/cdrom/boot/isolinux
ifeq "$(HAS_KERNEL)" "1"
- cp /boot/vmlinuz-$(KVER)-ipfire /install/cdrom/boot/isolinux/vmlinuz
- dracut --force --early-microcode -a "installer" --strip --xz /install/cdrom/boot/isolinux/instroot $(KVER)-ipfire
+ cp /boot/vmlinuz-$(KVER)-ipfire $(DIR_TMP)/cdrom/boot/isolinux/vmlinuz
+ dracut --force --early-microcode -a "installer" --strip --xz $(DIR_TMP)/cdrom/boot/isolinux/instroot $(KVER)-ipfire
endif
ifeq "$(HAS_ISOLINUX)" "1"
- dd if=/dev/zero bs=1k count=2 > /install/cdrom/boot/isolinux/boot.catalog
- cp $(DIR_SRC)/config/syslinux/boot.png /install/cdrom/boot/isolinux/boot.png
- cp /usr/share/syslinux/isolinux.bin /install/cdrom/boot/isolinux/isolinux.bin
- cp /usr/share/hwdata/pci.ids /install/cdrom/boot/isolinux/pci.ids
- cp -vf /usr/share/syslinux/*.c32 /install/cdrom/boot/isolinux/
+ dd if=/dev/zero bs=1k count=2 > $(DIR_TMP)/cdrom/boot/isolinux/boot.catalog
+ cp $(DIR_SRC)/config/syslinux/boot.png $(DIR_TMP)/cdrom/boot/isolinux/boot.png
+ cp /usr/share/syslinux/isolinux.bin $(DIR_TMP)/cdrom/boot/isolinux/isolinux.bin
+ cp /usr/share/hwdata/pci.ids $(DIR_TMP)/cdrom/boot/isolinux/pci.ids
+ cp -vf /usr/share/syslinux/*.c32 $(DIR_TMP)/cdrom/boot/isolinux/
sed -e "s/VERSION/$(VERSION) - Core $(CORE)/g" \
$(DIR_SRC)/config/syslinux/syslinux.cfg \
- > /install/cdrom/boot/isolinux/isolinux.cfg
+ > $(DIR_TMP)/cdrom/boot/isolinux/isolinux.cfg
endif
ifeq "$(HAS_MEMTEST)" "1"
# Install memtest
- cp /usr/lib/memtest86+/memtest.bin /install/cdrom/boot/isolinux/memtest
+ cp /usr/lib/memtest86+/memtest.bin $(DIR_TMP)/cdrom/boot/isolinux/memtest
endif
ifeq "$(HAS_IPXE)" "1"
- cp /usr/share/ipfire-netboot/ipxe.lkrn /install/cdrom/boot/isolinux/netboot
+ cp /usr/share/ipfire-netboot/ipxe.lkrn $(DIR_TMP)/cdrom/boot/isolinux/netboot
endif
ifeq "$(EFI)" "1"
@@ -213,43 +216,43 @@ ifeq "$(EFI)" "1"
$(DIR_SRC)/config/cdrom/grub-efi.cfg > /tmp/grub-efi.cfg
# Build a GRUB EFI image
- mkdir -pv /install/cdrom/EFI/BOOT
+ mkdir -pv $(DIR_TMP)/cdrom/EFI/BOOT
grub-mkimage \
--format=$(GRUB_ARCH)-efi \
- --output=/install/cdrom/EFI/BOOT/boot$(EFI_ARCH).efi \
- --config=/tmp/grub-efi.cfg \
+ --output=$(DIR_TMP)/cdrom/EFI/BOOT/boot$(EFI_ARCH).efi \
+ --config=$(DIR_TMP)/grub-efi.cfg \
--compression=xz \
--prefix=/EFI/BOOT \
$$(for mod in $(GRUB_EFI_MODULES); do [ -f "/usr/lib/grub/$(GRUB_ARCH)-efi/$${mod}.mod" ] && echo "$${mod}"; done)
# Install GRUB configuration
- mkdir -pv /install/cdrom/EFI/BOOT
+ mkdir -pv $(DIR_TMP)/cdrom/EFI/BOOT
sed -e "s/NAME/$(NAME)/g" -e "s/VERSION/$(VERSION)/g" -e "s/ARCH/$(BUILD_ARCH)/g" \
- < $(DIR_SRC)/config/cdrom/grub.cfg > /install/cdrom/EFI/BOOT/grub.cfg
+ < $(DIR_SRC)/config/cdrom/grub.cfg > $(DIR_TMP)/cdrom/EFI/BOOT/grub.cfg
# Create the EFI Eltorito image
- dd if=/dev/zero of=/install/cdrom/boot/isolinux/efiboot.img bs=1k count=1440
- mkdosfs -F 12 -n "IPFIRE_EFI" /install/cdrom/boot/isolinux/efiboot.img
+ dd if=/dev/zero of=$(DIR_TMP)/cdrom/boot/isolinux/efiboot.img bs=1k count=1440
+ mkdosfs -F 12 -n "IPFIRE_EFI" $(DIR_TMP)/cdrom/boot/isolinux/efiboot.img
# Mount the EFI image
- mkdir -pv /install/efiboot.img
- mount -o loop /install/cdrom/boot/isolinux/efiboot.img /install/efiboot.img
+ mkdir -pv $(DIR_TMP)/efiboot.img
+ mount -o loop $(DIR_TMP)/cdrom/boot/isolinux/efiboot.img $(DIR_TMP)/efiboot.img
# Copy the bootloader into the image
- mkdir -pv /install/efiboot.img/EFI/BOOT
- cp -a /install/cdrom/EFI/BOOT/boot$(EFI_ARCH).efi \
- /install/efiboot.img/EFI/BOOT/boot$(EFI_ARCH).efi
+ mkdir -p $(DIR_TMP)/efiboot.img/EFI/BOOT
+ cp -a $(DIR_TMP)/cdrom/EFI/BOOT/boot$(EFI_ARCH).efi \
+ $(DIR_TMP)/efiboot.img/EFI/BOOT/boot$(EFI_ARCH).efi
# Cleanup
- umount /install/efiboot.img
- rm -rf /install/efiboot.img /tmp/grub-efi.cfg
+ umount $(DIR_TMP)/efiboot.img
+ rm -rf $(DIR_TMP)/efiboot.img $(DIR_TMP)/grub-efi.cfg
endif
- cd /install/cdrom && find -type f ! -name md5sum.txt | grep -v "./boot" | \
+ cd $(DIR_TMP)/cdrom && find -type f ! -name md5sum.txt | grep -v "./boot" | \
xargs md5sum > md5sum.txt
mkdir -p /install/images
- cd /install/cdrom && mkisofs $(ISO_ARGS) \
+ cd $(DIR_TMP)/cdrom && mkisofs $(ISO_ARGS) \
-o /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso .
ifeq "$(HAS_ISOLINUX)" "1"
diff --git a/lfs/flash-images b/lfs/flash-images
index e4af896f1..422acac22 100644
--- a/lfs/flash-images
+++ b/lfs/flash-images
@@ -55,8 +55,8 @@ md5 :
###############################################################################
# Installation Details
###############################################################################
-MNThdd := /install/harddisk
-IMG := /install/images/image.img
+MNThdd := $(DIR_TMP)/harddisk
+IMG := $(DIR_TMP)/image.img
# All sizes in blocks
ifeq "$(BUILD_PLATFORM)" "arm"
@@ -152,9 +152,9 @@ endif
# Install IPFire
ifneq "$(BUILD_PLATFORM)" "arm"
- tar -x --xz -C $(MNThdd)/ -f /install/cdrom/distro.img
+ tar -x --xz -C $(MNThdd)/ -f $(DIR_TMP)/cdrom/distro.img
else
- tar -x -C $(MNThdd)/ -f /install/cdrom/distro.img
+ tar -x -C $(MNThdd)/ -f $(DIR_TMP)/cdrom/distro.img
endif
-touch $(MNThdd)/lib/modules/$(KVER)-ipfire/modules.dep
mkdir $(MNThdd)/proc
--
2.20.1
next prev parent reply other threads:[~2020-03-10 13:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-10 13:26 Reducing I/O of the build process Michael Tremer
2020-03-10 13:26 ` [PATCH 1/4] make.sh: Make /tmp a ramdisk if ramdisks are enabled Michael Tremer
2020-03-10 13:28 ` [PATCH] make.sh: Umount /tmp when it is a ramdisk Michael Tremer
2020-03-10 13:26 ` [PATCH 2/4] cdrom: Do not write the temporary tarball to disk Michael Tremer
2020-03-10 13:26 ` Michael Tremer [this message]
2020-03-10 13:26 ` [PATCH 4/4] make.sh: Move ccache's temp directory into /tmp Michael Tremer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200310132606.21372-4-michael.tremer@ipfire.org \
--to=michael.tremer@ipfire.org \
--cc=development@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox