diff options
author | Matt Turner <mattst88@gentoo.org> | 2020-04-30 23:28:58 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gentoo.org> | 2020-05-03 19:41:16 -0700 |
commit | 9ad9eed7833829cc1150d715d48ea32539a5848a (patch) | |
tree | a56b6b445c24c42bfa07065374d4ec7b1ac27e81 | |
parent | targets: Use gensquashfs instead of mksquashfs (diff) | |
download | catalyst-9ad9eed7833829cc1150d715d48ea32539a5848a.tar.gz catalyst-9ad9eed7833829cc1150d715d48ea32539a5848a.tar.bz2 catalyst-9ad9eed7833829cc1150d715d48ea32539a5848a.zip |
targets: Drop most fstypes
This removes support for various file systems from the embedded target
(a target for producing images for embedded systems, as far as I
understand) and for ISOs. For ISOs, squashfs is great and everyone uses
it -- it provides better performance from a CD than the alternatives
like zisofs, normal, or noloop. See [1] for performance data of squashfs
vs other methods.
For embedded, it's unclear whether the target is used at all. There are
some very old specs in releng.git that use 'rel_type: embedded', but I'm
not sure if the target is used at all these days. To that end, I've
asked in #gentoo-embedded if anyone uses it. I've removed what I believe
to be the file system options that don't provide any value, leaving
jffs2 for now.
[1] https://elinux.org/Squash_Fs_Comparisons
Signed-off-by: Matt Turner <mattst88@gentoo.org>
-rw-r--r-- | catalyst/base/stagebase.py | 4 | ||||
-rw-r--r-- | doc/catalyst-spec.5.txt | 9 | ||||
-rw-r--r-- | examples/livecd-stage2_template.spec | 8 | ||||
-rwxr-xr-x | targets/embedded/fs-runscript.sh | 15 | ||||
-rwxr-xr-x | targets/support/create-iso.sh | 114 | ||||
-rwxr-xr-x | targets/support/filesystem-functions.sh | 65 | ||||
-rwxr-xr-x | targets/support/functions.sh | 14 | ||||
-rwxr-xr-x | targets/support/target_image_setup.sh | 20 |
8 files changed, 58 insertions, 191 deletions
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 7c82029a..bb008744 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -386,10 +386,10 @@ class StageBase(TargetBase, ClearBase, GenBase): del self.settings[self.settings["spec_prefix"] + "/fstype"] if "fstype" not in self.settings: - self.settings["fstype"] = "normal" + self.settings["fstype"] = "squashfs" for x in self.valid_values: if x == self.settings["spec_prefix"] + "/fstype": - log.info('%s/fstype is being set to the default of "normal"', + log.info('%s/fstype is being set to the default of "squashfs"', self.settings['spec_prefix']) def set_fsops(self): diff --git a/doc/catalyst-spec.5.txt b/doc/catalyst-spec.5.txt index e269e16d..40453e0f 100644 --- a/doc/catalyst-spec.5.txt +++ b/doc/catalyst-spec.5.txt @@ -170,18 +170,11 @@ Filesystem *livecd/fstype*:: The fstype is used to determine what sort of CD we should build. This is used to set the type of loopback filesystem that we will use on our -CD. Possible values are as follows: - `squashfs`;; This gives the best compression, but requires a kernel patch. - `zisofs`;; This uses in-kernel compression and is supported on all platforms. - `normal`;; This creates a loop without compression. - `noloop`;; This copies the files to the CD directly, without using a - loopback. +CD. The only possible value is `squashfs`. *livecd/fsops*:: The fsops are a list of optional parameters that can be passed to the tool which will create the filesystem specified in *livecd/fstype* -It is valid for the following fstypes: `squashfs`, `jffs`, `jffs2`, -and `cramfs`. *livecd/iso*:: This is the full path and filename to the ISO image that the diff --git a/examples/livecd-stage2_template.spec b/examples/livecd-stage2_template.spec index 3b9ca1da..e9758909 100644 --- a/examples/livecd-stage2_template.spec +++ b/examples/livecd-stage2_template.spec @@ -83,18 +83,14 @@ kerncache_path: # The fstype is used to determine what sort of CD we should build. This is # used to set the type of loopback filesystem that we will use on our CD. -# Possible options are as follows: -# squashfs - This gives the best compression, but requires a kernel patch. -# zisofs - This uses in-kernel compression and is supported on all platforms. -# normal - This creates a loop without compression. -# noloop - This copies the files to the CD directly, without using a loopback. +# Possible options are as follows: squashfs # example: # livecd/fstype: squashfs livecd/fstype: # The fsops are a list of optional parameters that can be passed to the tool # which will create the filesystem specified in livecd/fstype. It is valid for -# the following fstypes: squashfs, jffs, jffs2, cramfs +# the following fstypes: squashfs livecd/fsops: # The cdtar is essentially the bootloader for the CD. It also holds the main diff --git a/targets/embedded/fs-runscript.sh b/targets/embedded/fs-runscript.sh index 4746a909..fb17d3ba 100755 --- a/targets/embedded/fs-runscript.sh +++ b/targets/embedded/fs-runscript.sh @@ -13,32 +13,17 @@ fs_check() { } case ${1} in - jffs) - fs_check /usr/sbin/mkfs.jffs jffs sys-fs/mtd - mkfs.jffs -d ${root_fs_path} -o ${clst_image_path}/root.img \ - ${clst_embedded_fs_ops} || die "Could not create a jffs filesystem" - ;; jffs2) fs_check /usr/sbin/mkfs.jffs2 jffs2 sys-fs/mtd mkfs.jffs2 --root=${root_fs_path} --output=${clst_image_path}/root.img\ ${clst_embedded_fs_ops} || die "Could not create a jffs2 filesystem" ;; - cramfs) - fs_check /sbin/mkcramfs cramfs sys-fs/cramfs - mkcramfs ${clst_embedded_fs_ops} ${root_fs_path} \ - ${clst_image_path}/root.img || \ - die "Could not create a cramfs filesystem" - ;; - squashfs) fs_check /usr/bin/gensquashfs squashfs sys-fs/squashfs-tools-ng gensquashfs -D ${root_fs_path} -q ${clst_embedded_fs_ops} \ ${clst_image_path}/root.img || die "Could not create a squashfs filesystem" ;; - - *) - ;; esac exit $? diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh index 01b06501..44866946 100755 --- a/targets/support/create-iso.sh +++ b/targets/support/create-iso.sh @@ -91,13 +91,6 @@ if [ "${#clst_iso_volume_id}" -gt 32 ]; then echo "new: '${clst_iso_volume_id}'" 1>&2 fi -if [ "${clst_fstype}" == "zisofs" ] -then - mkisofs_zisofs_opts="-z" -else - mkisofs_zisofs_opts="" -fi - # Generate list of checksums that genkernel can use to verify the contents of # the ISO isoroot_checksum() { @@ -124,74 +117,73 @@ case ${clst_hostarch} in alpha) isoroot_checksum - echo ">> xorriso -as genisofs -alpha-boot boot/bootlx -R -l -J ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o \"${1}\" \"${clst_target_path}\"" - xorriso -as genisofs -alpha-boot boot/bootlx -R -l -J ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}" || die "Cannot make ISO image" + echo ">> xorriso -as genisofs -alpha-boot boot/bootlx -R -l -J -V \"${clst_iso_volume_id}\" -o \"${1}\" \"${clst_target_path}\"" + xorriso -as genisofs -alpha-boot boot/bootlx -R -l -J -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}" || die "Cannot make ISO image" ;; arm) ;; hppa) echo ">> Running mkisofs to create iso image...." - run_mkisofs -R -l -J ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}"/ + run_mkisofs -R -l -J -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}"/ pushd "${clst_target_path}/" palo -f boot/palo.conf -C "${1}" popd ;; mips) - case ${clst_fstype} in - squashfs) - # $clst_target_path/[kernels|arcload] already exists, create loopback and sgibootcd - [ ! -d "${clst_target_path}/loopback" ] && mkdir "${clst_target_path}/loopback" - [ ! -d "${clst_target_path}/sgibootcd" ] && mkdir "${clst_target_path}/sgibootcd" + if [[ ${clst_fstype} != squashfs ]]; then + die "SGI LiveCD(s) only support the 'squashfs' fstype!" + fi - # Setup variables - [ -f "${clst_target_path}/livecd" ] && rm -f "${clst_target_path}/livecd" - img="${clst_target_path}/loopback/image.squashfs" - knl="${clst_target_path}/kernels" - arc="${clst_target_path}/arcload" - cfg="${clst_target_path}/sgibootcd/sgibootcd.cfg" - echo "" > "${cfg}" + # $clst_target_path/[kernels|arcload] already exists, create loopback and sgibootcd + [ ! -d "${clst_target_path}/loopback" ] && mkdir "${clst_target_path}/loopback" + [ ! -d "${clst_target_path}/sgibootcd" ] && mkdir "${clst_target_path}/sgibootcd" - # If the image file exists in $clst_target_path, move it to the loopback dir - [ -e "${clst_target_path}/image.squashfs" ] \ - && mv -f "${clst_target_path}/image.squashfs" "${clst_target_path}/loopback" + # Setup variables + [ -f "${clst_target_path}/livecd" ] && rm -f "${clst_target_path}/livecd" + img="${clst_target_path}/loopback/image.squashfs" + knl="${clst_target_path}/kernels" + arc="${clst_target_path}/arcload" + cfg="${clst_target_path}/sgibootcd/sgibootcd.cfg" + echo "" > "${cfg}" - # An sgibootcd config is essentially a collection of commandline params - # stored in a text file. We could pass these on the command line, but it's - # far easier to generate a config file and pass it to sgibootcd versus using a - # ton of commandline params. - # - # f= indicates files to go into DVH (disk volume header) in an SGI disklabel - # format: f=</path/to/file>@<DVH name> - # p0= the first partition holds the LiveCD rootfs image - # format: p0=</path/to/image> - # p8= the eighth partition is the DVH partition - # p10= the tenth partition is the disk volume partition - # format: p8= is always "#dvh" and p10= is always "#volume" + # If the image file exists in $clst_target_path, move it to the loopback dir + [ -e "${clst_target_path}/image.squashfs" ] \ + && mv -f "${clst_target_path}/image.squashfs" "${clst_target_path}/loopback" - # Add the kernels to the sgibootcd config - for x in ${clst_boot_kernel}; do - echo -e "f=${knl}/${x}@${x}" >> ${cfg} - done + # An sgibootcd config is essentially a collection of commandline params + # stored in a text file. We could pass these on the command line, but it's + # far easier to generate a config file and pass it to sgibootcd versus using a + # ton of commandline params. + # + # f= indicates files to go into DVH (disk volume header) in an SGI disklabel + # format: f=</path/to/file>@<DVH name> + # p0= the first partition holds the LiveCD rootfs image + # format: p0=</path/to/image> + # p8= the eighth partition is the DVH partition + # p10= the tenth partition is the disk volume partition + # format: p8= is always "#dvh" and p10= is always "#volume" - # Next, the bootloader binaries and config - echo -e "f=${arc}/sash64@sash64" >> ${cfg} - echo -e "f=${arc}/sashARCS@sashARCS" >> ${cfg} - echo -e "f=${arc}/arc.cf@arc.cf" >> ${cfg} + # Add the kernels to the sgibootcd config + for x in ${clst_boot_kernel}; do + echo -e "f=${knl}/${x}@${x}" >> ${cfg} + done - # Next, the Loopback Image - echo -e "p0=${img}" >> ${cfg} + # Next, the bootloader binaries and config + echo -e "f=${arc}/sash64@sash64" >> ${cfg} + echo -e "f=${arc}/sashARCS@sashARCS" >> ${cfg} + echo -e "f=${arc}/arc.cf@arc.cf" >> ${cfg} - # Finally, the required SGI Partitions (dvh, volume) - echo -e "p8=#dvh" >> ${cfg} - echo -e "p10=#volume" >> ${cfg} + # Next, the Loopback Image + echo -e "p0=${img}" >> ${cfg} - # All done; feed the config to sgibootcd and end up with an image - # c= the config file - # o= output image (burnable to CD; readable by fdisk) - /usr/bin/sgibootcd c=${cfg} o=${clst_iso} - ;; - *) die "SGI LiveCD(s) only support the 'squashfs' fstype!" ;; - esac + # Finally, the required SGI Partitions (dvh, volume) + echo -e "p8=#dvh" >> ${cfg} + echo -e "p10=#volume" >> ${cfg} + + # All done; feed the config to sgibootcd and end up with an image + # c= the config file + # o= output image (burnable to CD; readable by fdisk) + /usr/bin/sgibootcd c=${cfg} o=${clst_iso} ;; ia64|ppc*|powerpc*|sparc*) isoroot_checksum @@ -252,21 +244,21 @@ case ${clst_hostarch} in # have BIOS isolinux, plus an EFI loader image echo '** Found GRUB2 EFI bootloader' echo 'Creating ISO using both ISOLINUX and EFI bootloader' - run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -eltorito-platform efi -b gentoo.efimg -no-emul-boot -z "${clst_target_path}"/ + run_mkisofs -J -R -l -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -eltorito-platform efi -b gentoo.efimg -no-emul-boot -z "${clst_target_path}"/ isohybrid --uefi "${1}" else echo 'Creating ISO using ISOLINUX bootloader' - run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/ + run_mkisofs -J -R -l -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/ isohybrid "${1}" fi elif [ -e "${clst_target_path}/gentoo.efimg" ]; then echo '** Found GRUB2 EFI bootloader' echo 'Creating ISO using EFI bootloader' - run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b gentoo.efimg -c boot.cat -no-emul-boot "${clst_target_path}"/ + run_mkisofs -J -R -l -V "${clst_iso_volume_id}" -o "${1}" -b gentoo.efimg -c boot.cat -no-emul-boot "${clst_target_path}"/ else echo '** Found no known bootloader' echo 'Creating ISO with fingers crossed that you know what you are doing...' - run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}"/ + run_mkisofs -J -R -l -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}"/ fi ;; esac diff --git a/targets/support/filesystem-functions.sh b/targets/support/filesystem-functions.sh index a4d31b4e..d82be45a 100755 --- a/targets/support/filesystem-functions.sh +++ b/targets/support/filesystem-functions.sh @@ -3,55 +3,6 @@ # Dont forget to update functions.sh check_looptype # $1 is the target directory for the filesystem -create_normal_loop() { - export source_path="${clst_destpath}" - export destination_path="$1" - export loopname="image.loop" - - # We get genkernel-built kernels and initrds in place, create the loopback - # file system on $clst_target_path, mount it, copy our bootable filesystem - # over, umount it, and have a ready-to-burn ISO tree at $clst_target_path. - - echo "Calculating size of loopback filesystem..." - loopsize=`du -ks ${source_path} | cut -f1` - [ "${loopsize}" = "0" ] && loopsize=1 - # Add 4MB for filesystem slop - loopsize=`expr ${loopsize} + 4096` - echo "Creating loopback file..." - dd if=/dev/zero of=${destination_path}/${loopname} bs=1k count=${loopsize} \ - || die "${loopname} creation failure" - mke2fs -m 0 -F -q ${destination_path}/${loopname} \ - || die "Couldn't create ext2 filesystem" - install -d ${destination_path}/loopmount - sync; sync; sleep 3 # Try to work around 2.6.0+ loopback bug - mount -t ext2 -o loop ${destination_path}/${loopname} \ - ${destination_path}/loopmount \ - || die "Couldn't mount loopback ext2 filesystem" - sync; sync; sleep 3 # Try to work around 2.6.0+ loopback bug - echo "cp -pPR ${source_path}/* ${destination_path}/loopmount" - cp -pPR ${source_path}/* ${destination_path}/loopmount - [ $? -ne 0 ] && { umount ${destination_path}/${loopname}; \ - die "Couldn't copy files to loopback ext2 filesystem"; } - umount ${destination_path}/loopmount \ - || die "Couldn't unmount loopback ext2 filesystem" - rm -rf ${destination_path}/loopmount - # Now, $clst_target_path should contain a proper bootable image for our - # ISO, including boot loader and loopback filesystem. -} - -create_zisofs() { - rm -rf "$1/zisofs" > /dev/null 2>&1 - echo "Creating zisofs..." - mkzftree -z 9 -p2 "${clst_destpath}" "$1/zisofs" \ - || die "Could not run mkzftree, did you emerge zisofs" -} - -create_noloop() { - echo "Copying files for image (no loop)..." - cp -pPR "${clst_destpath}"/* "$1" \ - || die "Could not copy files to image (no loop)" -} - create_squashfs() { echo "Creating squashfs..." export loopname="image.squashfs" @@ -59,14 +10,6 @@ create_squashfs() { || die "gensquashfs failed, did you emerge squashfs-tools-ng?" } -create_jffs() { - echo "Creating jffs..." - export loopname="image.jffs" - # fs_check /usr/sbin/mkfs.jffs jffs sys-fs/mtd - mkfs.jffs -d ${clst_destpath} -o $1/${loopname} ${clst_fsops} \ - || die "Could not create a jffs filesystem" -} - create_jffs2(){ echo "Creating jffs2..." export loopname="image.jffs" @@ -74,11 +17,3 @@ create_jffs2(){ mkfs.jffs2 --root=${clst_destpath} --output=$1/${loopname} ${clst_fsops} \ || die "Could not create a jffs2 filesystem" } - -create_cramfs(){ - echo "Creating cramfs..." - export loopname="image.cramfs" - #fs_check /sbin/mkcramfs cramfs sys-fs/cramfs - mkcramfs ${clst_fsops} ${clst_destpath} $1/${loopname} \ - || die "Could not create a cramfs filesystem" -} diff --git a/targets/support/functions.sh b/targets/support/functions.sh index 9da13baf..daf6f190 100755 --- a/targets/support/functions.sh +++ b/targets/support/functions.sh @@ -230,26 +230,12 @@ check_bootargs(){ check_filesystem_type(){ case ${clst_fstype} in - normal) - cmdline_opts="${cmdline_opts} looptype=normal loop=/image.loop" - ;; - zisofs) - cmdline_opts="${cmdline_opts} looptype=zisofs loop=/zisofs" - ;; - noloop) - ;; squashfs) cmdline_opts="${cmdline_opts} looptype=squashfs loop=/image.squashfs" ;; - jffs) - cmdline_opts="${cmdline_opts} looptype=jffs loop=/image.jffs" - ;; jffs2) cmdline_opts="${cmdline_opts} looptype=jffs2 loop=/image.jffs2" ;; - cramfs) - cmdline_opts="${cmdline_opts} looptype=cramfs loop=/image.cramfs" - ;; esac } diff --git a/targets/support/target_image_setup.sh b/targets/support/target_image_setup.sh index 559bc56c..423dc4c4 100755 --- a/targets/support/target_image_setup.sh +++ b/targets/support/target_image_setup.sh @@ -8,34 +8,14 @@ mkdir -p $1 loopret=1 case ${clst_fstype} in - normal) - create_normal_loop $1 - loopret=$? - ;; - zisofs) - create_zisofs $1 - loopret=$? - ;; - noloop) - create_noloop $1 - loopret=$? - ;; squashfs) create_squashfs $1 loopret=$? ;; - jffs) - create_jffs $1 - loopret=$? - ;; jffs2) create_jffs2 $1 loopret=$? ;; - cramfs) - create_cramfs $1 - loopret=$? - ;; esac if [ ${loopret} = "1" ] |