[PATCH 1/8] targets: Use gensquashfs instead of mksquashfs

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/8] targets: Use gensquashfs instead of mksquashfs

Matt Turner-5
We're using tar2sqfs from squashfs-tools-ng, so let's replace the usage
of mksquashfs (from squashfs-tools) with gensquashfs.

Signed-off-by: Matt Turner <[hidden email]>
---
 doc/catalyst-spec.5.txt                 | 4 ++--
 examples/livecd-stage2_template.spec    | 2 --
 targets/embedded/fs-runscript.sh        | 6 +++---
 targets/support/filesystem-functions.sh | 4 ++--
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/doc/catalyst-spec.5.txt b/doc/catalyst-spec.5.txt
index f87bd69e..e269e16d 100644
--- a/doc/catalyst-spec.5.txt
+++ b/doc/catalyst-spec.5.txt
@@ -180,8 +180,8 @@ CD.  Possible values are as follows:
 *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*
-(example: `-root-owned`).  It is valid for the following fstypes:
-`squashfs`, `jffs`, `jffs2`, and `cramfs`.
+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 4cb94d40..3b9ca1da 100644
--- a/examples/livecd-stage2_template.spec
+++ b/examples/livecd-stage2_template.spec
@@ -95,8 +95,6 @@ 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
-# example:
-# livecd/fsops: -root-owned
 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 8d5abab1..7e70848b 100755
--- a/targets/embedded/fs-runscript.sh
+++ b/targets/embedded/fs-runscript.sh
@@ -32,9 +32,9 @@ case ${1} in
  ;;
 
  squashfs)
- fs_check /usr/bin/mksquashfs squashfs sys-fs/squashfs-tools
- mksquashfs ${root_fs_path} ${clst_image_path}/root.img \
- ${clst_embedded_fs_ops} || \
+ fs_check /usr/bin/gensquashfs squashfs sys-fs/squashfs-tools-ng
+ gensquashfs -D ${root_fs_path} ${clst_embedded_fs_ops} \
+ ${clst_image_path}/root.img ||
  die "Could not create a squashfs filesystem"
  ;;
 
diff --git a/targets/support/filesystem-functions.sh b/targets/support/filesystem-functions.sh
index 0c144ba8..03303b14 100755
--- a/targets/support/filesystem-functions.sh
+++ b/targets/support/filesystem-functions.sh
@@ -55,8 +55,8 @@ create_noloop() {
 create_squashfs() {
  echo "Creating squashfs..."
  export loopname="image.squashfs"
- mksquashfs "${clst_destpath}" "$1/${loopname}" ${clst_fsops} -noappend \
- || die "mksquashfs failed, did you emerge squashfs-tools?"
+ gensquashfs -D "${clst_destpath}" ${clst_fsops} "$1/${loopname}" \
+ || die "gensquashfs failed, did you emerge squashfs-tools-ng?"
 }
 
 create_jffs() {
--
2.26.2


Reply | Threaded
Open this post in threaded view
|

[PATCH 2/8] targets: Drop most fstypes

Matt Turner-5
Signed-off-by: Matt Turner <[hidden email]>
---
 doc/catalyst-spec.5.txt                 |  9 +---
 examples/livecd-stage2_template.spec    |  8 +--
 targets/embedded/fs-runscript.sh        | 15 ------
 targets/support/filesystem-functions.sh | 65 -------------------------
 targets/support/functions.sh            | 14 ------
 targets/support/target_image_setup.sh   | 20 --------
 6 files changed, 4 insertions(+), 127 deletions(-)

diff --git a/doc/catalyst-spec.5.txt b/doc/catalyst-spec.5.txt
index e269e16d..16c8773d 100644
--- a/doc/catalyst-spec.5.txt
+++ b/doc/catalyst-spec.5.txt
@@ -171,17 +171,12 @@ Filesystem
 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.
+  `squashfs`;;
+  `jffs2`;;
 
 *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..f4a20cab 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, jffs2
 # 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, jffs2
 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 7e70848b..5e339608 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} ${clst_embedded_fs_ops} \
  ${clst_image_path}/root.img ||
  die "Could not create a squashfs filesystem"
  ;;
-
- *)
- ;;
 esac
 exit $?
diff --git a/targets/support/filesystem-functions.sh b/targets/support/filesystem-functions.sh
index 03303b14..a95ae0b9 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" ]
--
2.26.2


Reply | Threaded
Open this post in threaded view
|

[PATCH 3/8] targets: Inline filesystem-functions.sh

Matt Turner-5
In reply to this post by Matt Turner-5
Signed-off-by: Matt Turner <[hidden email]>
---
 targets/support/filesystem-functions.sh | 19 -------------------
 targets/support/target_image_setup.sh   | 20 ++++++--------------
 2 files changed, 6 insertions(+), 33 deletions(-)
 delete mode 100755 targets/support/filesystem-functions.sh

diff --git a/targets/support/filesystem-functions.sh b/targets/support/filesystem-functions.sh
deleted file mode 100755
index a95ae0b9..00000000
--- a/targets/support/filesystem-functions.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-# Dont forget to update functions.sh  check_looptype
-# $1 is the target directory for the filesystem
-
-create_squashfs() {
- echo "Creating squashfs..."
- export loopname="image.squashfs"
- gensquashfs -D "${clst_destpath}" ${clst_fsops} "$1/${loopname}" \
- || die "gensquashfs failed, did you emerge squashfs-tools-ng?"
-}
-
-create_jffs2(){
- echo "Creating jffs2..."
- export loopname="image.jffs"
- # fs_check /usr/sbin/mkfs.jffs2 jffs2 sys-fs/mtd
- mkfs.jffs2 --root=${clst_destpath} --output=$1/${loopname} ${clst_fsops} \
- || die "Could not create a jffs2 filesystem"
-}
diff --git a/targets/support/target_image_setup.sh b/targets/support/target_image_setup.sh
index 423dc4c4..03cb4741 100755
--- a/targets/support/target_image_setup.sh
+++ b/targets/support/target_image_setup.sh
@@ -1,25 +1,17 @@
 #!/bin/bash
 
 source ${clst_shdir}/support/functions.sh
-source ${clst_shdir}/support/filesystem-functions.sh
 
-# Make the directory if it doesnt exist
-mkdir -p $1
+mkdir -p "${1}"
 
-loopret=1
+echo "Creating ${clst_fstype} filesystem"
 case ${clst_fstype} in
  squashfs)
- create_squashfs $1
- loopret=$?
+ gensquashfs -D "${clst_destpath}" "${clst_fsops}" "${1}/image.squashfs" \
+ || die "Failed to create squashfs filesystem"
  ;;
  jffs2)
- create_jffs2 $1
- loopret=$?
+ mkfs.jffs2 --root="${clst_destpath}" --output="${1}/image.jffs" "${clst_fsops}" \
+ || die "Failed to create jffs2 filesystem"
  ;;
 esac
-
-if [ ${loopret} = "1" ]
-then
- die "Filesystem not setup"
-fi
-exit $loopret
--
2.26.2


Reply | Threaded
Open this post in threaded view
|

[PATCH 4/8] targets: Remove unused source filesystem-functions.sh

Matt Turner-5
In reply to this post by Matt Turner-5
Signed-off-by: Matt Turner <[hidden email]>
---
 targets/embedded/controller.sh      | 1 -
 targets/livecd-stage2/controller.sh | 1 -
 targets/netboot/controller.sh       | 1 -
 targets/support/bootloader-setup.sh | 1 -
 targets/support/create-iso.sh       | 1 -
 targets/support/netboot-final.sh    | 1 -
 6 files changed, 6 deletions(-)

diff --git a/targets/embedded/controller.sh b/targets/embedded/controller.sh
index 7e33ed49..e40a913f 100755
--- a/targets/embedded/controller.sh
+++ b/targets/embedded/controller.sh
@@ -1,7 +1,6 @@
 #!/bin/bash
 
 source ${clst_shdir}/support/functions.sh
-source ${clst_shdir}/support/filesystem-functions.sh
 
 case ${1} in
  enter)
diff --git a/targets/livecd-stage2/controller.sh b/targets/livecd-stage2/controller.sh
index f9bc7b7e..8ee46d7c 100755
--- a/targets/livecd-stage2/controller.sh
+++ b/targets/livecd-stage2/controller.sh
@@ -1,7 +1,6 @@
 #!/bin/bash
 
 source ${clst_shdir}/support/functions.sh
-source ${clst_shdir}/support/filesystem-functions.sh
 
 case $1 in
  pre-kmerge)
diff --git a/targets/netboot/controller.sh b/targets/netboot/controller.sh
index d6b329e6..f84a32bd 100755
--- a/targets/netboot/controller.sh
+++ b/targets/netboot/controller.sh
@@ -1,7 +1,6 @@
 #!/bin/bash
 
 source ${clst_shdir}/support/functions.sh
-source ${clst_shdir}/support/filesystem-functions.sh
 
 case ${1} in
  build_packages)
diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh
index 1564d74a..d507fe5e 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -1,7 +1,6 @@
 #!/bin/bash
 
 source ${clst_shdir}/support/functions.sh
-source ${clst_shdir}/support/filesystem-functions.sh
 
 # $1 is the destination root
 
diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index 01b06501..e5ad7060 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -1,7 +1,6 @@
 #!/bin/bash
 
 source ${clst_shdir}/support/functions.sh
-source ${clst_shdir}/support/filesystem-functions.sh
 
 ## START RUNSCRIPT
 
diff --git a/targets/support/netboot-final.sh b/targets/support/netboot-final.sh
index 52b85f05..f71e4099 100755
--- a/targets/support/netboot-final.sh
+++ b/targets/support/netboot-final.sh
@@ -1,7 +1,6 @@
 #!/bin/bash
 
 source ${clst_shdir}/support/functions.sh
-source ${clst_shdir}/support/filesystem-functions.sh
 
 extract_kernels ${clst_target_path}/boot
 
--
2.26.2


Reply | Threaded
Open this post in threaded view
|

[PATCH 5/8] targets: Remove run_crossdev() function

Matt Turner-5
In reply to this post by Matt Turner-5
Signed-off-by: Matt Turner <[hidden email]>
---
 targets/support/functions.sh | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/targets/support/functions.sh b/targets/support/functions.sh
index daf6f190..601f5dc9 100755
--- a/targets/support/functions.sh
+++ b/targets/support/functions.sh
@@ -238,7 +238,3 @@ check_filesystem_type(){
  ;;
  esac
 }
-
-run_crossdev() {
- crossdev ${clst_CHOST}
-}
--
2.26.2


Reply | Threaded
Open this post in threaded view
|

[PATCH 6/8] targets: Inline functions with one caller

Matt Turner-5
In reply to this post by Matt Turner-5
Signed-off-by: Matt Turner <[hidden email]>
---
 targets/support/bootloader-setup.sh | 21 +++++++++++++++++++--
 targets/support/functions.sh        | 22 ----------------------
 2 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh
index d507fe5e..d3a6b2dc 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -19,8 +19,25 @@ else
 fi
 
 extract_kernels $1/boot
-check_bootargs
-check_filesystem_type
+
+# Add any additional options
+if [ -n "${clst_livecd_bootargs}" ]
+then
+ for x in ${clst_livecd_bootargs}
+ do
+ cmdline_opts="${cmdline_opts} ${x}"
+ done
+fi
+
+case ${clst_fstype} in
+ squashfs)
+ cmdline_opts="${cmdline_opts} looptype=squashfs loop=/image.squashfs"
+ ;;
+ jffs2)
+ cmdline_opts="${cmdline_opts} looptype=jffs2 loop=/image.jffs2"
+ ;;
+esac
+
 
 default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot"
 [ -n "${clst_splash_theme}" ] && default_append_line="${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet"
diff --git a/targets/support/functions.sh b/targets/support/functions.sh
index 601f5dc9..ac6710ad 100755
--- a/targets/support/functions.sh
+++ b/targets/support/functions.sh
@@ -216,25 +216,3 @@ extract_kernel() {
  mv ${1}/initramfs-* ${1}/${2}.igz
  fi
 }
-
-check_bootargs(){
- # Add any additional options
- if [ -n "${clst_livecd_bootargs}" ]
- then
- for x in ${clst_livecd_bootargs}
- do
- cmdline_opts="${cmdline_opts} ${x}"
- done
- fi
-}
-
-check_filesystem_type(){
- case ${clst_fstype} in
- squashfs)
- cmdline_opts="${cmdline_opts} looptype=squashfs loop=/image.squashfs"
- ;;
- jffs2)
- cmdline_opts="${cmdline_opts} looptype=jffs2 loop=/image.jffs2"
- ;;
- esac
-}
--
2.26.2


Reply | Threaded
Open this post in threaded view
|

[PATCH 7/8] targets: Remove unused extract_kernel()

Matt Turner-5
In reply to this post by Matt Turner-5
Evidently the answer to "Do we need this one?" is... not at least since
2006.

Signed-off-by: Matt Turner <[hidden email]>
---
 targets/stage4/controller.sh |  2 --
 targets/support/functions.sh | 32 --------------------------------
 2 files changed, 34 deletions(-)

diff --git a/targets/stage4/controller.sh b/targets/stage4/controller.sh
index 85db8c1b..7ca3e9bc 100755
--- a/targets/stage4/controller.sh
+++ b/targets/stage4/controller.sh
@@ -30,8 +30,6 @@ case $1 in
  delete_from_chroot /tmp/linuxrc
 
  extract_modules ${clst_chroot_path} ${clst_kname}
- # Do we need this one?
-# extract_kernel ${clst_chroot_path}/boot ${clst_kname}
  ;;
 
  build_packages)
diff --git a/targets/support/functions.sh b/targets/support/functions.sh
index ac6710ad..dd9e6b12 100755
--- a/targets/support/functions.sh
+++ b/targets/support/functions.sh
@@ -184,35 +184,3 @@ extract_modules() {
  echo "Can't find kernel modules tarball at ${kmodules}.  Skipping...."
  fi
 }
-extract_kernel() {
- # $1 = Destination
- # $2 = kname
-
- kbinary="${clst_chroot_path}/tmp/kerncache/${2}-kernel-initrd-${clst_version_stamp}.tar.bz2"
- [ ! -e "${kbinary}" ] && die "Can't find kernel tarball at ${kbinary}"
- mkdir -p ${1}/
- tar -I lbzip2 -xf ${kbinary} -C ${1}/
- # change config name from "config-*" to "gentoo", for example
- #mv ${1}/config-* ${1}/${2}-config
- rm ${1}/config-*
-
- # change kernel name from "kernel" to "gentoo", for example
- if [ -e ${1}/kernel-* ]
- then
- mv ${1}/kernel-* ${1}/${2}
- fi
- if [ -e ${1}/vmlinuz-* ]
- then
- mv ${1}/vmlinuz-* ${1}/${2}
- fi
-
- # change initrd name from "initrd" to "gentoo.igz", for example
- if [ -e ${1}/initrd-* ]
- then
- mv ${1}/initrd-* ${1}/${2}.igz
- fi
- if [ -e ${1}/initramfs-* ]
- then
- mv ${1}/initramfs-* ${1}/${2}.igz
- fi
-}
--
2.26.2


Reply | Threaded
Open this post in threaded view
|

[PATCH 8/8] catalyst: Replace target_portdir with repo_basedir+repo_name

Matt Turner-5
In reply to this post by Matt Turner-5
Signed-off-by: Matt Turner <[hidden email]>
---
 catalyst/base/stagebase.py         | 12 +++++++++---
 catalyst/defaults.py               |  2 +-
 doc/catalyst-config.5.txt          | 10 +++++-----
 targets/stage2/chroot.sh           |  2 +-
 targets/support/livecdfs-update.sh |  2 +-
 5 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 7c82029a..ee57d2de 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -192,7 +192,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
         self.mount = MOUNT_DEFAULTS.copy()
 
         self.mount['portdir']['source'] = self.snapshot
-        self.mount['portdir']['target'] = self.settings['target_portdir']
+        self.mount['portdir']['target'] = self.settings['repo_basedir'] + '/' + self.settings['repo_name']
         self.mount['distdir']['source'] = self.settings['distdir']
         self.mount["distdir"]['target'] = self.settings['target_distdir']
 
@@ -803,7 +803,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
         make_profile = Path(self.settings['chroot_path'] + self.settings['port_conf'],
                             'make.profile')
         make_profile.unlink()
-        make_profile.symlink_to(Path('../..' + self.settings['target_portdir'],
+        make_profile.symlink_to(Path('../..' + self.settings['repo_basedir'],
+                                     self.settings['repo_name'],
                                      'profiles',
                                      self.settings['target_profile']),
                                 target_is_directory=True)
@@ -1056,7 +1057,12 @@ class StageBase(TargetBase, ClearBase, GenBase):
                               ' '.join(myuseexpandvars[hostuseexpand]) + '"\n')
 
             # Write non-default PORTDIR/DISTDIR/PKGDIR settings to make.conf
-            for x in ['target_portdir', 'target_distdir', 'target_pkgdir']:
+            if (self.settings['repo_basedir'], self.settings['repo_name']) != \
+               (confdefaults['repo_basedir'], confdefaults['repo_name']):
+                myf.write('PORTDIR="%s/%s"\n' % (self.settings['repo_basedir'],
+                                                 self.settings['repo_name']))
+
+            for x in ['target_distdir', 'target_pkgdir']:
                 if self.settings[x] != confdefaults[x]:
                     varname = x.split('_')[1].upper()
                     myf.write(f'{varname}="{self.settings[x]}"\n')
diff --git a/catalyst/defaults.py b/catalyst/defaults.py
index bbefa3a8..9d5771d5 100644
--- a/catalyst/defaults.py
+++ b/catalyst/defaults.py
@@ -65,6 +65,7 @@ confdefaults = {
     "pkgdir": "/var/cache/binpkgs",
     "port_tmpdir": "/var/tmp/portage",
     "PythonDir": "./catalyst",
+    "repo_basedir": "/var/db/repos",
     "repo_name": "gentoo",
     "repos": "%(storedir)s/repos",
     "sharedir": "/usr/share/catalyst",
@@ -73,7 +74,6 @@ confdefaults = {
     "storedir": "/var/tmp/catalyst",
     "target_distdir": "/var/cache/distfiles",
     "target_pkgdir": "/var/cache/binpkgs",
-    "target_portdir": "/var/db/repos/gentoo",
 }
 
 DEFAULT_CONFIG_FILE = '/etc/catalyst/catalyst.conf'
diff --git a/doc/catalyst-config.5.txt b/doc/catalyst-config.5.txt
index 11b27d90..d5444b38 100644
--- a/doc/catalyst-config.5.txt
+++ b/doc/catalyst-config.5.txt
@@ -108,6 +108,11 @@ Defaults to the host's DISTDIR.
 The directory in which git repositories exist for use by the snapshot target.
 Defaults to `${storedir}/repos`.
 
+*repo_basedir*::
+The target repository directory to contain the primary repo (e.g.,
+gentoo repo) and any overlays.  The default location is
+`/var/db/repos`.
+
 *repo_name*::
 The name of the main repository (e.g. gentoo). The git repository at
 `${repos}/${repo_name}.git` will be used to produce the portdir sqfs
@@ -123,11 +128,6 @@ Defines the location of binary packages in the target.  This will be
 written to the target's make.conf if it is not the default value of
 `/var/cache/binpkgs`.
 
-*target_portdir*::
-Defines the location of the main ebuild repository in the target.
-This will be written to the target's make.conf if it is not the
-default value of `/var/db/repos/gentoo`.
-
 Other settings
 ~~~~~~~~~~~~~~
 
diff --git a/targets/stage2/chroot.sh b/targets/stage2/chroot.sh
index aac9a92d..bf98d328 100755
--- a/targets/stage2/chroot.sh
+++ b/targets/stage2/chroot.sh
@@ -9,7 +9,7 @@ export CONFIG_PROTECT="-* /etc/locale.gen"
 echo "$locales" > /etc/locale.gen
 
 ## START BUILD
-${clst_target_portdir}/scripts/bootstrap.sh ${bootstrap_opts} || exit 1
+${clst_repo_basedir}/${clst_repo_name}/scripts/bootstrap.sh ${bootstrap_opts} || exit 1
 
 # Replace modified /etc/locale.gen with default
 etc-update --automode -5
diff --git a/targets/support/livecdfs-update.sh b/targets/support/livecdfs-update.sh
index 8297e60d..b1049671 100755
--- a/targets/support/livecdfs-update.sh
+++ b/targets/support/livecdfs-update.sh
@@ -257,7 +257,7 @@ case ${clst_livecd_type} in
  USE="-* $(cat /var/db/pkg/sys-libs/glibc*/USE)" emerge -eqp @system | grep -e '^\[ebuild' | sed -e 's:^\[ebuild .\+\] ::' -e 's: .\+$::' > /usr/livecd/systempkgs.txt
 
  # This is my hack to reduce tmpfs usage
- cp -r ${clst_target_portdir}/{profiles,eclass} /usr/livecd
+ cp -r ${clst_repo_basedir}/${clst_repo_name}/{profiles,eclass} /usr/livecd
  rm -rf /usr/livecd/profiles/{co*,default-{1*,a*,b*,d*,h*,i*,m*,p*,s*,x*},g*,hardened-*,n*,x*}
  mv -f /etc/gconf /usr/livecd
  ln -sf /usr/livecd/gconf /etc/gconf
--
2.26.2


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/8] targets: Use gensquashfs instead of mksquashfs

Brian Dolbec-3
In reply to this post by Matt Turner-5
On Fri,  1 May 2020 18:40:29 -0700
Matt Turner <[hidden email]> wrote:

> We're using tar2sqfs from squashfs-tools-ng, so let's replace the
> usage of mksquashfs (from squashfs-tools) with gensquashfs.
>
> Signed-off-by: Matt Turner <[hidden email]>
> ---
>  doc/catalyst-spec.5.txt                 | 4 ++--
>  examples/livecd-stage2_template.spec    | 2 --
>  targets/embedded/fs-runscript.sh        | 6 +++---
>  targets/support/filesystem-functions.sh | 4 ++--
>  4 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/doc/catalyst-spec.5.txt b/doc/catalyst-spec.5.txt
> index f87bd69e..e269e16d 100644
> --- a/doc/catalyst-spec.5.txt
> +++ b/doc/catalyst-spec.5.txt
> @@ -180,8 +180,8 @@ CD.  Possible values are as follows:
>  *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*
> -(example: `-root-owned`).  It is valid for the following fstypes:
> -`squashfs`, `jffs`, `jffs2`, and `cramfs`.
> +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 4cb94d40..3b9ca1da 100644
> --- a/examples/livecd-stage2_template.spec
> +++ b/examples/livecd-stage2_template.spec
> @@ -95,8 +95,6 @@ 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 -# example:
> -# livecd/fsops: -root-owned
>  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 8d5abab1..7e70848b 100755
> --- a/targets/embedded/fs-runscript.sh
> +++ b/targets/embedded/fs-runscript.sh
> @@ -32,9 +32,9 @@ case ${1} in
>   ;;
>  
>   squashfs)
> - fs_check /usr/bin/mksquashfs squashfs
> sys-fs/squashfs-tools
> - mksquashfs ${root_fs_path}
> ${clst_image_path}/root.img \
> - ${clst_embedded_fs_ops} || \
> + fs_check /usr/bin/gensquashfs squashfs
> sys-fs/squashfs-tools-ng
> + gensquashfs -D ${root_fs_path}
> ${clst_embedded_fs_ops} \
> + ${clst_image_path}/root.img ||
>   die "Could not create a squashfs filesystem"
>   ;;
>  
> diff --git a/targets/support/filesystem-functions.sh
> b/targets/support/filesystem-functions.sh index 0c144ba8..03303b14
> 100755 --- a/targets/support/filesystem-functions.sh
> +++ b/targets/support/filesystem-functions.sh
> @@ -55,8 +55,8 @@ create_noloop() {
>  create_squashfs() {
>   echo "Creating squashfs..."
>   export loopname="image.squashfs"
> - mksquashfs "${clst_destpath}" "$1/${loopname}" ${clst_fsops}
> -noappend \
> - || die "mksquashfs failed, did you emerge
> squashfs-tools?"
> + gensquashfs -D "${clst_destpath}" ${clst_fsops}
> "$1/${loopname}" \
> + || die "gensquashfs failed, did you emerge
> squashfs-tools-ng?" }
>  
>  create_jffs() {



This one looks good

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 2/8] targets: Drop most fstypes

Brian Dolbec-3
In reply to this post by Matt Turner-5
On Fri,  1 May 2020 18:40:30 -0700
Matt Turner <[hidden email]> wrote:

> Signed-off-by: Matt Turner <[hidden email]>
> ---
>  doc/catalyst-spec.5.txt                 |  9 +---
>  examples/livecd-stage2_template.spec    |  8 +--
>  targets/embedded/fs-runscript.sh        | 15 ------
>  targets/support/filesystem-functions.sh | 65
> ------------------------- targets/support/functions.sh            |
> 14 ------ targets/support/target_image_setup.sh   | 20 --------
>  6 files changed, 4 insertions(+), 127 deletions(-)
>

Commit message is too short, no exlanation of why they are being
dropped.

Without any reasoning, the actual changes are meaningless to me.





> diff --git a/doc/catalyst-spec.5.txt b/doc/catalyst-spec.5.txt
> index e269e16d..16c8773d 100644
> --- a/doc/catalyst-spec.5.txt
> +++ b/doc/catalyst-spec.5.txt
> @@ -171,17 +171,12 @@ Filesystem
>  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.
> +  `squashfs`;;
> +  `jffs2`;;
>  
>  *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..f4a20cab 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, jffs2
>  # 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, jffs2
>  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 7e70848b..5e339608 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}
> ${clst_embedded_fs_ops} \ ${clst_image_path}/root.img ||
>   die "Could not create a squashfs filesystem"
>   ;;
> -
> - *)
> - ;;
>  esac
>  exit $?
> diff --git a/targets/support/filesystem-functions.sh
> b/targets/support/filesystem-functions.sh index 03303b14..a95ae0b9
> 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" ]


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 3/8] targets: Inline filesystem-functions.sh

Brian Dolbec-3
In reply to this post by Matt Turner-5
On Fri,  1 May 2020 18:40:31 -0700
Matt Turner <[hidden email]> wrote:

> Signed-off-by: Matt Turner <[hidden email]>
> ---

Again, no reasoning




>  targets/support/filesystem-functions.sh | 19 -------------------
>  targets/support/target_image_setup.sh   | 20 ++++++--------------
>  2 files changed, 6 insertions(+), 33 deletions(-)
>  delete mode 100755 targets/support/filesystem-functions.sh
>
> diff --git a/targets/support/filesystem-functions.sh
> b/targets/support/filesystem-functions.sh deleted file mode 100755
> index a95ae0b9..00000000
> --- a/targets/support/filesystem-functions.sh
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -#!/bin/bash
> -
> -# Dont forget to update functions.sh  check_looptype
> -# $1 is the target directory for the filesystem
> -
> -create_squashfs() {
> - echo "Creating squashfs..."
> - export loopname="image.squashfs"
> - gensquashfs -D "${clst_destpath}" ${clst_fsops}
> "$1/${loopname}" \
> - || die "gensquashfs failed, did you emerge
> squashfs-tools-ng?" -}
> -
> -create_jffs2(){
> - echo "Creating jffs2..."
> - export loopname="image.jffs"
> - # fs_check /usr/sbin/mkfs.jffs2 jffs2 sys-fs/mtd
> - mkfs.jffs2 --root=${clst_destpath} --output=$1/${loopname}
> ${clst_fsops} \
> - || die "Could not create a jffs2 filesystem"
> -}
> diff --git a/targets/support/target_image_setup.sh
> b/targets/support/target_image_setup.sh index 423dc4c4..03cb4741
> 100755 --- a/targets/support/target_image_setup.sh
> +++ b/targets/support/target_image_setup.sh
> @@ -1,25 +1,17 @@
>  #!/bin/bash
>  
>  source ${clst_shdir}/support/functions.sh
> -source ${clst_shdir}/support/filesystem-functions.sh
>  
> -# Make the directory if it doesnt exist
> -mkdir -p $1
> +mkdir -p "${1}"
>  
> -loopret=1
> +echo "Creating ${clst_fstype} filesystem"
>  case ${clst_fstype} in
>   squashfs)
> - create_squashfs $1
> - loopret=$?
> + gensquashfs -D "${clst_destpath}" "${clst_fsops}"
> "${1}/image.squashfs" \
> + || die "Failed to create squashfs filesystem"
>   ;;
>   jffs2)
> - create_jffs2 $1
> - loopret=$?
> + mkfs.jffs2 --root="${clst_destpath}"
> --output="${1}/image.jffs" "${clst_fsops}" \
> + || die "Failed to create jffs2 filesystem"
>   ;;
>  esac
> -
> -if [ ${loopret} = "1" ]
> -then
> - die "Filesystem not setup"
> -fi
> -exit $loopret


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 4/8] targets: Remove unused source filesystem-functions.sh

Brian Dolbec-3
In reply to this post by Matt Turner-5
On Fri,  1 May 2020 18:40:32 -0700
Matt Turner <[hidden email]> wrote:

> Signed-off-by: Matt Turner <[hidden email]>
> ---

This one makes more sense if you had mentioned the previous commit that
inlined it.

Perhaps even merge the 2 commits into one


>  targets/embedded/controller.sh      | 1 -
>  targets/livecd-stage2/controller.sh | 1 -
>  targets/netboot/controller.sh       | 1 -
>  targets/support/bootloader-setup.sh | 1 -
>  targets/support/create-iso.sh       | 1 -
>  targets/support/netboot-final.sh    | 1 -
>  6 files changed, 6 deletions(-)
>
> diff --git a/targets/embedded/controller.sh
> b/targets/embedded/controller.sh index 7e33ed49..e40a913f 100755
> --- a/targets/embedded/controller.sh
> +++ b/targets/embedded/controller.sh
> @@ -1,7 +1,6 @@
>  #!/bin/bash
>  
>  source ${clst_shdir}/support/functions.sh
> -source ${clst_shdir}/support/filesystem-functions.sh
>  
>  case ${1} in
>   enter)
> diff --git a/targets/livecd-stage2/controller.sh
> b/targets/livecd-stage2/controller.sh index f9bc7b7e..8ee46d7c 100755
> --- a/targets/livecd-stage2/controller.sh
> +++ b/targets/livecd-stage2/controller.sh
> @@ -1,7 +1,6 @@
>  #!/bin/bash
>  
>  source ${clst_shdir}/support/functions.sh
> -source ${clst_shdir}/support/filesystem-functions.sh
>  
>  case $1 in
>   pre-kmerge)
> diff --git a/targets/netboot/controller.sh
> b/targets/netboot/controller.sh index d6b329e6..f84a32bd 100755
> --- a/targets/netboot/controller.sh
> +++ b/targets/netboot/controller.sh
> @@ -1,7 +1,6 @@
>  #!/bin/bash
>  
>  source ${clst_shdir}/support/functions.sh
> -source ${clst_shdir}/support/filesystem-functions.sh
>  
>  case ${1} in
>   build_packages)
> diff --git a/targets/support/bootloader-setup.sh
> b/targets/support/bootloader-setup.sh index 1564d74a..d507fe5e 100755
> --- a/targets/support/bootloader-setup.sh
> +++ b/targets/support/bootloader-setup.sh
> @@ -1,7 +1,6 @@
>  #!/bin/bash
>  
>  source ${clst_shdir}/support/functions.sh
> -source ${clst_shdir}/support/filesystem-functions.sh
>  
>  # $1 is the destination root
>  
> diff --git a/targets/support/create-iso.sh
> b/targets/support/create-iso.sh index 01b06501..e5ad7060 100755
> --- a/targets/support/create-iso.sh
> +++ b/targets/support/create-iso.sh
> @@ -1,7 +1,6 @@
>  #!/bin/bash
>  
>  source ${clst_shdir}/support/functions.sh
> -source ${clst_shdir}/support/filesystem-functions.sh
>  
>  ## START RUNSCRIPT
>  
> diff --git a/targets/support/netboot-final.sh
> b/targets/support/netboot-final.sh index 52b85f05..f71e4099 100755
> --- a/targets/support/netboot-final.sh
> +++ b/targets/support/netboot-final.sh
> @@ -1,7 +1,6 @@
>  #!/bin/bash
>  
>  source ${clst_shdir}/support/functions.sh
> -source ${clst_shdir}/support/filesystem-functions.sh
>  
>  extract_kernels ${clst_target_path}/boot
>  


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 5/8] targets: Remove run_crossdev() function

Brian Dolbec-3
In reply to this post by Matt Turner-5
On Fri,  1 May 2020 18:40:33 -0700
Matt Turner <[hidden email]> wrote:

> Signed-off-by: Matt Turner <[hidden email]>
> ---

Reason?

>  targets/support/functions.sh | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/targets/support/functions.sh
> b/targets/support/functions.sh index daf6f190..601f5dc9 100755
> --- a/targets/support/functions.sh
> +++ b/targets/support/functions.sh
> @@ -238,7 +238,3 @@ check_filesystem_type(){
>   ;;
>   esac
>  }
> -
> -run_crossdev() {
> - crossdev ${clst_CHOST}
> -}


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 6/8] targets: Inline functions with one caller

Brian Dolbec-3
In reply to this post by Matt Turner-5
On Fri,  1 May 2020 18:40:34 -0700
Matt Turner <[hidden email]> wrote:

> Signed-off-by: Matt Turner <[hidden email]>
> ---

Please list the functions inlined.  That way anyone does not have to
read the actual patch to know.   I know this is short and simple, but
if there were 5 or 6 inlined in as many different files...

otherwise looks fine


>  targets/support/bootloader-setup.sh | 21 +++++++++++++++++++--
>  targets/support/functions.sh        | 22 ----------------------
>  2 files changed, 19 insertions(+), 24 deletions(-)
>
> diff --git a/targets/support/bootloader-setup.sh
> b/targets/support/bootloader-setup.sh index d507fe5e..d3a6b2dc 100755
> --- a/targets/support/bootloader-setup.sh
> +++ b/targets/support/bootloader-setup.sh
> @@ -19,8 +19,25 @@ else
>  fi
>  
>  extract_kernels $1/boot
> -check_bootargs
> -check_filesystem_type
> +
> +# Add any additional options
> +if [ -n "${clst_livecd_bootargs}" ]
> +then
> + for x in ${clst_livecd_bootargs}
> + do
> + cmdline_opts="${cmdline_opts} ${x}"
> + done
> +fi
> +
> +case ${clst_fstype} in
> + squashfs)
> + cmdline_opts="${cmdline_opts} looptype=squashfs
> loop=/image.squashfs"
> + ;;
> + jffs2)
> + cmdline_opts="${cmdline_opts} looptype=jffs2
> loop=/image.jffs2"
> + ;;
> +esac
> +
>  
>  default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts}
> ${custom_kopts} cdroot" [ -n "${clst_splash_theme}" ] &&
> default_append_line="${default_append_line}
> splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1
> quiet" diff --git a/targets/support/functions.sh
> b/targets/support/functions.sh index 601f5dc9..ac6710ad 100755 ---
> a/targets/support/functions.sh +++ b/targets/support/functions.sh @@
> -216,25 +216,3 @@ extract_kernel() { mv ${1}/initramfs-* ${1}/${2}.igz
>   fi
>  }
> -
> -check_bootargs(){
> - # Add any additional options
> - if [ -n "${clst_livecd_bootargs}" ]
> - then
> - for x in ${clst_livecd_bootargs}
> - do
> - cmdline_opts="${cmdline_opts} ${x}"
> - done
> - fi
> -}
> -
> -check_filesystem_type(){
> - case ${clst_fstype} in
> - squashfs)
> - cmdline_opts="${cmdline_opts}
> looptype=squashfs loop=/image.squashfs"
> - ;;
> - jffs2)
> - cmdline_opts="${cmdline_opts} looptype=jffs2
> loop=/image.jffs2"
> - ;;
> - esac
> -}


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 7/8] targets: Remove unused extract_kernel()

Brian Dolbec-3
In reply to this post by Matt Turner-5
On Fri,  1 May 2020 18:40:35 -0700
Matt Turner <[hidden email]> wrote:

> Evidently the answer to "Do we need this one?" is... not at least
> since 2006.
>
> Signed-off-by: Matt Turner <[hidden email]>
> ---


works for me, but slightly more formal explanation would have been
nicer.

>  targets/stage4/controller.sh |  2 --
>  targets/support/functions.sh | 32 --------------------------------
>  2 files changed, 34 deletions(-)
>
> diff --git a/targets/stage4/controller.sh
> b/targets/stage4/controller.sh index 85db8c1b..7ca3e9bc 100755
> --- a/targets/stage4/controller.sh
> +++ b/targets/stage4/controller.sh
> @@ -30,8 +30,6 @@ case $1 in
>   delete_from_chroot /tmp/linuxrc
>  
>   extract_modules ${clst_chroot_path} ${clst_kname}
> - # Do we need this one?
> -# extract_kernel ${clst_chroot_path}/boot
> ${clst_kname} ;;
>  
>   build_packages)
> diff --git a/targets/support/functions.sh
> b/targets/support/functions.sh index ac6710ad..dd9e6b12 100755
> --- a/targets/support/functions.sh
> +++ b/targets/support/functions.sh
> @@ -184,35 +184,3 @@ extract_modules() {
>   echo "Can't find kernel modules tarball at
> ${kmodules}.  Skipping...." fi
>  }
> -extract_kernel() {
> - # $1 = Destination
> - # $2 = kname
> -
> -
> kbinary="${clst_chroot_path}/tmp/kerncache/${2}-kernel-initrd-${clst_version_stamp}.tar.bz2"
> - [ ! -e "${kbinary}" ] && die "Can't find kernel tarball at
> ${kbinary}"
> - mkdir -p ${1}/
> - tar -I lbzip2 -xf ${kbinary} -C ${1}/
> - # change config name from "config-*" to "gentoo", for example
> - #mv ${1}/config-* ${1}/${2}-config
> - rm ${1}/config-*
> -
> - # change kernel name from "kernel" to "gentoo", for example
> - if [ -e ${1}/kernel-* ]
> - then
> - mv ${1}/kernel-* ${1}/${2}
> - fi
> - if [ -e ${1}/vmlinuz-* ]
> - then
> - mv ${1}/vmlinuz-* ${1}/${2}
> - fi
> -
> - # change initrd name from "initrd" to "gentoo.igz", for
> example
> - if [ -e ${1}/initrd-* ]
> - then
> - mv ${1}/initrd-* ${1}/${2}.igz
> - fi
> - if [ -e ${1}/initramfs-* ]
> - then
> - mv ${1}/initramfs-* ${1}/${2}.igz
> - fi
> -}


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 2/8] targets: Drop most fstypes

Matt Turner-5
In reply to this post by Brian Dolbec-3
On Sat, May 2, 2020 at 4:00 PM Brian Dolbec <[hidden email]> wrote:

>
> On Fri,  1 May 2020 18:40:30 -0700
> Matt Turner <[hidden email]> wrote:
>
> > Signed-off-by: Matt Turner <[hidden email]>
> > ---
> >  doc/catalyst-spec.5.txt                 |  9 +---
> >  examples/livecd-stage2_template.spec    |  8 +--
> >  targets/embedded/fs-runscript.sh        | 15 ------
> >  targets/support/filesystem-functions.sh | 65
> > ------------------------- targets/support/functions.sh            |
> > 14 ------ targets/support/target_image_setup.sh   | 20 --------
> >  6 files changed, 4 insertions(+), 127 deletions(-)
> >
>
> Commit message is too short, no exlanation of why they are being
> dropped.

Thanks. Like with lots of other recent changes the general purpose is
to remove long unused features of Catalyst in order to make the code
base more maintainable and understandable.

In this case specifically, I'm removing 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.

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.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 3/8] targets: Inline filesystem-functions.sh

Matt Turner-5
In reply to this post by Brian Dolbec-3
On Sat, May 2, 2020 at 4:03 PM Brian Dolbec <[hidden email]> wrote:
>
> On Fri,  1 May 2020 18:40:31 -0700
> Matt Turner <[hidden email]> wrote:
>
> > Signed-off-by: Matt Turner <[hidden email]>
> > ---
>
> Again, no reasoning

Sorry. I think it's pretty apparent.

Simple functions that are called only from a single place and exist in
a different file should just be inlined.

Should I just add that to the commit message?

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 4/8] targets: Remove unused source filesystem-functions.sh

Matt Turner-5
In reply to this post by Brian Dolbec-3
On Sat, May 2, 2020 at 4:06 PM Brian Dolbec <[hidden email]> wrote:

>
> On Fri,  1 May 2020 18:40:32 -0700
> Matt Turner <[hidden email]> wrote:
>
> > Signed-off-by: Matt Turner <[hidden email]>
> > ---
>
> This one makes more sense if you had mentioned the previous commit that
> inlined it.
>
> Perhaps even merge the 2 commits into one

This commit is fully independent of the previous. They do not touch
any of the same files.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 5/8] targets: Remove run_crossdev() function

Matt Turner-5
In reply to this post by Brian Dolbec-3
On Sat, May 2, 2020 at 4:06 PM Brian Dolbec <[hidden email]> wrote:
>
> On Fri,  1 May 2020 18:40:33 -0700
> Matt Turner <[hidden email]> wrote:
>
> > Signed-off-by: Matt Turner <[hidden email]>
> > ---
>
> Reason?

Because it's never been used in its entire existence. Do you want me
to put that in the commit message? Surely the fact that I can safely
remove it means that it's unused...

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 8/8] catalyst: Replace target_portdir with repo_basedir+repo_name

Brian Dolbec-3
In reply to this post by Matt Turner-5
On Fri,  1 May 2020 18:40:36 -0700
Matt Turner <[hidden email]> wrote:

> Signed-off-by: Matt Turner <[hidden email]>
> ---



Thank you for revesing that.   I have been trying to get away from
legacy use of/meaning of portdir.  Plus I would like to get catlyst
code as bullet-proof/future-proof as possible.  In this way, it would
become easy and logical for derivative distros to re-use and even
contribute back to it's maintenance.  

I would also like to change the use of 'portdir' as the variable name
in self.mount and other locations in the future.  There are too many
legacy references with different meanings that go along with it.

looks good :)


>  catalyst/base/stagebase.py         | 12 +++++++++---
>  catalyst/defaults.py               |  2 +-
>  doc/catalyst-config.5.txt          | 10 +++++-----
>  targets/stage2/chroot.sh           |  2 +-
>  targets/support/livecdfs-update.sh |  2 +-
>  5 files changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
> index 7c82029a..ee57d2de 100644
> --- a/catalyst/base/stagebase.py
> +++ b/catalyst/base/stagebase.py
> @@ -192,7 +192,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
>          self.mount = MOUNT_DEFAULTS.copy()
>  
>          self.mount['portdir']['source'] = self.snapshot
> -        self.mount['portdir']['target'] =
> self.settings['target_portdir']
> +        self.mount['portdir']['target'] =
> self.settings['repo_basedir'] + '/' + self.settings['repo_name']
> self.mount['distdir']['source'] = self.settings['distdir']
> self.mount["distdir"]['target'] = self.settings['target_distdir']
> @@ -803,7 +803,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
>          make_profile = Path(self.settings['chroot_path'] +
> self.settings['port_conf'], 'make.profile')
>          make_profile.unlink()
> -        make_profile.symlink_to(Path('../..' +
> self.settings['target_portdir'],
> +        make_profile.symlink_to(Path('../..' +
> self.settings['repo_basedir'],
> +                                     self.settings['repo_name'],
>                                       'profiles',
>                                       self.settings['target_profile']),
>                                  target_is_directory=True)
> @@ -1056,7 +1057,12 @@ class StageBase(TargetBase, ClearBase,
> GenBase): ' '.join(myuseexpandvars[hostuseexpand]) + '"\n')
>  
>              # Write non-default PORTDIR/DISTDIR/PKGDIR settings to
> make.conf
> -            for x in ['target_portdir', 'target_distdir',
> 'target_pkgdir']:
> +            if (self.settings['repo_basedir'],
> self.settings['repo_name']) != \
> +               (confdefaults['repo_basedir'],
> confdefaults['repo_name']):
> +                myf.write('PORTDIR="%s/%s"\n' %
> (self.settings['repo_basedir'],
> +
> self.settings['repo_name'])) +
> +            for x in ['target_distdir', 'target_pkgdir']:
>                  if self.settings[x] != confdefaults[x]:
>                      varname = x.split('_')[1].upper()
>                      myf.write(f'{varname}="{self.settings[x]}"\n')
> diff --git a/catalyst/defaults.py b/catalyst/defaults.py
> index bbefa3a8..9d5771d5 100644
> --- a/catalyst/defaults.py
> +++ b/catalyst/defaults.py
> @@ -65,6 +65,7 @@ confdefaults = {
>      "pkgdir": "/var/cache/binpkgs",
>      "port_tmpdir": "/var/tmp/portage",
>      "PythonDir": "./catalyst",
> +    "repo_basedir": "/var/db/repos",
>      "repo_name": "gentoo",
>      "repos": "%(storedir)s/repos",
>      "sharedir": "/usr/share/catalyst",
> @@ -73,7 +74,6 @@ confdefaults = {
>      "storedir": "/var/tmp/catalyst",
>      "target_distdir": "/var/cache/distfiles",
>      "target_pkgdir": "/var/cache/binpkgs",
> -    "target_portdir": "/var/db/repos/gentoo",
>  }
>  
>  DEFAULT_CONFIG_FILE = '/etc/catalyst/catalyst.conf'
> diff --git a/doc/catalyst-config.5.txt b/doc/catalyst-config.5.txt
> index 11b27d90..d5444b38 100644
> --- a/doc/catalyst-config.5.txt
> +++ b/doc/catalyst-config.5.txt
> @@ -108,6 +108,11 @@ Defaults to the host's DISTDIR.
>  The directory in which git repositories exist for use by the
> snapshot target. Defaults to `${storedir}/repos`.
>  
> +*repo_basedir*::
> +The target repository directory to contain the primary repo (e.g.,
> +gentoo repo) and any overlays.  The default location is
> +`/var/db/repos`.
> +
>  *repo_name*::
>  The name of the main repository (e.g. gentoo). The git repository at
>  `${repos}/${repo_name}.git` will be used to produce the portdir sqfs
> @@ -123,11 +128,6 @@ Defines the location of binary packages in the
> target.  This will be written to the target's make.conf if it is not
> the default value of `/var/cache/binpkgs`.
>  
> -*target_portdir*::
> -Defines the location of the main ebuild repository in the target.
> -This will be written to the target's make.conf if it is not the
> -default value of `/var/db/repos/gentoo`.
> -
>  Other settings
>  ~~~~~~~~~~~~~~
>  
> diff --git a/targets/stage2/chroot.sh b/targets/stage2/chroot.sh
> index aac9a92d..bf98d328 100755
> --- a/targets/stage2/chroot.sh
> +++ b/targets/stage2/chroot.sh
> @@ -9,7 +9,7 @@ export CONFIG_PROTECT="-* /etc/locale.gen"
>  echo "$locales" > /etc/locale.gen
>  
>  ## START BUILD
> -${clst_target_portdir}/scripts/bootstrap.sh ${bootstrap_opts} ||
> exit 1 +${clst_repo_basedir}/${clst_repo_name}/scripts/bootstrap.sh
> ${bootstrap_opts} || exit 1
>  # Replace modified /etc/locale.gen with default
>  etc-update --automode -5
> diff --git a/targets/support/livecdfs-update.sh
> b/targets/support/livecdfs-update.sh index 8297e60d..b1049671 100755
> --- a/targets/support/livecdfs-update.sh
> +++ b/targets/support/livecdfs-update.sh
> @@ -257,7 +257,7 @@ case ${clst_livecd_type} in
>   USE="-* $(cat /var/db/pkg/sys-libs/glibc*/USE)"
> emerge -eqp @system | grep -e '^\[ebuild' | sed -e 's:^\[ebuild .\+\]
> ::' -e 's: .\+$::' > /usr/livecd/systempkgs.txt # This is my hack to
> reduce tmpfs usage
> - cp -r ${clst_target_portdir}/{profiles,eclass}
> /usr/livecd
> + cp -r
> ${clst_repo_basedir}/${clst_repo_name}/{profiles,eclass} /usr/livecd
> rm -rf
> /usr/livecd/profiles/{co*,default-{1*,a*,b*,d*,h*,i*,m*,p*,s*,x*},g*,hardened-*,n*,x*}
> mv -f /etc/gconf /usr/livecd ln -sf /usr/livecd/gconf /etc/gconf


12