Gentoo Archives: gentoo-catalyst

From: Matt Turner <mattst88@g.o>
To: gentoo-catalyst@l.g.o
Cc: Matt Turner <mattst88@g.o>
Subject: [gentoo-catalyst] [PATCH 2/8] targets: Drop most fstypes
Date: Sat, 02 May 2020 01:40:52
Message-Id: 20200502014036.1039317-2-mattst88@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 1/8] targets: Use gensquashfs instead of mksquashfs by Matt Turner
1 Signed-off-by: Matt Turner <mattst88@g.o>
2 ---
3 doc/catalyst-spec.5.txt | 9 +---
4 examples/livecd-stage2_template.spec | 8 +--
5 targets/embedded/fs-runscript.sh | 15 ------
6 targets/support/filesystem-functions.sh | 65 -------------------------
7 targets/support/functions.sh | 14 ------
8 targets/support/target_image_setup.sh | 20 --------
9 6 files changed, 4 insertions(+), 127 deletions(-)
10
11 diff --git a/doc/catalyst-spec.5.txt b/doc/catalyst-spec.5.txt
12 index e269e16d..16c8773d 100644
13 --- a/doc/catalyst-spec.5.txt
14 +++ b/doc/catalyst-spec.5.txt
15 @@ -171,17 +171,12 @@ Filesystem
16 The fstype is used to determine what sort of CD we should build. This
17 is used to set the type of loopback filesystem that we will use on our
18 CD. Possible values are as follows:
19 - `squashfs`;; This gives the best compression, but requires a kernel patch.
20 - `zisofs`;; This uses in-kernel compression and is supported on all platforms.
21 - `normal`;; This creates a loop without compression.
22 - `noloop`;; This copies the files to the CD directly, without using a
23 - loopback.
24 + `squashfs`;;
25 + `jffs2`;;
26
27 *livecd/fsops*::
28 The fsops are a list of optional parameters that can be passed to the
29 tool which will create the filesystem specified in *livecd/fstype*
30 -It is valid for the following fstypes: `squashfs`, `jffs`, `jffs2`,
31 -and `cramfs`.
32
33 *livecd/iso*::
34 This is the full path and filename to the ISO image that the
35 diff --git a/examples/livecd-stage2_template.spec b/examples/livecd-stage2_template.spec
36 index 3b9ca1da..f4a20cab 100644
37 --- a/examples/livecd-stage2_template.spec
38 +++ b/examples/livecd-stage2_template.spec
39 @@ -83,18 +83,14 @@ kerncache_path:
40
41 # The fstype is used to determine what sort of CD we should build. This is
42 # used to set the type of loopback filesystem that we will use on our CD.
43 -# Possible options are as follows:
44 -# squashfs - This gives the best compression, but requires a kernel patch.
45 -# zisofs - This uses in-kernel compression and is supported on all platforms.
46 -# normal - This creates a loop without compression.
47 -# noloop - This copies the files to the CD directly, without using a loopback.
48 +# Possible options are as follows: squashfs, jffs2
49 # example:
50 # livecd/fstype: squashfs
51 livecd/fstype:
52
53 # The fsops are a list of optional parameters that can be passed to the tool
54 # which will create the filesystem specified in livecd/fstype. It is valid for
55 -# the following fstypes: squashfs, jffs, jffs2, cramfs
56 +# the following fstypes: squashfs, jffs2
57 livecd/fsops:
58
59 # The cdtar is essentially the bootloader for the CD. It also holds the main
60 diff --git a/targets/embedded/fs-runscript.sh b/targets/embedded/fs-runscript.sh
61 index 7e70848b..5e339608 100755
62 --- a/targets/embedded/fs-runscript.sh
63 +++ b/targets/embedded/fs-runscript.sh
64 @@ -13,32 +13,17 @@ fs_check() {
65 }
66
67 case ${1} in
68 - jffs)
69 - fs_check /usr/sbin/mkfs.jffs jffs sys-fs/mtd
70 - mkfs.jffs -d ${root_fs_path} -o ${clst_image_path}/root.img \
71 - ${clst_embedded_fs_ops} || die "Could not create a jffs filesystem"
72 - ;;
73 jffs2)
74 fs_check /usr/sbin/mkfs.jffs2 jffs2 sys-fs/mtd
75 mkfs.jffs2 --root=${root_fs_path} --output=${clst_image_path}/root.img\
76 ${clst_embedded_fs_ops} || die "Could not create a jffs2 filesystem"
77 ;;
78
79 - cramfs)
80 - fs_check /sbin/mkcramfs cramfs sys-fs/cramfs
81 - mkcramfs ${clst_embedded_fs_ops} ${root_fs_path} \
82 - ${clst_image_path}/root.img || \
83 - die "Could not create a cramfs filesystem"
84 - ;;
85 -
86 squashfs)
87 fs_check /usr/bin/gensquashfs squashfs sys-fs/squashfs-tools-ng
88 gensquashfs -D ${root_fs_path} ${clst_embedded_fs_ops} \
89 ${clst_image_path}/root.img ||
90 die "Could not create a squashfs filesystem"
91 ;;
92 -
93 - *)
94 - ;;
95 esac
96 exit $?
97 diff --git a/targets/support/filesystem-functions.sh b/targets/support/filesystem-functions.sh
98 index 03303b14..a95ae0b9 100755
99 --- a/targets/support/filesystem-functions.sh
100 +++ b/targets/support/filesystem-functions.sh
101 @@ -3,55 +3,6 @@
102 # Dont forget to update functions.sh check_looptype
103 # $1 is the target directory for the filesystem
104
105 -create_normal_loop() {
106 - export source_path="${clst_destpath}"
107 - export destination_path="$1"
108 - export loopname="image.loop"
109 -
110 - # We get genkernel-built kernels and initrds in place, create the loopback
111 - # file system on $clst_target_path, mount it, copy our bootable filesystem
112 - # over, umount it, and have a ready-to-burn ISO tree at $clst_target_path.
113 -
114 - echo "Calculating size of loopback filesystem..."
115 - loopsize=`du -ks ${source_path} | cut -f1`
116 - [ "${loopsize}" = "0" ] && loopsize=1
117 - # Add 4MB for filesystem slop
118 - loopsize=`expr ${loopsize} + 4096`
119 - echo "Creating loopback file..."
120 - dd if=/dev/zero of=${destination_path}/${loopname} bs=1k count=${loopsize} \
121 - || die "${loopname} creation failure"
122 - mke2fs -m 0 -F -q ${destination_path}/${loopname} \
123 - || die "Couldn't create ext2 filesystem"
124 - install -d ${destination_path}/loopmount
125 - sync; sync; sleep 3 # Try to work around 2.6.0+ loopback bug
126 - mount -t ext2 -o loop ${destination_path}/${loopname} \
127 - ${destination_path}/loopmount \
128 - || die "Couldn't mount loopback ext2 filesystem"
129 - sync; sync; sleep 3 # Try to work around 2.6.0+ loopback bug
130 - echo "cp -pPR ${source_path}/* ${destination_path}/loopmount"
131 - cp -pPR ${source_path}/* ${destination_path}/loopmount
132 - [ $? -ne 0 ] && { umount ${destination_path}/${loopname}; \
133 - die "Couldn't copy files to loopback ext2 filesystem"; }
134 - umount ${destination_path}/loopmount \
135 - || die "Couldn't unmount loopback ext2 filesystem"
136 - rm -rf ${destination_path}/loopmount
137 - # Now, $clst_target_path should contain a proper bootable image for our
138 - # ISO, including boot loader and loopback filesystem.
139 -}
140 -
141 -create_zisofs() {
142 - rm -rf "$1/zisofs" > /dev/null 2>&1
143 - echo "Creating zisofs..."
144 - mkzftree -z 9 -p2 "${clst_destpath}" "$1/zisofs" \
145 - || die "Could not run mkzftree, did you emerge zisofs"
146 -}
147 -
148 -create_noloop() {
149 - echo "Copying files for image (no loop)..."
150 - cp -pPR "${clst_destpath}"/* "$1" \
151 - || die "Could not copy files to image (no loop)"
152 -}
153 -
154 create_squashfs() {
155 echo "Creating squashfs..."
156 export loopname="image.squashfs"
157 @@ -59,14 +10,6 @@ create_squashfs() {
158 || die "gensquashfs failed, did you emerge squashfs-tools-ng?"
159 }
160
161 -create_jffs() {
162 - echo "Creating jffs..."
163 - export loopname="image.jffs"
164 - # fs_check /usr/sbin/mkfs.jffs jffs sys-fs/mtd
165 - mkfs.jffs -d ${clst_destpath} -o $1/${loopname} ${clst_fsops} \
166 - || die "Could not create a jffs filesystem"
167 -}
168 -
169 create_jffs2(){
170 echo "Creating jffs2..."
171 export loopname="image.jffs"
172 @@ -74,11 +17,3 @@ create_jffs2(){
173 mkfs.jffs2 --root=${clst_destpath} --output=$1/${loopname} ${clst_fsops} \
174 || die "Could not create a jffs2 filesystem"
175 }
176 -
177 -create_cramfs(){
178 - echo "Creating cramfs..."
179 - export loopname="image.cramfs"
180 - #fs_check /sbin/mkcramfs cramfs sys-fs/cramfs
181 - mkcramfs ${clst_fsops} ${clst_destpath} $1/${loopname} \
182 - || die "Could not create a cramfs filesystem"
183 -}
184 diff --git a/targets/support/functions.sh b/targets/support/functions.sh
185 index 9da13baf..daf6f190 100755
186 --- a/targets/support/functions.sh
187 +++ b/targets/support/functions.sh
188 @@ -230,26 +230,12 @@ check_bootargs(){
189
190 check_filesystem_type(){
191 case ${clst_fstype} in
192 - normal)
193 - cmdline_opts="${cmdline_opts} looptype=normal loop=/image.loop"
194 - ;;
195 - zisofs)
196 - cmdline_opts="${cmdline_opts} looptype=zisofs loop=/zisofs"
197 - ;;
198 - noloop)
199 - ;;
200 squashfs)
201 cmdline_opts="${cmdline_opts} looptype=squashfs loop=/image.squashfs"
202 ;;
203 - jffs)
204 - cmdline_opts="${cmdline_opts} looptype=jffs loop=/image.jffs"
205 - ;;
206 jffs2)
207 cmdline_opts="${cmdline_opts} looptype=jffs2 loop=/image.jffs2"
208 ;;
209 - cramfs)
210 - cmdline_opts="${cmdline_opts} looptype=cramfs loop=/image.cramfs"
211 - ;;
212 esac
213 }
214
215 diff --git a/targets/support/target_image_setup.sh b/targets/support/target_image_setup.sh
216 index 559bc56c..423dc4c4 100755
217 --- a/targets/support/target_image_setup.sh
218 +++ b/targets/support/target_image_setup.sh
219 @@ -8,34 +8,14 @@ mkdir -p $1
220
221 loopret=1
222 case ${clst_fstype} in
223 - normal)
224 - create_normal_loop $1
225 - loopret=$?
226 - ;;
227 - zisofs)
228 - create_zisofs $1
229 - loopret=$?
230 - ;;
231 - noloop)
232 - create_noloop $1
233 - loopret=$?
234 - ;;
235 squashfs)
236 create_squashfs $1
237 loopret=$?
238 ;;
239 - jffs)
240 - create_jffs $1
241 - loopret=$?
242 - ;;
243 jffs2)
244 create_jffs2 $1
245 loopret=$?
246 ;;
247 - cramfs)
248 - create_cramfs $1
249 - loopret=$?
250 - ;;
251 esac
252
253 if [ ${loopret} = "1" ]
254 --
255 2.26.2

Replies

Subject Author
Re: [gentoo-catalyst] [PATCH 2/8] targets: Drop most fstypes Brian Dolbec <dolsen@g.o>