Gentoo Archives: gentoo-genkernel

From: "Rick \\\"Zero_Chaos\\\" Farina" <zerochaos@g.o>
To: gentoo-genkernel@l.g.o
Subject: Re: [gentoo-genkernel] RFC: aufs and modules support
Date: Tue, 07 Aug 2012 23:15:27
Message-Id: 5021A1DB.9080001@gentoo.org
In Reply to: [gentoo-genkernel] RFC: aufs and modules support by "Rick \\\"Zero_Chaos\\\" Farina"
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 BUMP
5
6 Any comments?
7
8 - -ZC
9
10 On 08/04/2012 11:00 PM, Rick "Zero_Chaos" Farina wrote:
11 > It pains me to drop this patch in here, because it's like kicking a
12 > child out of the house, but it's time to reintegrate into gentoo.
13 >
14 > I've yet to test this exact version (takes a long time to build my
15 > livecd). Please look over this code while I'm waiting to test, but I
16 > know the aufs stuff works and I *believe* I fixed the modules support.
17 >
18 > Let the abuse begin! :-)
19 >
20 > Thanks!
21 > Zero
22 >
23 > diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
24 > index 73fe4c9..aa265bc 100755
25 > --- a/defaults/initrd.defaults
26 > +++ b/defaults/initrd.defaults
27 > @@ -73,6 +73,7 @@ CDROOT_TYPE='auto'
28 > NEW_ROOT='/newroot'
29 > CDROOT_PATH='/mnt/cdrom'
30 > CONSOLE='/dev/console'
31 > +MODULESD="mnt/cdrom"
32 >
33 > LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs
34 > /livecd.gcloop'
35 >
36 > diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
37 > index 082d44d..e0de42f 100755
38 > --- a/defaults/initrd.scripts
39 > +++ b/defaults/initrd.scripts
40 > @@ -207,6 +207,192 @@ mount_sysfs() {
41 > [ ${ret} -eq 0 ] || bad_msg "Failed to mount /sys!"
42 > }
43 >
44 > +# Insert a directory tree $2 to an union specified by $1
45 > +# Top-level read-write branch is specified by it's index 0
46 > +# $1 = union absolute path (starting with /)
47 > +# $2 = path to data directory
48 > +#
49 > +union_insert_dir() {
50 > + # Always mount it over the precedent (add:1:)
51 > + mount -n -o remount,add:1:$2=rr aufs $1
52 > + if [ $? = '0' ]
53 > + then
54 > + good_msg "Addition of $2 to $1 successful"
55 > + fi
56 > +}
57 > +
58 > +# Insert all modules found in $1, usually mnt/cdrom
59 > +# added to allow users to add their own apps.
60 > +union_insert_modules() {
61 > + for module in `ls ${NEW_ROOT}/$1/modules/*.mo 2>/dev/null| sort`
62 > + do
63 > + mkdir -p ${MEMORY}/modules/`basename ${module} .mo`
64 > + union_insert_dir $UNION ${MEMORY}/modules/`basename ${module} .mo`
65 > + done
66 > + for module in `ls ${NEW_ROOT}/$1/modules/*.lzm 2>/dev/null| sort`
67 > + do
68 > + mkdir -p ${MEMORY}/modules/`basename ${module} .lzm`
69 > + mount -o loop,ro ${module} ${MEMORY}/modules/`basename ${module} .lzm`
70 > + union_insert_dir $UNION ${MEMORY}/modules/`basename ${module} .lzm`
71 > + done
72 > +}
73 > +
74 > +# Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint
75 > +create_changefs() {
76 > + local size
77 > + while [ 1 ]
78 > + do
79 > + read -p '<< Size of file (Enter for default 256 Mb): ' size
80 > + if [ -z "$size" ]; then
81 > + let size=256
82 > + fi
83 > + let size="$size"
84 > + if [ $size -lt 16 ]
85 > + then
86 > + bad_msg "Please give a size of at least 16 Mb"
87 > + else
88 > + dd if=/dev/zero of=$CHANGESMNT/livecd.aufs bs=1M count=$size
89 > + if [ $? = '0' ]
90 > + then
91 > + good_msg "Creation of livecd.aufs, $size Mb on $CHANGESDEV
92 > successful, formatting it ext2"
93 > + mke2fs -F $CHANGESMNT/livecd.aufs
94 > + break
95 > + else
96 > + rm -f $CHANGESMNT/livecd.aufs
97 > + bad_msg "Unable to create livecd.aufs on $CHANGESDEV of $size Mb"
98 > + bad_msg "Please give a size of at least 16 Mb"
99 > + bad_msg "Also check if your disk is full or read-only ?"
100 > + read -p '<< Type "a" to abort, anything else to continue : ' doabort
101 > + if [ "$doabort" = "a" ]; then
102 > + return 1
103 > + fi
104 > + fi
105 > + fi
106 > + done
107 > + return 0
108 > +}
109 > +
110 > +setup_aufs() {
111 > + if [ "${USE_AUFS_NORMAL}" -eq '1' ]
112 > + then
113 > + # Directory used for rw changes in union mount filesystem
114 > + UNION=/union
115 > + MEMORY=/memory
116 > + # Mountpoint for the changesdev
117 > + CHANGESMNT=$NEW_ROOT/mnt/changesdev
118 > + if [ -z "$UID" ]
119 > + then
120 > + CHANGES=$MEMORY/aufs_changes/default
121 > + else
122 > + CHANGES=$MEMORY/aufs_changes/$UID
123 > + fi
124 > +
125 > + mkdir -p ${MEMORY}
126 > + mkdir -p ${UNION}
127 > + mkdir -p ${CHANGESMNT}
128 > + for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd
129 > mnt/gentoo sys
130 > + do
131 > + mkdir -p "${NEW_ROOT}/${i}"
132 > + chmod 755 "${NEW_ROOT}/${i}"
133 > + done
134 > + [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
135 > + [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console
136 > c 5 1
137 > +
138 > + bootstrapCD
139 > + if [ -n "${AUFS}" ]
140 > + then
141 > + if [ "${AUFS}" = "detect" ]
142 > + then
143 > + CHANGESMNT="${NEW_ROOT}/mnt/cdrom"
144 > + CHANGESDEV=${REAL_ROOT}
145 > + else
146 > + CHANGESDEV=${AUFS}
147 > + good_msg "mounting $CHANGESDEV to $MEMORY for aufs support"
148 > + # mount -t auto $CHANGESDEV $MEMORY
149 > + mount -t auto $CHANGESDEV $CHANGESMNT
150 > + ret=$?
151 > + if [ "${ret}" -ne 0 ]
152 > + then
153 > + bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based
154 > aufs"
155 > + unset AUFS
156 > + fi
157 > + fi
158 > + # Check and attempt to create the changesfile
159 > + if [ ! -e $CHANGESMNT/livecd.aufs ] && [ -n "${AUFS}" ]
160 > + then
161 > + create_changefs
162 > + mount -t auto $CHANGESMNT/livecd.aufs $MEMORY
163 > + elif [ -n "${AUFS}" ]
164 > + then
165 > + local nbpass=0
166 > + while [ 1 ]
167 > + do
168 > + mount -t auto $CHANGESMNT/livecd.aufs $MEMORY
169 > + ret=$?
170 > + if [ "${ret}" -ne 0 ]
171 > + then
172 > + if [ $nbpass -eq 0 ]
173 > + then
174 > + bad_msg "mounting of changes file failed, Running e2fsck"
175 > + e2fsck $CHANGESMNT/livecd.aufs
176 > + nbpass=$(($nbpass + 1))
177 > + else
178 > + bad_msg "mount of $CHANGESDEV failed falling back to ramdisk
179 > based aufs"
180 > + bad_msg "your livecd.aufs might be messed up, and I couldn't fix it"
181 > + bad_msg "moving livecd.aufs to livecd.aufs.bad"
182 > + mv $CHANGESMNT/livecd.aufs $CHANGESMNT/livecd.aufs.bad
183 > + bad_msg "try to fix it yourself with e2fsck later on, sorry for
184 > disturbing"
185 > + break
186 > + fi
187 > + else
188 > + if [ $nbpass -eq 1 ]
189 > + then
190 > + good_msg "e2fsck seemed successful. Please check your files
191 > after bootup"
192 > + fi
193 > + break
194 > + fi
195 > + done
196 > + if [ -f ${MEMORY}/.doclean.sh ]
197 > + then
198 > + good_msg "finishing the permanent changes cleanup"
199 > + . ${MEMORY}/.doclean.sh
200 > + rm ${MEMORY}/.doclean.sh
201 > + fi
202 > + fi
203 > + # mount tmpfs only in the case when changes= boot parameter was
204 > + # empty or we were not able to mount the storage device
205 > + if [ "${CDROOT}" -eq '1' -a ! -f ${CHANGESMNT}/livecd.aufs ]
206 > + then
207 > + umount $MEMORY
208 > + bad_msg "failed to find livecd.aufs file on $CHANGESDEV"
209 > + bad_msg "create an ext2 livecd.aufs file on this device if you wish
210 > to use it for aufs"
211 > + bad_msg "falling back to ramdisk based aufs for safety"
212 > + mount -t tmpfs tmpfs $MEMORY
213 > + XINO=$MEMORY
214 > + else
215 > + XINO=$MEMORY/xino
216 > + mkdir -p $XINO
217 > + mount -t tmpfs tmpfs $XINO
218 > + fi
219 > + else
220 > + good_msg "Mounting ramdisk to $MEMORY for aufs support..."
221 > + mount -t tmpfs tmpfs $MEMORY
222 > + XINO=$MEMORY
223 > + fi
224 > +
225 > + mkdir -p $CHANGES
226 > + mount -t aufs -n -o
227 > nowarn_perm,udba=none,xino=$XINO/.aufs.xino,br:$CHANGES=rw aufs ${UNION}
228 > + ret=$?
229 > + if [ "${ret}" -ne 0 ]
230 > + then
231 > + bad_msg "Can't setup union ${UNION} in directory!"
232 > + USE_AUFS_NORMAL=0
233 > + fi
234 > + else
235 > + USE_AUFS_NORMAL=0
236 > + fi
237 > +}
238 > +
239 > findnfsmount() {
240 > if [ "${IP}" != '' ] || busybox udhcpc -n -T 15 -q
241 > then
242 > diff --git a/defaults/linuxrc b/defaults/linuxrc
243 > index f434339..5e2d1b8 100755
244 > --- a/defaults/linuxrc
245 > +++ b/defaults/linuxrc
246 > @@ -229,6 +229,38 @@ do
247 > aufs)
248 > USE_AUFS_NORMAL=1
249 > ;;
250 > + aufs\=*)
251 > + USE_AUFS_NORMAL=1
252 > + CMD_AUFS=`parse_opt "${x}"`
253 > + echo ${CMD_AUFS}|grep , >/dev/null 2>&1
254 > + if [ "$?" -eq '0' ]
255 > + then
256 > + UID=`echo ${CMD_AUFS#*,}`
257 > + AUFS=`echo ${CMD_AUFS%,*}`
258 > + else
259 > + AUFS=${CMD_AUFS}
260 > + fi
261 > + ;;
262 > + changes\=*)
263 > + USE_AUFS_NORMAL=1
264 > + CMD_AUFS=`parse_opt "${x}"`
265 > + echo ${CMD_AUFS}|grep , >/dev/null 2>&1
266 > + if [ "$?" -eq '0' ]
267 > + then
268 > + UID=`echo ${CMD_AUFS#*,}`
269 > + AUFS=`echo ${CMD_AUFS%,*}`
270 > + else
271 > + AUFS=${CMD_AUFS}
272 > + fi
273 > + ;;
274 > + persistent)
275 > + USE_AUFS_NORMAL=1
276 > + AUFS="detect"
277 > + ;;
278 > + # Allow user to specify the modules location
279 > + modules\=*)
280 > + MODULESD=`parse_opt "${x}"`
281 > + ;;
282 > unionfs)
283 > if [ ! -x /sbin/unionfs ]
284 > then
285 > @@ -406,17 +438,23 @@ rundebugshell
286 >
287 > if [ "${CDROOT}" = '1' ]
288 > then
289 > - good_msg "Making tmpfs for ${NEW_ROOT}"
290 > - mount -n -t tmpfs tmpfs "${NEW_ROOT}"
291 > + setup_aufs
292 > + if [ "${USE_AUFS_NORMAL}" -eq '1' ]
293 > + then
294 > + CHROOT=${UNION}
295 > + else
296 > + CHROOT=${NEW_ROOT}
297 > + good_msg "Making tmpfs for ${NEW_ROOT}"
298 > + mount -t tmpfs tmpfs ${NEW_ROOT}
299 >
300 > - for i in dev mnt mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
301 > - do
302 > - mkdir -p "${NEW_ROOT}/${i}"
303 > - chmod 755 "${NEW_ROOT}/${i}"
304 > - done
305 > - [ ! -d "${CDROOT_PATH}" ] && mkdir -p "${CDROOT_PATH}"
306 > - [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
307 > - [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console
308 > c 5 1
309 > + for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd
310 > mnt/gentoo sys
311 > + do
312 > + mkdir -p "${NEW_ROOT}/${i}"
313 > + chmod 755 "${NEW_ROOT}/${i}"
314 > + done
315 > + [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
316 > + [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console
317 > c 5 1
318 > + fi
319 >
320 > # For SGI LiveCDs ...
321 > if [ "${LOOPTYPE}" = "sgimips" ]
322 > @@ -432,7 +470,7 @@ then
323 > [ ! -e "${NEW_ROOT}/dev/tty1" ] && mknod "${NEW_ROOT}/dev/tty1" c 4 1
324 > fi
325 >
326 > - if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ]
327 > + if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ]
328 > && [ "${USE_AUFS_NORMAL}" != '1' ]
329 > then
330 > bootstrapCD
331 > fi
332 > @@ -748,7 +786,23 @@ then
333 > fi
334 > fi
335 >
336 > + if [ "${USE_AUFS_NORMAL}" -eq '1' ]
337 > + then
338 > + union_insert_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION}
339 >
340 > + # Make sure fstab notes livecd is mounted ro. Makes system skip
341 > remount which fails on aufs dirs.
342 > + sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|'
343 > /${UNION}/etc/fstab /${UNION}/etc/fstab.new
344 > + mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab
345 > + warn_msg "Adding all modules in $MODULESD/modules/"
346 > + if [ "${MODULESD}" = "mnt/cdrom" ]
347 > + then
348 > + union_insert_modules mnt/cdrom
349 > + else
350 > + mkdir ${NEW_ROOT}/mnt/modulesd
351 > + mount "${MODULESD}" ${NEW_ROOT}/mnt/modulesd
352 > + union_insert_modules ${NEW_ROOT}/mnt/modulesd
353 > + fi
354 > + fi
355 >
356 > # Unpacking additional packages from NFS mount
357 > # This is useful for adding kernel modules to /lib
358 > @@ -771,57 +825,57 @@ then
359 > then
360 > setup_unionfs ${NEW_ROOT} /${FS_LOCATION}
361 > CHROOT=/union
362 > - elif [ "${USE_AUFS_NORMAL}" != '1' ]; then
363 > -
364 > - good_msg "Copying read-write image contents to tmpfs"
365 > - # Copy over stuff that should be writable
366 > - (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}")
367 > || {
368 > - bad_msg "Copying failed, dropping into a shell."
369 > - do_rundebugshell
370 > - }
371 > -
372 > - # Now we do the links.
373 > - for x in ${ROOT_LINKS}
374 > - do
375 > - if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]
376 > + else
377 > + #XXX this hunk confuses me more than a little and needs to be
378 > rewritten sanely at some point
379 > + if [ ! "${USE_AUFS_NORMAL}" -eq '1' ]
380 > then
381 > - ln -s "$(readlink ${NEW_ROOT}/${FS_LOCATION}/${x})" "${x}" 2>/dev/null
382 > - else
383 > - # List all subdirectories of x
384 > - find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null | while
385 > read directory
386 > - do
387 > - # Strip the prefix of the FS_LOCATION
388 > - directory="${directory#${NEW_ROOT}/${FS_LOCATION}/}"
389 > + good_msg "Copying read-write image contents to tmpfs"
390 > + # Copy over stuff that should be writable
391 > + (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}")
392 >
393 > - # Skip this directory if we already linked a parent directory
394 > - if [ "${current_parent}" != '' ]; then
395 > - var=$(echo "${directory}" | grep "^${current_parent}")
396 > - if [ "${var}" != '' ]; then
397 > - continue
398 > - fi
399 > - fi
400 > - # Test if the directory exists already
401 > - if [ -e "/${NEW_ROOT}/${directory}" ]
402 > + # Now we do the links.
403 > + for x in ${ROOT_LINKS}
404 > + do
405 > + if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]
406 > then
407 > - # It does exist, link all the individual files
408 > - for file in $(ls /${NEW_ROOT}/${FS_LOCATION}/${directory})
409 > + ln -s "`readlink ${NEW_ROOT}/${FS_LOCATION}/${x}`" "${x}" 2>/dev/null
410 > + else
411 > + # List all subdirectories of x
412 > + find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null | while
413 > read directory
414 > do
415 > - if [ ! -d "/${NEW_ROOT}/${FS_LOCATION}/${directory}/${file}" ] &&
416 > [ ! -e "${NEW_ROOT}/${directory}/${file}" ]; then
417 > - ln -s "/${FS_LOCATION}/${directory}/${file}"
418 > "${directory}/${file}" 2/dev/null
419 > + # Strip the prefix of the FS_LOCATION
420 > + directory="${directory#${NEW_ROOT}/${FS_LOCATION}/}"
421 > +
422 > + # Skip this directory if we already linked a parent directory
423 > + if [ "${current_parent}" != '' ]; then
424 > + var=`echo "${directory}" | grep "^${current_parent}"`
425 > + if [ "${var}" != '' ]; then
426 > + continue
427 > + fi
428 > + fi
429 > + # Test if the directory exists already
430 > + if [ -e "/${NEW_ROOT}/${directory}" ]
431 > + then
432 > + # It does exist, link all the individual files
433 > + for file in `ls /${NEW_ROOT}/${FS_LOCATION}/${directory}`
434 > + do
435 > + if [ ! -d "/${NEW_ROOT}/${FS_LOCATION}/${directory}/${file}" ]
436 > && [ ! -e "${NEW_ROOT}/${directory}/${file}" ]; then
437 > + ln -s "/${FS_LOCATION}/${directory}/${file}"
438 > "${directory}/${file}" 2/dev/null
439 > + fi
440 > + done
441 > + else
442 > + # It does not exist, make a link to the livecd
443 > + ln -s "/${FS_LOCATION}/${directory}" "${directory}" 2>/dev/null
444 > + current_parent="${directory}"
445 > fi
446 > done
447 > - else
448 > - # It does not exist, make a link to the livecd
449 > - ln -s "/${FS_LOCATION}/${directory}" "${directory}" 2>/dev/null
450 > - current_parent="${directory}"
451 > fi
452 > done
453 > - fi
454 > - done
455 > -
456 > - mkdir initramfs proc tmp sys run 2>/dev/null
457 > - chmod 1777 tmp
458 > + mkdir initramfs proc tmp sys 2>/dev/null
459 > + chmod 1777 tmp
460 >
461 > + fi
462 > + #XXX: end extremely confusing hunk
463 > fi
464 >
465 > #UML=$(cat /proc/cpuinfo|grep UML|sed -e 's|model name.*: ||')
466 > @@ -842,13 +896,18 @@ else
467 > setup_unionfs /union_changes ${NEW_ROOT}
468 > mkdir -p ${UNION}/tmp/.initrd
469 > fi
470 > + if [ "${USE_AUFS_NORMAL}" -eq '1' ]
471 > + then
472 > + union_insert_dir ${UNION} ${NEW_ROOT}
473 > + mkdir -p ${UNION}/tmp/.initrd
474 > + fi
475 > fi
476 >
477 > # Mount the additional things as required by udev & systemd
478 > if [ -f ${NEW_ROOT}/etc/initramfs.mounts ]; then
479 > fslist=$(get_mounts_list)
480 > else
481 > - fslist="/usr"
482 > + fslist="/usr"
483 > fi
484 >
485 > for fs in $fslist; do
486 > @@ -886,6 +945,35 @@ fi
487 >
488 > verbose_kmsg
489 >
490 > +if [ "${USE_AUFS_NORMAL}" -eq '1' ]
491 > +then
492 > + mkdir -p /${CHROOT}/.unions/memory 2>/dev/null
493 > + mount -o move /memory /${CHROOT}/.unions/memory || echo '*: Failed to
494 > move aufs /memory into the system root!'
495 > + for i in tmp var/tmp mnt/gentoo mnt/livecd
496 > + do
497 > + mkdir -p ${CHROOT}/$i
498 > + chmod 755 ${CHROOT}/$i
499 > + done
500 > + # This will prevent from putting junk on the CHANGESDEV
501 > + mkdir -p ${CHROOT}/usr/portage/distfiles
502 > + mount -t tmpfs tmpfs ${CHROOT}/var/tmp
503 > + mount -t tmpfs tmpfs ${CHROOT}/tmp
504 > + mount -t tmpfs tmpfs ${CHROOT}/usr/portage/distfiles
505 > + warn_msg "/tmp /var/tmp /usr/portage/distfiles are mounted in ram"
506 > + warn_msg "consider saving important files elsewhere..."
507 > + read -t 3 UNUSEDVAL
508 > + mount -o bind ${NEW_ROOT}/mnt/cdrom ${CHROOT}/mnt/cdrom
509 > + mount -o bind ${NEW_ROOT}/mnt/livecd ${CHROOT}/mnt/livecd
510 > + if [ -e $MEMORY/keyboard -a "${CDROOT}" -eq '1' ]
511 > + then
512 > + cp $MEMORY/keyboard ${CHROOT}/etc/sysconfig/keyboard
513 > + elif [ -e /etc/sysconfig/keyboard -a "${CDROOT}" -eq '1' ]
514 > + then
515 > + mkdir -p ${NEW_ROOT}/etc/sysconfig/
516 > + cp /etc/sysconfig/keyboard ${CHROOT}/etc/sysconfig/keyboard
517 > + fi
518 > +fi
519 > +
520 > echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting (initramfs)${NORMAL}"
521 >
522 > cd "${CHROOT}"
523 > diff --git a/gen_compile.sh b/gen_compile.sh
524 > index cbd3432..cdd4643 100755
525 > --- a/gen_compile.sh
526 > +++ b/gen_compile.sh
527 > @@ -565,6 +565,58 @@ compile_device_mapper() {
528 > compile_lvm
529 > }
530 >
531 > +compile_e2fstools() {
532 > + if [ -f "${E2FSPROGS_BINCACHE}" ]
533 > + then
534 > + print_info 1 "e2fstools: >Using cache"
535 > + else
536 > + [ ! -f "${E2FSPROGS_SRCTAR}" ] &&
537 > + gen_die "Could not find e2fsprogs source tarball:
538 > ${E2FSPROGS_SRCTAR}. Please place it there, or place another version,
539 > changing /etc/genkernel.conf as necessary!"
540 > + cd "${TEMP}"
541 > + rm -rf "${E2FSPROGS_DIR}"
542 > + tar -zxpf "${E2FSPROGS_SRCTAR}"
543 > + [ ! -d "${E2FSPROGS_DIR}" ] &&
544 > + gen_die "e2fsprogs directory ${E2FSPROGS_DIR} invalid"
545 > + cd "${E2FSPROGS_DIR}"
546 > + print_info 1 'e2fsprogs: >Configuring...'
547 > + LDFLAGS="-static" ./configure >${LOGFILE} 2>&1 ||
548 > + gen_die 'Configuring e2fsprogs failed!'
549 > + print_info 1 'e2fsprogs: >Compiling libs...'
550 > + #MAKE=${UTILS_MAKE} compile_generic "" ""
551 > + make libs >${LOGFILE} 2>&1 ||
552 > + gen_die 'Compiling e2fsprogs libs failed!'
553 > + print_info 1 'e2fsprogs: >Compiling e2fsck...'
554 > + cd "${TEMP}/${E2FSPROGS_DIR}/e2fsck"
555 > + make e2fsck.static >${LOGFILE} 2>&1 ||
556 > + gen_die 'Compiling static e2fsck failed!'
557 > + cd "${TEMP}/${E2FSPROGS_DIR}/misc"
558 > + print_info 1 'e2fsprogs: >Compiling mke2fs...'
559 > + make mke2fs.static >${LOGFILE} 2>&1 ||
560 > + gen_die 'Compiling static mke2fs failed!'
561 > + cd "${TEMP}/${E2FSPROGS_DIR}"
562 > + print_info 1 'e2fsprogs: >Copying to cache...'
563 > + [ -f "${TEMP}/${E2FSPROGS_DIR}/misc/mke2fs.static" ] ||
564 > + gen_die 'mke2fs executable does not exist!'
565 > + [ -f "${TEMP}/${E2FSPROGS_DIR}/e2fsck/e2fsck.static" ] ||
566 > + gen_die 'e2fsck executable does not exist!'
567 > + strip "${TEMP}/${E2FSPROGS_DIR}/misc/mke2fs.static"
568 > "${TEMP}/${E2FSPROGS_DIR}/e2fsck/e2fsck.static" ||
569 > + gen_die 'Could not strip e2fs binaries!'
570 > +
571 > + mkdir "${TEMP}/e2fsprogs"
572 > + mkdir "${TEMP}/e2fsprogs/sbin"
573 > + install -m 0755 -s misc/mke2fs.static "${TEMP}/e2fsprogs/sbin/mke2fs"
574 > + install -m 0755 -s e2fsck/e2fsck.static "${TEMP}/e2fsprogs/sbin/e2fsck"
575 > + print_info 1 ' >Copying to bincache...'
576 > + cd "${TEMP}/e2fsprogs"
577 > + /bin/tar -cjf "${E2FSPROGS_BINCACHE}" sbin/ ||
578 > + gen_die 'Could not create binary cache'
579 > +
580 > + cd "${TEMP}"
581 > + rm -rf "${TEMP}/e2fsprogs" /dev/null
582 > + rm -rf "${E2FSPROGS_DIR}" /dev/null
583 > + fi
584 > +}
585 > +
586 > compile_fuse() {
587 > if [ ! -f "${FUSE_BINCACHE}" ]
588 > then
589 > diff --git a/gen_determineargs.sh b/gen_determineargs.sh
590 > index 7f352f8..a0563fd 100755
591 > --- a/gen_determineargs.sh
592 > +++ b/gen_determineargs.sh
593 > @@ -144,6 +144,7 @@ determine_real_args() {
594 > MDADM_BINCACHE=`cache_replace "${MDADM_BINCACHE}"`
595 > DMRAID_BINCACHE=`cache_replace "${DMRAID_BINCACHE}"`
596 > ISCSI_BINCACHE=`cache_replace "${ISCSI_BINCACHE}"`
597 > + E2FSPROGS_BINCACHE=`cache_replace "${E2FSPROGS_BINCACHE}"`
598 > BLKID_BINCACHE=`cache_replace "${BLKID_BINCACHE}"`
599 > FUSE_BINCACHE=`cache_replace "${FUSE_BINCACHE}"`
600 > UNIONFS_FUSE_BINCACHE=`cache_replace "${UNIONFS_FUSE_BINCACHE}"`
601 > diff --git a/gen_initramfs.sh b/gen_initramfs.sh
602 > index ac90830..75bb47f 100755
603 > --- a/gen_initramfs.sh
604 > +++ b/gen_initramfs.sh
605 > @@ -127,6 +127,26 @@ append_busybox() {
606 > rm -rf "${TEMP}/initramfs-busybox-temp" /dev/null
607 > }
608 >
609 > +# Used to add e2fs file making inside initramfs for aufs changes saving
610 > +append_e2fstools(){
611 > + if [ -d "${TEMP}/initramfs-e2fsprogs-temp" ]
612 > + then
613 > + rm -r "${TEMP}/initramfs-e2fsprogs-temp/"
614 > + fi
615 > + #print_info 1 'E2FSTOOLS: Adding support (compiling binaries)...'
616 > + # Using different name for blkid compatibility
617 > + #compile_e2fstools
618 > + cd ${TEMP}
619 > + mkdir -p "${TEMP}/initramfs-e2fsprogs-temp/"
620 > + #XXX: do we want to add an if statement here or just include it? I say
621 > include it...
622 > + copy_binaries "${TEMP}"/initramfs-e2fsprogs-temp/ /sbin/{e2fsck,mke2fs}
623 > + #/bin/tar -jxpf "${E2FSPROGS_BINCACHE}" -C
624 > "${TEMP}/initramfs-e2fsprogs-temp/" ||
625 > + # gen_die "Could not extract e2fsprogs binary cache!"
626 > + cd "${TEMP}/initramfs-e2fsprogs-temp/"
627 > + find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
628 > + rm -rf "${TEMP}/initramfs-e2fsprogs-temp" /dev/null
629 > +}
630 > +
631 > append_blkid(){
632 > if [ -d "${TEMP}/initramfs-blkid-temp" ]
633 > then
634 > @@ -741,6 +762,7 @@ create_initramfs() {
635 > append_data 'base_layout'
636 > append_data 'auxilary' "${BUSYBOX}"
637 > append_data 'busybox' "${BUSYBOX}"
638 > + append_data 'e2fstools'
639 > append_data 'lvm' "${LVM}"
640 > append_data 'dmraid' "${DMRAID}"
641 > append_data 'iscsi' "${ISCSI}"
642 >
643 >
644
645 -----BEGIN PGP SIGNATURE-----
646 Version: GnuPG v2.0.19 (GNU/Linux)
647 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
648
649 iQIcBAEBAgAGBQJQIaHbAAoJEKXdFCfdEflKTi4QAIqI+sk7ZiKlmsu8+A2k7kbg
650 YwCtsoGv6w+zfBh60t0jG5gdPNzAJRpfR2MpHS6zJnhyU1FrOsok66SfzBJBf7NS
651 HA6gA8Yrg6G/NB9coGq3yGGs8eTComiD0Eo7/dd4n2OZ4xWJyFLdqCUnRjQg/w27
652 e2PxOGpApBevB+5Z+KNUnMDJCXzVsFJGAYTX7j6KzZqf70I4VHzgZ576YnxoIfPT
653 vo1CeUMWyFHuiIZm7IJAqUNhukq6SPkXlXrvQgjR/oL1j2sRrROxdAJvy64Qts55
654 j6LlKE3BTmd/tkGuQHzhZC0h1SmTJgVyRNpqQtMrHsioWnG+eUsAJUnIA2s3g8Vg
655 4fGERrk5Ob3SSnBPTgv5lszoPYoAjb16O+iXf/kYHO+K3RNafBKLTusLUJmAnM6T
656 UPvfXIyUFkoMjvIq3zPwvTLqhTGrxYr8BjkUQ4+U4uZV5Hk67zVaGcuT7z1TcKPH
657 x8uuLztamTzzbNNZA+RSOTNBhup3ffZwPDmyQWbfxQVquxBMMLLjZBsXNO5Dupp1
658 fh1mVXe0cidpenkPjUAMoTOT4lBMMrY2pehvAaAqWHjXrBMrCVNDlQan2ZCwQobO
659 MlVc3dPbGraIp9XzzszFydOddvrAETYbgadCPH2/MFiVH5BYbaDAlzExYFr/OH8/
660 cCuKUv6/FJCdgb3y0y9w
661 =u0rt
662 -----END PGP SIGNATURE-----

Replies

Subject Author
Re: [gentoo-genkernel] RFC: aufs and modules support Sebastian Pipping <sping@g.o>