From: Andrew Gaffney Date: Thu, 26 Jul 2007 02:45:03 +0000 (+0000) Subject: Patch to actually use busybox bincache. Thanks to Pat Double X-Git-Tag: v3.4.10.902~233 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f10cd4ee6a37632406fdefb2e16952606505c4d5;p=genkernel.git Patch to actually use busybox bincache. Thanks to Pat Double on bug #180211 git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@519 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- diff --git a/ChangeLog b/ChangeLog index b0f6c45..f2d2ffc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,11 @@ # Copyright 2006-2007 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ + 26 Jul 2007; Andrew Gaffney gen_compile.sh, + gen_initramfs.sh, gen_initrd.sh, genkernel.conf: + Patch to actually use busybox bincache. Thanks to Pat Double + on bug #180211 + 21 Jun 2007; Chris Gianelloni gen_initrd.sh: Fixed lvm/evms code for initrd generation. Thanks to Vinny on bug #179480 for pointing it out. diff --git a/gen_compile.sh b/gen_compile.sh index 0b5b503..ee1299d 100644 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -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() { diff --git a/gen_initramfs.sh b/gen_initramfs.sh index dcd1ad2..9bd6161 100644 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -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 diff --git a/gen_initrd.sh b/gen_initrd.sh index 4cef704..efa43ea 100644 --- a/gen_initrd.sh +++ b/gen_initrd.sh @@ -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}" = '' ] diff --git a/genkernel.conf b/genkernel.conf index 546d606..d1e5e3c 100755 --- a/genkernel.conf +++ b/genkernel.conf @@ -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