All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 7e1cd70e authored by Ryan Jackson's avatar Ryan Jackson

Add ability to choose compression type for initramfs

Add '-c' option to gen_initramfs.sh to choose the compression type.
Currently, it supports the following types: gzip (default), bzip2, lzma,
and none.

The toplevel Makefile now has a variable to specify the compression type
of the initramfs, and passes it to gen_initramfs.sh.  Currently it is
set to lzma by default.
parent 1b6f6b13
......@@ -9,7 +9,8 @@ BUILDROOT_PATH = $(PWD)/buildroot-$(BUILDROOT_VERSION)
FAKEROOT_ENVIRONMENT = $(PWD)/fs_fakeroot.env
STAGING_DIR = $(PWD)/buildroot/build_$(MFS_ARCH)/staging_dir
BOOT_PATH = $(PWD)/boot
INITRAMFS = $(BOOT_PATH)/initramfs.gz
INITRAMFS_COMPRESSION = lzma
INITRAMFS = $(BOOT_PATH)/initramfs
#FAKEROOT_BIN = $(STAGING_DIR)/usr/bin/fakeroot
FAKEROOT_BIN = fakeroot
......@@ -92,6 +93,6 @@ initramfs: install
-i $(FAKEROOT_ENVIRONMENT) \
$(SCRIPTS_PATH)/misc_fixup.sh $(TARGET_PATH)
$(FAKEROOT_BIN) -i $(FAKEROOT_ENVIRONMENT) \
$(SCRIPTS_PATH)/gen_initramfs.sh $(INITRAMFS_PATH) $(INITRAMFS)
$(SCRIPTS_PATH)/gen_initramfs.sh -c $(INITRAMFS_COMPRESSION) $(INITRAMFS_PATH) $(INITRAMFS)
rm -f $(FAKEROOT_ENVIRONMENT)
rm -rf $(INITRAMFS_PATH)
#! /bin/sh
compression=gzip
usage() {
echo "USAGE: ${0##*/} [-c gzip|bzip2|lzma|none] root_dir image"
}
if [ "$1" = "-c" ]; then
case $2 in
gzip|bzip2|lzma|none)
compression=$2
;;
*) echo \
"${0##*/}: invalid compresion method \"$2\"" 1>&2
usage 1>&2
exit 1
;;
esac
shift
shift
fi
if [ $# -lt 2 ]; then
usage 1>&2
exit 1
fi
TARGET="$1"
INITRAMFS="$2"
(
cd "$TARGET"
find . -print | cpio --quiet -H newc -o | lzma -c -9 > "$INITRAMFS"
if [ $compression = none ]; then
find . -print | cpio --quiet -H newc -o
else
find . -print | cpio --quiet -H newc -o | $compression -c -9
fi
) > "$INITRAMFS"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment