then
ARGS="${ARGS} AS=\"${KERNEL_AS}\""
fi
+ if [ -n "${KERNEL_ARCH}" ]
+ then
+ ARGS="${ARGS} ARCH=\"${KERNEL_ARCH}\""
+ fi
fi
echo -n "${ARGS}"
}
compile_utils_args()
{
local ARGS
-
ARGS=''
+
+ if [ -n "${UTILS_CROSS_COMPILE}" ]
+ then
+ UTILS_CC="${UTILS_CROSS_COMPILE}gcc"
+ UTILS_LD="${UTILS_CROSS_COMPILE}ld"
+ UTILS_AS="${UTILS_CROSS_COMPILE}as"
+ fi
+
if [ "${UTILS_ARCH}" != '' ]
then
ARGS="ARCH=\"${UTILS_ARCH}\""
fi
}
+apply_patches() {
+ util=$1
+ version=$2
+
+ if [ -d "${GK_SHARE}/patches/${util}/${version}" ]
+ then
+ print_info 1 "${util}: >> Applying patches..."
+ for i in ${GK_SHARE}/patches/${util}/${version}/*{diff,patch}
+ do
+ patch_success=0
+ for j in `seq 0 5`
+ do
+ patch -p${j} --backup-if-mismatch -f < "${i}" >/dev/null
+ if [ $? = 0 ]
+ then
+ patch_success=1
+ break
+ fi
+ done
+ if [ ${patch_success} != 1 ]
+ then
+ gen_die "could not apply patch ${i} for ${util}-${version}"
+ fi
+ done
+ fi
+}
compile_generic() {
local RET
fi
}
-extract_dietlibc_bincache() {
- cd "${TEMP}"
- rm -rf "${TEMP}/diet" > /dev/null
- /bin/tar -jxpf "${DIETLIBC_BINCACHE}" ||
- gen_die 'Could not extract dietlibc bincache!'
- [ ! -d "${TEMP}/diet" ] &&
- gen_die "${TEMP}/diet directory not found!"
- cd - > /dev/null
-}
-
-clean_dietlibc_bincache() {
- cd "${TEMP}"
- rm -rf "${TEMP}/diet" > /dev/null
- cd - > /dev/null
-}
-
-compile_dep() {
- # Only run ``make dep'' for 2.4 kernels
- if [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ]
- then
- print_info 1 "kernel: >> Making dependencies..."
- cd ${KERNEL_DIR}
- compile_generic dep kernel
- fi
-}
-
compile_modules() {
print_info 1 " >> Compiling ${KV} modules..."
cd ${KERNEL_DIR}
compile_generic modules kernel
export UNAME_MACHINE="${ARCH}"
- # On 2.4 kernels, if MAKEOPTS > -j1 it can cause failures
- if [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ]
- then
- MAKEOPTS_SAVE="${MAKEOPTS}"
- MAKEOPTS="${MAKEOPTS_SAVE/-j?/-j1}"
- fi
[ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH
compile_generic "modules_install" kernel
- [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ] && MAKEOPTS="${MAKEOPTS_SAVE}"
- export MAKEOPTS
unset UNAME_MACHINE
}
"System.map" \
"System.map-${KNAME}-${ARCH}-${KV}"
- if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
+ if isTrue "${GENZIMAGE}"
then
copy_image_with_preserve "kernelz" \
"${KERNEL_BINARY_2}" \
gen_die "Could not copy the kernel binary to ${TMPDIR}!"
cp "System.map" "${TMPDIR}/System.map-${KNAME}-${ARCH}-${KV}" ||
gen_die "Could not copy System.map to ${TMPDIR}!"
- if [ "${ENABLE_PEGASOS_HACKS}" = 'yes' ]
+ if isTrue "${GENZIMAGE}"
then
cp "${KERNEL_BINARY_2}" "${TMPDIR}/kernelz-${KV}" ||
gen_die "Could not copy the kernelz binary to ${TMPDIR}!"
compile_busybox() {
[ -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}"
- patch -p1 < "${GK_SHARE}/pkg/busybox-1.1.3+gentoo-mdadm.patch"
- patch -p1 < "${GK_SHARE}/pkg/busybox-1.1.3+gentoo-mdadm2.patch"
- print_info 1 'busybox: >> Configuring...'
- yes '' 2>/dev/null | compile_generic oldconfig utils
+
+ if [ -n "${BUSYBOX_CONFIG}" ]
+ then
+ [ -f "${BUSYBOX_CONFIG}" ] ||
+ gen_die "Could not find busybox config file: ${BUSYBOX_CONFIG}"
+ elif isTrue "${NETBOOT}" && [ -f "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/netboot-busy-config")" ]
+ then
+ BUSYBOX_CONFIG="$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/netboot-busy-config")"
+ elif isTrue "${NETBOOT}" && [ -f "${GK_SHARE}/netboot/busy-config" ]
+ then
+ BUSYBOX_CONFIG="${GK_SHARE}/netboot/busy-config"
+ elif [ -f "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/busy-config")" ]
+ then
+ BUSYBOX_CONFIG="$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/busy-config")"
+ elif [ -f "${GK_SHARE}/defaults/busy-config" ]
+ then
+ BUSYBOX_CONFIG="${GK_SHARE}/defaults/busy-config"
+ else
+ gen_die "Could not find a busybox config file"
+ fi
# Delete cache if stored config's MD5 does not match one to be used
- if [ -f "${BUSYBOX_BINCACHE}" -a -f "${BUSYBOX_CONFIG}" ]
+ if [ -f "${BUSYBOX_BINCACHE}" ]
then
- oldconfig_md5=$(tar -xjf "${BUSYBOX_BINCACHE}" -O .config | md5sum)
- newconfig_md5=$(md5sum < .config)
+ oldconfig_md5=$(tar -xjf "${BUSYBOX_BINCACHE}" -O .config.gk_orig 2>/dev/null | md5sum)
+ newconfig_md5=$(md5sum < "${BUSYBOX_CONFIG}")
if [ "${oldconfig_md5}" != "${newconfig_md5}" ]
then
print_info 1 "busybox: >> Removing stale cache..."
if [ ! -f "${BUSYBOX_BINCACHE}" ]
then
+ 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"
+ cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config.gk_orig"
+ cd "${BUSYBOX_DIR}"
+ apply_patches busybox ${BUSYBOX_VER}
+ 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...'
gen_die 'Busybox executable does not exist!'
strip "${TEMP}/${BUSYBOX_DIR}/busybox" ||
gen_die 'Could not strip busybox binary!'
- tar -cj -C "${TEMP}/${BUSYBOX_DIR}" -f "${BUSYBOX_BINCACHE}" busybox .config ||
+ tar -cj -C "${TEMP}/${BUSYBOX_DIR}" -f "${BUSYBOX_BINCACHE}" busybox .config .config.gk_orig ||
gen_die 'Could not create the busybox bincache!'
- fi
- cd "${TEMP}"
- rm -rf "${BUSYBOX_DIR}" > /dev/null
+ cd "${TEMP}"
+ rm -rf "${BUSYBOX_DIR}" > /dev/null
+ fi
}
compile_lvm() {
fi
}
-compile_devfsd() {
- local ARGS
- if [ ! -f "${DEVFSD_BINCACHE}" ]
- then
- [ ! -f "${DEVFSD_SRCTAR}" ] &&
- gen_die "Could not find devfsd source tarball: ${DEVFSD_SRCTAR}"
- cd "${TEMP}"
- rm -rf "${DEVFSD_DIR}"
- /bin/tar -jxpf "${DEVFSD_SRCTAR}"
- [ ! -d "${DEVFSD_DIR}" ] &&
- gen_die "Devfsd directory ${DEVFSD_DIR} invalid"
- cd "${DEVFSD_DIR}"
-
- print_info 1 'devfsd: >> Compiling...'
- compile_generic 'LDFLAGS=-static' utils
-
- print_info 1 ' >> Copying to cache...'
- [ -f "${TEMP}/${DEVFSD_DIR}/devfsd" ] || gen_die 'The devfsd executable does not exist after the compilation of devfsd!'
- strip "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Could not strip devfsd!'
- bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd" || gen_die 'Compression of devfsd failed!'
- [ -f "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" ] || gen_die 'Could not find compressed devfsd.bz2 binary!'
- mv "${TEMP}/${DEVFSD_DIR}/devfsd.bz2" "${DEVFSD_BINCACHE}" || gen_die 'Could not move compressed binary to the package cache!'
-
- cd "${TEMP}"
- rm -rf "${DEVFSD_DIR}" > /dev/null
- fi
-}
-
compile_device_mapper() {
if [ ! -f "${DEVICE_MAPPER_BINCACHE}" ]
then
rm -rf "${E2FSPROGS_DIR}" > /dev/null
fi
}
+
+compile_fuse() {
+ if [ ! -f "${FUSE_BINCACHE}" ]
+ then
+ [ ! -f "${FUSE_SRCTAR}" ] &&
+ gen_die "Could not find fuse source tarball: ${FUSE_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+ cd "${TEMP}"
+ rm -rf "${FUSE_DIR}"
+ tar -zxpf "${FUSE_SRCTAR}"
+ [ ! -d "${FUSE_DIR}" ] &&
+ gen_die "fuse directory ${FUSE_DIR} invalid"
+ cd "${FUSE_DIR}"
+ print_info 1 'fuse: >> Configuring...'
+ ./configure --disable-kernel-module --disable-example >> ${LOGFILE} 2>&1 ||
+ gen_die 'Configuring fuse failed!'
+ print_info 1 'fuse: >> Compiling...'
+ MAKE=${UTILS_MAKE} compile_generic "" ""
+
+ # Since we're linking statically against libfuse, we don't need to cache the .so
+# print_info 1 'libfuse: >> Copying to cache...'
+# [ -f "${TEMP}/${FUSE_DIR}/lib/.libs/libfuse.so" ] ||
+# gen_die 'libfuse.so does not exist!'
+# strip "${TEMP}/${FUSE_DIR}/lib/.libs/libfuse.so" ||
+# gen_die 'Could not strip libfuse.so!'
+# cd "${TEMP}/${FUSE_DIR}/lib/.libs"
+# tar -cjf "${FUSE_BINCACHE}" libfuse*so* ||
+# gen_die 'Could not create fuse bincache!'
+
+ cd "${TEMP}"
+# rm -rf "${FUSE_DIR}" > /dev/null
+ fi
+}
+
+compile_unionfs_fuse() {
+ if [ ! -f "${UNIONFS_FUSE_BINCACHE}" ]
+ then
+
+ # We'll call compile_fuse() from here, since it's not needed directly by anything else
+ compile_fuse
+
+ [ ! -f "${UNIONFS_FUSE_SRCTAR}" ] &&
+ gen_die "Could not find unionfs-fuse source tarball: ${UNIONFS_FUSE_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+ cd "${TEMP}"
+ rm -rf "${UNIONFS_FUSE_DIR}"
+ tar -jxpf "${UNIONFS_FUSE_SRCTAR}"
+ [ ! -d "${UNIONFS_FUSE_DIR}" ] &&
+ gen_die "unionfs-fuse directory ${UNIONFS_FUSE_DIR} invalid"
+ cd "${UNIONFS_FUSE_DIR}"
+ print_info 1 'unionfs-fuse: >> Compiling...'
+ sed -i "/^\(CFLAGS\|CPPFLAGS\)/s:^\\(.*\\)$:\\1 -static -I${TEMP}/${FUSE_DIR}/include -L${TEMP}/${FUSE_DIR}/lib/.libs:" Makefile src/Makefile
+ sed -i "/^LIB = /s:^LIB = \(.*\)$:LIB = -static -L${TEMP}/${FUSE_DIR}/lib/.libs \1 -ldl -lrt:" Makefile src/Makefile
+ MAKE=${UTILS_MAKE} compile_generic "" ""
+ print_info 1 'unionfs-fuse: >> Copying to cache...'
+ [ -f "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs" ] ||
+ gen_die 'unionfs binary does not exist!'
+ strip "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs" ||
+ gen_die 'Could not strip unionfs binary!'
+ bzip2 "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs" ||
+ gen_die 'bzip2 compression of unionfs binary failed!'
+ mv "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs.bz2" "${UNIONFS_FUSE_BINCACHE}" ||
+ gen_die 'Could not copy the unionfs binary to the package directory, does the directory exist?'
+
+ cd "${TEMP}"
+ rm -rf "${UNIONFS_FUSE_DIR}" > /dev/null
+ fi
+}