Patch to actually use busybox bincache. Thanks to Pat Double
authorAndrew Gaffney <agaffney@gentoo.org>
Thu, 26 Jul 2007 02:45:03 +0000 (02:45 +0000)
committerAndrew Gaffney <agaffney@gentoo.org>
Thu, 26 Jul 2007 02:45:03 +0000 (02:45 +0000)
<gentoo@patdouble.com> on bug #180211

git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@519 67a159dc-881f-0410-a524-ba9dfbe2cb84

ChangeLog
gen_compile.sh
gen_initramfs.sh
gen_initrd.sh
genkernel.conf

index b0f6c4523696761a62cd9a199d62729bf70dc7b6..f2d2ffc74ab5227b63d66c42cf47ff460bd118d9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
 # Copyright 2006-2007 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+  26 Jul 2007; Andrew Gaffney <agaffney@gentoo.org> gen_compile.sh,
+  gen_initramfs.sh, gen_initrd.sh, genkernel.conf:
+  Patch to actually use busybox bincache. Thanks to Pat Double
+  <gentoo@patdouble.com> on bug #180211
+
   21 Jun 2007; Chris Gianelloni <wolf31o2@gentoo.org> gen_initrd.sh:
   Fixed lvm/evms code for initrd generation. Thanks to Vinny
   <vfuria@gmail.com> on bug #179480 for pointing it out.
index 0b5b5031d89fd02c0539b644892ba8f5a37c6268..ee1299d902f78845318d94190d633a512a08f3f0 100644 (file)
@@ -427,33 +427,38 @@ compile_unionfs_utils() {
 }
 
 compile_busybox() {
-
-       # Delete cache if config is newer
-       if [ \
-               -f "${BUSYBOX_BINCACHE}" -a \
-               -f "${BUSYBOX_CONFIG}" -a \
-               "${BUSYBOX_BINCACHE}" -ot "${BUSYBOX_CONFIG}" ]
-       then
-               rm -rf "${BUSYBOX_BINCACHE}"
+       [ -f "${BUSYBOX_SRCTAR}" ] ||
+               gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}!"
+       [ -f "${BUSYBOX_CONFIG}" ] ||
+               gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}!"
+       cd "${TEMP}"
+       rm -rf "${BUSYBOX_DIR}" > /dev/null
+       /bin/tar -jxpf ${BUSYBOX_SRCTAR} ||
+               gen_die 'Could not extract busybox source tarball!'
+       [ -d "${BUSYBOX_DIR}" ] ||
+               gen_die 'Busybox directory ${BUSYBOX_DIR} is invalid!'
+       cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
+       sed -i ${BUSYBOX_DIR}/.config -e 's/#\? \?CONFIG_FEATURE_INSTALLER[ =].*/CONFIG_FEATURE_INSTALLER=y/g'
+       cd "${BUSYBOX_DIR}"
+       print_info 1 'busybox: >> Configuring...'
+       yes '' 2>/dev/null | compile_generic oldconfig utils
+
+       # Delete cache if stored config's MD5 does not match one to be used
+       if [ -f "${BUSYBOX_BINCACHE}" -a -f "${BUSYBOX_CONFIG}" ]
+       then
+               oldconfig_md5=$(tar -xjf "${BUSYBOX_BINCACHE}" -O .config | md5sum)
+               newconfig_md5=$(md5sum < .config)
+               if [ "${oldconfig_md5}" != "${newconfig_md5}" ]
+               then
+                       print_info 1 "busybox: >> Removing stale cache..."
+                       rm -rf "${BUSYBOX_BINCACHE}"
+               else
+                       print_info 1 "busybox: >> Using cache"
+               fi
        fi
 
        if [ ! -f "${BUSYBOX_BINCACHE}" ]
        then
-               [ -f "${BUSYBOX_SRCTAR}" ] ||
-                       gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}!"
-               [ -f "${BUSYBOX_CONFIG}" ] ||
-                       gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}!"
-               cd "${TEMP}"
-               rm -rf "${BUSYBOX_DIR}" > /dev/null
-               /bin/tar -jxpf ${BUSYBOX_SRCTAR} ||
-                       gen_die 'Could not extract busybox source tarball!'
-               [ -d "${BUSYBOX_DIR}" ] ||
-                       gen_die 'Busybox directory ${BUSYBOX_DIR} is invalid!'
-               cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
-               sed -i ${BUSYBOX_DIR}/.config -e 's/#\? \?CONFIG_FEATURE_INSTALLER[ =].*/CONFIG_FEATURE_INSTALLER=y/g'
-               cd "${BUSYBOX_DIR}"
-               print_info 1 'busybox: >> Configuring...'
-               yes '' 2>/dev/null | compile_generic oldconfig utils
                print_info 1 'busybox: >> Compiling...'
                compile_generic all utils
                print_info 1 'busybox: >> Copying to cache...'
@@ -461,14 +466,12 @@ compile_busybox() {
                        gen_die 'Busybox executable does not exist!'
                strip "${TEMP}/${BUSYBOX_DIR}/busybox" ||
                        gen_die 'Could not strip busybox binary!'
-               bzip2 "${TEMP}/${BUSYBOX_DIR}/busybox" ||
-                       gen_die 'bzip2 compression of busybox failed!'
-               mv "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" "${BUSYBOX_BINCACHE}" ||
-                       gen_die 'Could not copy the busybox binary to the package directory, does the directory exist?'
-
-               cd "${TEMP}"
-               rm -rf "${BUSYBOX_DIR}" > /dev/null
+               tar -cj -C "${TEMP}/${BUSYBOX_DIR}" -f "${BUSYBOX_BINCACHE}" busybox .config ||
+                       gen_die 'Could not create the busybox bincache!'
        fi
+
+       cd "${TEMP}"
+       rm -rf "${BUSYBOX_DIR}" > /dev/null
 }
 
 compile_lvm2() {
index dcd1ad24ce3331f42fbf7bfae9a726db964b04d8..9bd616177129f92f8cfee745a618f704c643b274 100644 (file)
@@ -50,10 +50,10 @@ append_busybox() {
 
        cp "${GK_SHARE}/generic/udhcpc.scripts" ${TEMP}/initramfs-busybox-temp/bin/
        chmod +x "${TEMP}/initramfs-busybox-temp/bin/udhcpc.scripts"
-       cp "${BUSYBOX_BINCACHE}" "${TEMP}/initramfs-busybox-temp/bin/busybox.bz2" ||
+       cp "${BUSYBOX_BINCACHE}" "${TEMP}/initramfs-busybox-temp/bin/busybox.tar.bz2" ||
                gen_die 'Could not copy busybox from bincache!'
-       bunzip2 "${TEMP}/initramfs-busybox-temp/bin/busybox.bz2" ||
-               gen_die 'Could not uncompress busybox!'
+       tar -xjf "${TEMP}/initramfs-busybox-temp/bin/busybox.tar.bz2" -C "${TEMP}/initramfs-busybox-temp/bin" busybox ||
+               gen_die 'Could not extract busybox bincache!'
        chmod +x "${TEMP}/initramfs-busybox-temp/bin/busybox"
 
        # down devfsd we use with dietlibc
index 4cef7044458e497128067f057950b743a5bf879f..efa43ea88d6a2e7f58b1e0a5ca027654f0debff9 100644 (file)
@@ -80,10 +80,10 @@ create_base_initrd_sys() {
                chmod +x "${TEMP}/initrd-temp/bin/blkid"
        fi
 
-       cp "${BUSYBOX_BINCACHE}" "${TEMP}/initrd-temp/bin/busybox.bz2" ||
+       cp "${BUSYBOX_BINCACHE}" "${TEMP}/initrd-temp/bin/busybox.tar.bz2" ||
                gen_die 'Could not copy busybox from bincache!'
-       bunzip2 "${TEMP}/initrd-temp/bin/busybox.bz2" ||
-               gen_die 'Could not uncompress busybox!'
+       tar -xjf "${TEMP}/initrd-temp/bin/busybox.tar.bz2" -C "${TEMP}/initrd-temp/bin" busybox ||
+               gen_die 'Could not extract busybox bincache!'
        chmod +x "${TEMP}/initrd-temp/bin/busybox"
 
        if [ "${NOINITRDMODULES}" = '' ]
index 546d60612c8fe805acb068ba434cf1ed8171e278..d1e5e3cc3e939615484879304bbc673baa366c66 100755 (executable)
@@ -86,7 +86,7 @@ BUSYBOX_CONFIG="${GK_SHARE}/%%ARCH%%/busy-config"
 BUSYBOX_VER="1.1.3+gentoo"
 # Busybox bin-cache location, to store pre-compiled busybox
 # binary is just a bzip2 busybox executable
-BUSYBOX_BINCACHE="%%CACHE%%/busybox-${BUSYBOX_VER}-%%ARCH%%.bz2"
+BUSYBOX_BINCACHE="%%CACHE%%/busybox-${BUSYBOX_VER}-%%ARCH%%.tar.bz2"
 # Location of BusyBox source tarball
 BUSYBOX_SRCTAR="${GK_SHARE}/pkg/busybox-${BUSYBOX_VER}.tar.bz2"
 # Directory created after busybox tarball is extracted