#!/bin/bash
+# $Id$
-compile_kernel_args()
-{
+compile_kernel_args() {
local ARGS
ARGS=''
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
+ [ -f "${i}" ] || continue
+ 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} -eq 1 ]
+ then
+ print_info 1 " - `basename ${i}`"
+ else
+ gen_die "could not apply patch ${i} for ${util}-${version}"
+ fi
+ done
+ fi
+}
compile_generic() {
local RET
local target=${1}
local argstype=${2}
- if [ "${argstype}" = 'kernel' ] || [ "${argstype}" = 'runtask' ]
- then
- export_kernel_args
- MAKE=${KERNEL_MAKE}
- elif [ "${2}" = 'utils' ]
- then
- export_utils_args
- MAKE=${UTILS_MAKE}
- fi
case "${argstype}" in
- kernel) ARGS="`compile_kernel_args`" ;;
+ kernel|kernelruntask)
+ export_kernel_args
+ MAKE=${KERNEL_MAKE}
+ ;;
+ utils)
+ export_utils_args
+ MAKE=${UTILS_MAKE}
+ ;;
+ esac
+
+ case "${argstype}" in
+ kernel|kernelruntask) ARGS="`compile_kernel_args`" ;;
utils) ARGS="`compile_utils_args`" ;;
- *) ARGS="" ;; # includes runtask
+ *) ARGS="" ;;
esac
shift 2
-
# the eval usage is needed in the next set of code
# as ARGS can contain spaces and quotes, eg:
# ARGS='CC="ccache gcc"'
- if [ "${argstype}" == 'runtask' ]
+ if [ "${argstype}" == 'kernelruntask' ]
then
- print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS/-j?/j1} ${ARGS} ${target} $*" 1 0 1
- eval ${MAKE} -s ${MAKEOPTS/-j?/-j1} "${ARGS}" ${target} $*
+ # Silent operation, forced -j1
+ print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} -j1 ${ARGS} ${target} $*" 1 0 1
+ eval ${MAKE} -s ${MAKEOPTS} -j1 "${ARGS}" ${target} $*
RET=$?
- elif [ "${DEBUGLEVEL}" -gt "1" ]
+ elif [ "${LOGLEVEL}" -gt "1" ]
then
- # Output to stdout and debugfile
+ # Output to stdout and logfile
print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $*" 1 0 1
- eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* 2>&1 | tee -a ${DEBUGFILE}
+ eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* 2>&1 | tee -a ${LOGFILE}
RET=${PIPESTATUS[0]}
else
- # Output to debugfile only
+ # Output to logfile only
print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1} $*" 1 0 1
- eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${DEBUGFILE} 2>&1
+ eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${LOGFILE} 2>&1
RET=$?
fi
- [ "${RET}" -ne '0' ] &&
+ [ ${RET} -ne 0 ] &&
gen_die "Failed to compile the \"${target}\" target..."
unset MAKE
unset ARGS
- if [ "${argstype}" = 'kernel' ]
- then
- unset_kernel_args
- elif [ "${argstype}" = 'utils' ]
- then
- unset_utils_args
- 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
+ case "${argstype}" in
+ kernel) unset_kernel_args ;;
+ utils) unset_utils_args ;;
+ esac
}
compile_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
+ MAKEOPTS="${MAKEOPTS} -j1" compile_generic "modules_install" kernel
unset UNAME_MACHINE
}
[ "${KERNEL_MAKE}" = '' ] &&
gen_die "KERNEL_MAKE undefined - I don't know how to compile a kernel for this arch!"
cd ${KERNEL_DIR}
- print_info 1 " >> Compiling ${KV} ${KERNEL_MAKE_DIRECTIVE/_install/ [ install ]/}..."
- compile_generic "${KERNEL_MAKE_DIRECTIVE}" kernel
+ local kernel_make_directive="${KERNEL_MAKE_DIRECTIVE}"
+ if [ "${KERNEL_MAKE_DIRECTIVE_OVERRIDE}" != "${DEFAULT_KERNEL_MAKE_DIRECTIVE_OVERRIDE}" ]; then
+ kernel_make_directive="${KERNEL_MAKE_DIRECTIVE_OVERRIDE}"
+ fi
+ print_info 1 " >> Compiling ${KV} ${kernel_make_directive/_install/ [ install ]/}..."
+ compile_generic "${kernel_make_directive}" kernel
if [ "${KERNEL_MAKE_DIRECTIVE_2}" != '' ]
then
print_info 1 " >> Starting supplimental compile of ${KV}: ${KERNEL_MAKE_DIRECTIVE_2}..."
compile_generic "${KERNEL_MAKE_DIRECTIVE_2}" kernel
fi
- if ! isTrue "${CMD_NOINSTALL}"
+
+ local firmware_in_kernel_line=`fgrep CONFIG_FIRMWARE_IN_KERNEL "${KERNEL_DIR}"/.config`
+ if [ -n "${firmware_in_kernel_line}" -a "${firmware_in_kernel_line}" != CONFIG_FIRMWARE_IN_KERNEL=y ]
+ then
+ print_info 1 " >> Installing firmware ('make firmware_install') due to CONFIG_FIRMWARE_IN_KERNEL != y..."
+ MAKEOPTS="${MAKEOPTS} -j1" compile_generic "firmware_install" kernel
+ else
+ print_info 1 " >> Not installing firmware as it's included in the kernel already (CONFIG_FIRMWARE_IN_KERNEL=y)..."
+ fi
+
+ local tmp_kernel_binary=$(find_kernel_binary ${KERNEL_BINARY_OVERRIDE:-${KERNEL_BINARY}})
+ local tmp_kernel_binary2=$(find_kernel_binary ${KERNEL_BINARY_2})
+ if [ -z "${tmp_kernel_binary}" ]
+ then
+ gen_die "Cannot locate kernel binary"
+ fi
+
+ if isTrue "${CMD_INSTALL}"
then
copy_image_with_preserve "kernel" \
- "${KERNEL_BINARY}" \
+ "${tmp_kernel_binary}" \
"kernel-${KNAME}-${ARCH}-${KV}"
copy_image_with_preserve "System.map" \
"System.map" \
"System.map-${KNAME}-${ARCH}-${KV}"
- if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ]
+ if isTrue "${GENZIMAGE}"
then
copy_image_with_preserve "kernelz" \
- "${KERNEL_BINARY_2}" \
+ "${tmp_kernel_binary2}" \
"kernelz-${KV}"
fi
else
- cp "${KERNEL_BINARY}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||
+ cp "${tmp_kernel_binary}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||
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 [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ]
+ if isTrue "${GENZIMAGE}"
then
- cp "${KERNEL_BINARY_2}" "${TMPDIR}/kernelz-${KV}" ||
+ cp "${tmp_kernel_binary2}" "${TMPDIR}/kernelz-${KV}" ||
gen_die "Could not copy the kernelz binary to ${TMPDIR}!"
fi
fi
}
-compile_unionfs_modules() {
- if [ ! -f "${UNIONFS_MODULES_BINCACHE}" ]
- then
- [ -f "${UNIONFS_SRCTAR}" ] ||
- gen_die "Could not find unionfs source tarball: ${UNIONFS_SRCTAR}!"
- cd "${TEMP}"
- rm -rf ${UNIONFS_DIR} > /dev/null
- rm -rf unionfs* > /dev/null
- mkdir unionfs
- /bin/tar xzpf ${UNIONFS_SRCTAR} ||
- gen_die 'Could not extract unionfs source tarball!'
- [ -d "${UNIONFS_DIR}" ] ||
- gen_die 'Unionfs directory ${UNIONFS_DIR} is invalid!'
- cd "${UNIONFS_DIR}"
- print_info 1 'unionfs modules: >> Compiling...'
- echo "LINUXSRC=${KERNEL_DIR}" >> fistdev.mk
- echo 'TOPINC=-I$(LINUXSRC)/include' >> fistdev.mk
- echo "MODDIR= /lib/modules/${KV}" >> fistdev.mk
- echo "KVERS=${KV}" >> fistdev.mk
- echo "KERNELVERSION=${KV}" >> fistdev.mk
- # Fix for hardened/selinux systems to have extened attributes
- # per r2d2's request. Also add -DUNIONFS_UNSUPPORTED for 2.6.16
- echo "EXTRACFLAGS=-DUNIONFS_XATTR -DFIST_SETXATTR_CONSTVOID -DUNIONFS_UNSUPPORTED" \
- >> fistdev.mk
- # Here we do something really nasty and disable debugging, along with
- # change our default CFLAGS
- echo "UNIONFS_DEBUG_CFLAG=-DUNIONFS_NDEBUG" >> fistdev.mk
- echo "UNIONFS_OPT_CFLAG= -O2 -pipe" >> fistdev.mk
-
- if [ "${PAT}" -ge '6' ]
- then
- # ARCH is used by unionfs - and conflicts with genkernel
- ARCH_PUSH=${ARCH}
- unset ARCH
- # Compile unionfs module within the unionfs
- # environment not within the kernelsrc dir
- make unionfs.ko || gen_die 'failed to compile unionfs'
- ARCH=${ARCH_PUSH}
- else
- gen_die 'unionfs is only supported on 2.6 targets'
- fi
- print_info 1 'unionfs: >> Copying to cache...'
-
- mkdir -p ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs/unionfs
-
- if [ -f unionfs.ko ]
- then
- cp -f unionfs.ko ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs/unionfs
- else
- cp -f unionfs.o ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs/unionfs
- fi
-
- cd ${TEMP}/unionfs
- /bin/tar -cjf "${UNIONFS_MODULES_BINCACHE}" . ||
- gen_die 'Could not create unionfs modules binary cache'
-
- cd "${TEMP}"
- rm -rf "${UNIONFS_DIR}" > /dev/null
- rm -rf unionfs > /dev/null
- fi
-}
+compile_busybox() {
+ [ -f "${BUSYBOX_SRCTAR}" ] ||
+ gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}!"
-compile_unionfs_utils() {
- if [ ! -f "${UNIONFS_BINCACHE}" ]
+ if [ -n "${BUSYBOX_CONFIG}" ]
then
- [ -f "${UNIONFS_SRCTAR}" ] ||
- gen_die "Could not find unionfs source tarball: ${UNIONFS_SRCTAR}!"
- cd "${TEMP}"
- rm -rf ${UNIONFS_DIR} > /dev/null
- rm -rf unionfs* > /dev/null
- mkdir -p unionfs/sbin
- /bin/tar -zxpf ${UNIONFS_SRCTAR} ||
- gen_die 'Could not extract unionfs source tarball!'
- [ -d "${UNIONFS_DIR}" ] ||
- gen_die 'Unionfs directory ${UNIONFS_DIR} is invalid!'
- cd "${UNIONFS_DIR}"
- print_info 1 'unionfs tools: >> Compiling...'
- sed -i utils/Makefile -e 's|${CC} -o|${CC} -static -o|g'
- sed -i Makefile -e 's|${CC} -o|${CC} -static -o|g'
- compile_generic utils utils
-
- if [ ! -e "uniondbg" ]; then
- cd utils
- fi
- print_info 1 'unionfs: >> Copying to cache...'
- strip uniondbg unionctl
- cp uniondbg ${TEMP}/unionfs/sbin/ ||
- gen_die 'Could not copy the uniondbg binary to the tmp directory'
- cp unionctl ${TEMP}/unionfs/sbin/ ||
- gen_die 'Could not copy the unionctl binary to the tmp directory'
- cd ${TEMP}/unionfs
- /bin/tar -cjf "${UNIONFS_BINCACHE}" . ||
- gen_die 'Could not create unionfs tools binary cache'
-
- cd "${TEMP}"
- rm -rf "${UNIONFS_DIR}" > /dev/null
- rm -rf unionfs > /dev/null
+ [ -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
-}
-
-compile_busybox() {
- # Delete cache if config is newer
- if [ \
- -f "${BUSYBOX_BINCACHE}" -a \
- -f "${BUSYBOX_CONFIG}" -a \
- "${BUSYBOX_BINCACHE}" -ot "${BUSYBOX_CONFIG}" ]
+ # Delete cache if stored config's MD5 does not match one to be used
+ if [ -f "${BUSYBOX_BINCACHE}" ]
then
- rm -rf "${BUSYBOX_BINCACHE}"
+ 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..."
+ 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} ||
[ -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'
+ 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!'
- 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?'
+ tar -cj -C "${TEMP}/${BUSYBOX_DIR}" -f "${BUSYBOX_BINCACHE}" busybox .config .config.gk_orig ||
+ gen_die 'Could not create the busybox bincache!'
cd "${TEMP}"
rm -rf "${BUSYBOX_DIR}" > /dev/null
fi
}
-compile_lvm2() {
- compile_device_mapper
- if [ ! -f "${LVM2_BINCACHE}" ]
+compile_lvm() {
+ if [ -f "${LVM_BINCACHE}" ]
then
- [ -f "${LVM2_SRCTAR}" ] ||
- gen_die "Could not find LVM2 source tarball: ${LVM2_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+ print_info 1 "lvm: >> Using cache"
+ else
+ [ -f "${LVM_SRCTAR}" ] ||
+ gen_die "Could not find LVM source tarball: ${LVM_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
cd "${TEMP}"
- rm -rf ${LVM2_DIR} > /dev/null
- /bin/tar -zxpf ${LVM2_SRCTAR} ||
- gen_die 'Could not extract LVM2 source tarball!'
- [ -d "${LVM2_DIR}" ] ||
- gen_die 'LVM2 directory ${LVM2_DIR} is invalid!'
- rm -rf "${TEMP}/device-mapper" > /dev/null
- /bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
- gen_die "Could not extract device-mapper binary cache!";
-
- cd "${LVM2_DIR}"
- print_info 1 'lvm2: >> Configuring...'
- LDFLAGS="-L${TEMP}/device-mapper/lib" \
- CFLAGS="-I${TEMP}/device-mapper/include" \
- CPPFLAGS="-I${TEMP}/device-mapper/include" \
- ./configure --enable-static_link --prefix=${TEMP}/lvm2 >> ${DEBUGFILE} 2>&1 ||
- gen_die 'Configure of lvm2 failed!'
- print_info 1 'lvm2: >> Compiling...'
+ rm -rf ${LVM_DIR} > /dev/null
+ /bin/tar -zxpf ${LVM_SRCTAR} ||
+ gen_die 'Could not extract LVM source tarball!'
+ [ -d "${LVM_DIR}" ] ||
+ gen_die 'LVM directory ${LVM_DIR} is invalid!'
+ cd "${LVM_DIR}"
+ apply_patches lvm ${LVM_VER}
+ print_info 1 'lvm: >> Configuring...'
+ CFLAGS="-fPIC" \
+ ./configure --enable-static_link --prefix=${TEMP}/lvm \
+ --with-lvm1=internal --with-clvmd=none --with-cluster=none \
+ --disable-readline --disable-selinux --with-mirrors=internal \
+ --with-snapshots=internal --with-pool=internal >> ${LOGFILE} 2>&1 || \
+ gen_die 'Configure of lvm failed!'
+ print_info 1 'lvm: >> Compiling...'
compile_generic '' utils
compile_generic 'install' utils
- cd "${TEMP}/lvm2"
+ cd "${TEMP}/lvm"
print_info 1 ' >> Copying to bincache...'
strip "sbin/lvm.static" ||
gen_die 'Could not strip lvm.static!'
- /bin/tar -cjf "${LVM2_BINCACHE}" sbin/lvm.static ||
+ # See bug 382555
+ strip "sbin/dmsetup.static" ||
+ gen_die 'Could not strip dmsetup.static'
+ /bin/tar -cjf "${LVM_BINCACHE}" sbin/lvm.static sbin/dmsetup.static ||
gen_die 'Could not create binary cache'
cd "${TEMP}"
rm -rf "${TEMP}/device-mapper" > /dev/null
- rm -rf "${LVM2_DIR}" lvm2
+ rm -rf "${LVM_DIR}" lvm
+ fi
+}
+
+compile_mdadm() {
+ if [ -f "${MDADM_BINCACHE}" ]
+ then
+ print_info 1 ' MDADM: Using cache'
+ else
+ [ -f "${MDADM_SRCTAR}" ] ||
+ gen_die "Could not find MDADM source tarball: ${MDADM_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+ cd "${TEMP}"
+ rm -rf "${MDADM_DIR}" > /dev/null
+ /bin/tar -jxpf "${MDADM_SRCTAR}" ||
+ gen_die 'Could not extract MDADM source tarball!'
+ [ -d "${MDADM_DIR}" ] ||
+ gen_die 'MDADM directory ${MDADM_DIR} is invalid!'
+
+ cd "${MDADM_DIR}"
+ apply_patches mdadm ${MDADM_VER}
+ sed -i "/^CFLAGS = /s:^CFLAGS = \(.*\)$:CFLAGS = -Os:" Makefile
+ sed -i "/^CXFLAGS = /s:^CXFLAGS = \(.*\)$:CXFLAGS = -Os:" Makefile
+ sed -i "/^CWFLAGS = /s:^CWFLAGS = \(.*\)$:CWFLAGS = -Wall:" Makefile
+ sed -i "s/^# LDFLAGS = -static/LDFLAGS = -static/" Makefile
+
+ print_info 1 'mdadm: >> Compiling...'
+ compile_generic 'mdadm mdmon' utils
+
+ mkdir -p "${TEMP}/mdadm/sbin"
+ install -m 0755 -s mdadm "${TEMP}/mdadm/sbin/mdadm"
+ install -m 0755 -s mdmon "${TEMP}/mdadm/sbin/mdmon"
+ print_info 1 ' >> Copying to bincache...'
+ cd "${TEMP}/mdadm"
+ strip "sbin/mdadm" "sbin/mdmon" ||
+ gen_die 'Could not strip mdadm binaries!'
+ /bin/tar -cjf "${MDADM_BINCACHE}" sbin/mdadm sbin/mdmon ||
+ gen_die 'Could not create binary cache'
+
+ cd "${TEMP}"
+ rm -rf "${MDADM_DIR}" mdadm
fi
}
rm -rf "${TEMP}/device-mapper" > /dev/null
/bin/tar -jxpf "${DEVICE_MAPPER_BINCACHE}" -C "${TEMP}" ||
gen_die "Could not extract device-mapper binary cache!";
-
+
cd "${DMRAID_DIR}"
+ apply_patches dmraid ${DMRAID_VER}
print_info 1 'dmraid: >> Configuring...'
-
- LDFLAGS="-L${TEMP}/device-mapper/lib" \
- CFLAGS="-I${TEMP}/device-mapper/include" \
- CPPFLAGS="-I${TEMP}/device-mapper/include" \
- ./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${DEBUGFILE} 2>&1 ||
- gen_die 'Configure of dmraid failed!'
-
- # We dont necessarily have selinux installed yet... look into
- # selinux global support in the future.
- sed -i tools/Makefile -e "s|DMRAIDLIBS += -lselinux||g"
- ###echo "DMRAIDLIBS += -lselinux -lsepol" >> tools/Makefile
+
+ LDFLAGS="-L${TEMP}/device-mapper/lib" \
+ CFLAGS="-I${TEMP}/device-mapper/include" \
+ CPPFLAGS="-I${TEMP}/device-mapper/include" \
+ ./configure --enable-static_link --prefix=${TEMP}/dmraid >> ${LOGFILE} 2>&1 ||
+ gen_die 'Configure of dmraid failed!'
+
+ # We dont necessarily have selinux installed yet... look into
+ # selinux global support in the future.
+ sed -i tools/Makefile -e "s|DMRAIDLIBS += -lselinux||g"
+ ###echo "DMRAIDLIBS += -lselinux -lsepol" >> tools/Makefile
mkdir -p "${TEMP}/dmraid"
print_info 1 'dmraid: >> Compiling...'
- compile_generic '' utils
- #compile_generic 'install' utils
- mkdir ${TEMP}/dmraid/sbin
- install -m 0755 -s tools/dmraid "${TEMP}/dmraid/sbin/dmraid"
+ # Force dmraid to be built with -j1 for bug #188273
+ MAKEOPTS="${MAKEOPTS} -j1" compile_generic '' utils
+ #compile_generic 'install' utils
+ mkdir ${TEMP}/dmraid/sbin
+ install -m 0755 -s tools/dmraid "${TEMP}/dmraid/sbin/dmraid"
print_info 1 ' >> Copying to bincache...'
cd "${TEMP}/dmraid"
/bin/tar -cjf "${DMRAID_BINCACHE}" sbin/dmraid ||
fi
}
-compile_suspend() {
- [ -f "${SUSPEND_BINCACHE}" ] && return
- [ -f "${SUSPEND_SRCTAR}" ] ||
- gen_die "Could not find SUSPEND source tarball: ${SUSPEND_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
- cd ${TEMP}
- rm -rf ${SUSPEND_DIR} > /dev/null
- /bin/tar -zxpf ${SUSPEND_SRCTAR} ||
- gen_die 'Could not extract SUSPEND source tarball!'
- [ -d "${SUSPEND_DIR}" ] ||
- gen_die "SUSPEND directory ${DMRAID_DIR} is invalid!"
-
- cd "${SUSPEND_DIR}"
- if [ -f "${GK_SHARE}/pkg/suspend-0.5-Makefile.patch" ]
- then
- patch -p1 -i \
- ${GK_SHARE}/pkg/suspend-0.5-Makefile.patch \
- || gen_die "Failed patching suspend"
- fi
-
- print_info 1 'suspend: >> Compiling...'
- compile_generic '' utils CC_FLAGS= LD_FLAGS=
-
- print_info 1 ' >> Copying to bincache...'
- mkdir -p "${TEMP}/bincache/sbin"
- cp -f resume "${TEMP}/bincache/sbin" ||
- gen_die 'Could not copy resume binary'
- cd "${TEMP}/bincache"
- /bin/tar -cjf "${SUSPEND_BINCACHE}" * ||
- gen_die 'Could not create suspend binary cache'
- cd "${TEMP}"
- rm -rf bincache suspend-0.5
+compile_device_mapper() {
+ compile_lvm
}
-compile_modutils() {
- # I've disabled dietlibc support for the time being since the
- # version we use misses a few needed system calls.
-
- local ARGS
- if [ ! -f "${MODUTILS_BINCACHE}" ]
+compile_e2fsprogs() {
+ if [ -f "${BLKID_BINCACHE}" ]
then
- [ ! -f "${MODUTILS_SRCTAR}" ] &&
- gen_die "Could not find modutils source tarball: ${MODUTILS_SRCTAR}!"
+ print_info 1 "blkid: >> Using cache"
+ else
+ [ ! -f "${E2FSPROGS_SRCTAR}" ] &&
+ gen_die "Could not find e2fsprogs source tarball: ${E2FSPROGS_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
cd "${TEMP}"
- rm -rf "${MODUTILS_DIR}"
- /bin/tar -jxpf "${MODUTILS_SRCTAR}"
- [ ! -d "${MODUTILS_DIR}" ] &&
- gen_die "Modutils directory ${MODUTILS_DIR} invalid!"
- cd "${MODUTILS_DIR}"
- print_info 1 "modutils: >> Configuring..."
-
-# if [ "${USE_DIETLIBC}" -eq '1' ]
-# then
-# extract_dietlibc_bincache
-# OLD_CC="${UTILS_CC}"
-# UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
-# fi
-
- export_utils_args
- export ARCH=${ARCH}
- ./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 ||
- gen_die 'Configuring modutils failed!'
- unset_utils_args
-
- print_info 1 'modutils: >> Compiling...'
- compile_generic all utils
-
-# if [ "${USE_DIETLIBC}" -eq '1' ]
-# then
-# clean_dietlibc_bincache
-# UTILS_CC="${OLD_CC}"
-# fi
-
- print_info 1 'modutils: >> Copying to cache...'
- [ -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ] ||
- gen_die 'insmod.static does not exist after the compilation of modutils!'
- strip "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ||
- gen_die 'Could not strip insmod.static!'
- bzip2 "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ||
- gen_die 'Compression of insmod.static failed!'
- mv "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" "${MODUTILS_BINCACHE}" ||
- gen_die 'Could not move the compressed insmod binary to the package cache!'
+ rm -rf "${E2FSPROGS_DIR}"
+ tar -zxpf "${E2FSPROGS_SRCTAR}"
+ [ ! -d "${E2FSPROGS_DIR}" ] &&
+ gen_die "e2fsprogs directory ${E2FSPROGS_DIR} invalid"
+ cd "${E2FSPROGS_DIR}"
+ apply_patches e2fsprogs ${E2FSPROGS_VER}
+ print_info 1 'e2fsprogs: >> Configuring...'
+ LDFLAGS=-static ./configure >> ${LOGFILE} 2>&1 ||
+ gen_die 'Configuring e2fsprogs failed!'
+ print_info 1 'e2fsprogs: >> Compiling...'
+ MAKE=${UTILS_MAKE} MAKEOPTS="${MAKEOPTS} -j1" compile_generic "" ""
+ print_info 1 'blkid: >> Copying to cache...'
+ [ -f "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ] ||
+ gen_die 'Blkid executable does not exist!'
+ strip "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
+ gen_die 'Could not strip blkid binary!'
+ bzip2 "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
+ gen_die 'bzip2 compression of blkid failed!'
+ mv "${TEMP}/${E2FSPROGS_DIR}/misc/blkid.bz2" "${BLKID_BINCACHE}" ||
+ gen_die 'Could not copy the blkid binary to the package directory, does the directory exist?'
cd "${TEMP}"
- rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
+ rm -rf "${E2FSPROGS_DIR}" > /dev/null
fi
}
-compile_module_init_tools() {
- # I've disabled dietlibc support for the time being since the
- # version we use misses a few needed system calls.
-
- local ARGS
- if [ ! -f "${MODULE_INIT_TOOLS_BINCACHE}" ]
+compile_fuse() {
+ if [ ! -f "${FUSE_BINCACHE}" ]
then
- [ ! -f "${MODULE_INIT_TOOLS_SRCTAR}" ] &&
- gen_die "Could not find module-init-tools source tarball: ${MODULE_INIT_TOOLS_SRCTAR}"
- cd "${TEMP}"
- rm -rf "${MODULE_INIT_TOOLS_DIR}"
- /bin/tar -jxpf "${MODULE_INIT_TOOLS_SRCTAR}"
- [ ! -d "${MODULE_INIT_TOOLS_DIR}" ] &&
- gen_die "Module-init-tools directory ${MODULE_INIT_TOOLS_DIR} is invalid"
- cd "${MODULE_INIT_TOOLS_DIR}"
- print_info 1 'module-init-tools: >> Configuring'
-
-# if [ "${USE_DIETLIBC}" -eq '1' ]
-# then
-# extract_dietlibc_bincache
-# OLD_CC="${UTILS_CC}"
-# UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
-# fi
-
- export_utils_args
- ./configure >> ${DEBUGFILE} 2>&1 ||
- gen_die 'Configure of module-init-tools failed!'
- unset_utils_args
- print_info 1 ' >> Compiling...'
- compile_generic "all" utils
-
-# if [ "${USE_DIETLIBC}" -eq '1' ]
-# then
-# clean_dietlibc_bincache
-# UTILS_CC="${OLD_CC}"
-# fi
-
- print_info 1 ' >> Copying to cache...'
- [ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ] ||
- gen_die 'insmod.static does not exist after the compilation of module-init-tools!'
- strip "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ||
- gen_die 'Could not strip insmod.static!'
- bzip2 "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ||
- gen_die 'Compression of insmod.static failed!'
- [ -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" ] ||
- gen_die 'Could not find compressed insmod.static.bz2 binary!'
- mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODULE_INIT_TOOLS_BINCACHE}" ||
- gen_die 'Could not move the compressed insmod binary to the package cache!'
-
+ [ ! -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 "${MODULE_INIT_TOOLS_DIR}" > /dev/null
- fi
-}
-
-compile_devfsd() {
- # I've disabled dietlibc support for the time being since the
- # version we use misses a few needed system calls.
+ rm -rf "${FUSE_DIR}"
+ tar -zxpf "${FUSE_SRCTAR}"
+ [ ! -d "${FUSE_DIR}" ] &&
+ gen_die "fuse directory ${FUSE_DIR} invalid"
+ cd "${FUSE_DIR}"
+ apply_patches fuse ${FUSE_VER}
+ 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 "" ""
- 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}"
-
-# if [ "${USE_DIETLIBC}" -eq '1' ]
-# then
-# extract_dietlibc_bincache
-# OLD_CC="${UTILS_CC}"
-# UTILS_CC="${TEMP}/diet/bin/diet ${UTILS_CC}"
-# fi
-
- print_info 1 'devfsd: >> Compiling...'
-# if [ "${USE_DIETLIBC}" -eq '1' ]
-# then
-# compile_generic 'has_dlopen=0 has_rpcsvc=0' utils
-# else
- compile_generic 'LDFLAGS=-static' utils
-# fi
-
-# if [ "${USE_DIETLIBC}" -eq '1' ]
-# then
-# clean_dietlibc_bincache
-# UTILS_CC="${OLD_CC}"
-# fi
-
- 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!'
-
-# [ -f "${TEMP}/${DEVFSD_DIR}/devfsd.conf" ] || gen_die 'devfsd.conf does not exist after the compilation of devfsd!'
-# bzip2 "${TEMP}/${DEVFSD_DIR}/devfsd.conf" || gen_die 'Compression of devfsd.conf failed!'
-# mv "${TEMP}/${DEVFSD_DIR}/devfsd.conf.bz2" "${DEVFSD_CONF_BINCACHE}" || gen_die 'Could not move the compressed configuration to the package cache!'
+ # 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 "${DEVFSD_DIR}" > /dev/null
+# rm -rf "${FUSE_DIR}" > /dev/null
fi
}
-compile_device_mapper() {
- if [ ! -f "${DEVICE_MAPPER_BINCACHE}" ]
+compile_unionfs_fuse() {
+ if [ ! -f "${UNIONFS_FUSE_BINCACHE}" ]
then
- [ ! -f "${DEVICE_MAPPER_SRCTAR}" ] &&
- gen_die "Could not find device-mapper source tarball: ${DEVICE_MAPPER_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
- cd "${TEMP}"
- rm -rf "${DEVICE_MAPPER_DIR}"
- /bin/tar -zxpf "${DEVICE_MAPPER_SRCTAR}"
- [ ! -d "${DEVICE_MAPPER_DIR}" ] &&
- gen_die "device-mapper directory ${DEVICE_MAPPER_DIR} invalid"
- cd "${DEVICE_MAPPER_DIR}"
- ./configure --prefix=${TEMP}/device-mapper --enable-static_link \
- --disable-selinux >> ${DEBUGFILE} 2>&1 ||
- gen_die 'Configuring device-mapper failed!'
- print_info 1 'device-mapper: >> Compiling...'
- compile_generic '' utils
- compile_generic 'install' utils
- print_info 1 ' >> Copying to cache...'
- cd "${TEMP}"
- rm -r "${TEMP}/device-mapper/man" ||
- gen_die 'Could not remove manual pages!'
- strip "${TEMP}/device-mapper/sbin/dmsetup" ||
- gen_die 'Could not strip dmsetup binary!'
- /bin/tar -jcpf "${DEVICE_MAPPER_BINCACHE}" device-mapper ||
- gen_die 'Could not tar up the device-mapper binary!'
- [ -f "${DEVICE_MAPPER_BINCACHE}" ] ||
- gen_die 'device-mapper cache not created!'
- cd "${TEMP}"
- rm -rf "${DEVICE_MAPPER_DIR}" > /dev/null
- rm -rf "${TEMP}/device-mapper" > /dev/null
- fi
-}
-compile_dietlibc() {
- local BUILD_DIETLIBC
- local ORIGTEMP
-
- BUILD_DIETLIBC=0
- [ ! -f "${DIETLIBC_BINCACHE}" ] && BUILD_DIETLIBC=1
- [ ! -f "${DIETLIBC_BINCACHE_TEMP}" ] && BUILD_DIETLIBC=1
- if ! isTrue "${BUILD_DIETLIBC}"
- then
- ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"`
- if [ "${TEMP}" != "${ORIGTEMP}" ]
- then
- print_warning 1 'dietlibc: Bincache exists, but the current temporary directory'
- print_warning 1 ' is different to the original. Rebuilding.'
- BUILD_DIETLIBC=1
- fi
- fi
+ # We'll call compile_fuse() from here, since it's not needed directly by anything else
+ compile_fuse
- if [ "${BUILD_DIETLIBC}" -eq '1' ]
- then
- [ -f "${DIETLIBC_SRCTAR}" ] ||
- gen_die "Could not find dietlibc source tarball: ${DIETLIBC_SRCTAR}"
+ [ ! -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 "${DIETLIBC_DIR}" > /dev/null
- /bin/tar -jxpf "${DIETLIBC_SRCTAR}" ||
- gen_die 'Could not extract dietlibc source tarball'
- [ -d "${DIETLIBC_DIR}" ] ||
- gen_die "Dietlibc directory ${DIETLIBC_DIR} is invalid!"
- cd "${DIETLIBC_DIR}"
- print_info 1 "dietlibc: >> Compiling..."
- compile_generic "prefix=${TEMP}/diet" utils
- print_info 1 " >> Installing..."
- compile_generic "prefix=${TEMP}/diet install" utils
- print_info 1 " >> Copying to bincache..."
- cd ${TEMP}
- /bin/tar -jcpf "${DIETLIBC_BINCACHE}" diet ||
- gen_die 'Could not tar up the dietlibc binary!'
- [ -f "${DIETLIBC_BINCACHE}" ] ||
- gen_die 'Dietlibc cache not created!'
- echo "${TEMP}" > "${DIETLIBC_BINCACHE_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}"
+ apply_patches unionfs-fuse ${UNIONFS_FUSE_VER}
+ 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 "${DIETLIBC_DIR}" > /dev/null
- rm -rf "${TEMP}/diet" > /dev/null
+ rm -rf "${UNIONFS_FUSE_DIR}" > /dev/null
fi
}
-compile_klibc() {
- cd "${TEMP}"
- rm -rf "${KLIBC_DIR}" klibc-build
- [ ! -f "${KLIBC_SRCTAR}" ] &&
- gen_die "Could not find klibc tarball: ${KLIBC_SRCTAR}"
- /bin/tar jxpf "${KLIBC_SRCTAR}" ||
- gen_die 'Could not extract klibc tarball'
- [ ! -d "${KLIBC_DIR}" ] &&
- gen_die "klibc tarball ${KLIBC_SRCTAR} is invalid"
- cd "${KLIBC_DIR}"
- if [ -f ${GK_SHARE}/pkg/klibc-1.1.16-sparc2.patch ]
- then
- patch -p1 -i \
- ${GK_SHARE}/pkg/klibc-1.1.16-sparc2.patch \
- || gen_die "Failed patching klibc"
- fi
- if [ -f "${GK_SHARE}/pkg/klibc-1.2.1-nostdinc-flags.patch" ]
- then
- patch -p1 -i \
- ${GK_SHARE}/pkg/klibc-1.2.1-nostdinc-flags.patch \
- || gen_die "Failed patching klibc"
- fi
-
- # Don't install to "//lib" fix
- sed -e 's:SHLIBDIR = /lib:SHLIBDIR = $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib:' -i scripts/Kbuild.install
- print_info 1 'klibc: >> Compiling...'
- ln -snf "${KERNEL_DIR}" linux || gen_die "Could not link to ${KERNEL_DIR}"
- sed -i Makefile -e "s|prefix = /usr|prefix = ${TEMP}/klibc-build|g"
- if [ "${UTILS_ARCH}" != '' ]
- then
- sed -i Makefile -e "s|export ARCH.*|export ARCH := ${UTILS_ARCH}|g"
- fi
- if [ "${ARCH}" = 'um' ]
- then
- compile_generic "ARCH=um" utils
- elif [ "${ARCH}" = 'x86' ]
- then
- compile_generic "ARCH=i386" utils
- elif [ "${UTILS_CROSS_COMPILE}" != '' ]
- then
- compile_generic "CROSS=${UTILS_CROSS_COMPILE}" utils
- else
- compile_generic "" utils
- fi
- compile_generic "install" utils
-
-}
-compile_udev() {
- if [ ! -f "${UDEV_BINCACHE}" ]
+compile_iscsi() {
+ if [ ! -f "${ISCSI_BINCACHE}" ]
then
- # PPC fixup for 2.6.14
- # Headers are moving around .. need to make them available
- if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
- then
- if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
- then
- cd ${KERNEL_DIR}
- echo 'Applying hack to workaround 2.6.14+ PPC header breakages...'
- compile_generic 'include/asm' kernel
- fi
- fi
- compile_klibc
+ [ ! -f "${ISCSI_SRCTAR}" ] &&
+ gen_die "Could not find iSCSI source tarball: ${ISCSI_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
cd "${TEMP}"
- rm -rf "${UDEV_DIR}" udev
- [ ! -f "${UDEV_SRCTAR}" ] &&
- gen_die "Could not find udev tarball: ${UDEV_SRCTAR}"
- /bin/tar -jxpf "${UDEV_SRCTAR}" ||
- gen_die 'Could not extract udev tarball'
- [ ! -d "${UDEV_DIR}" ] &&
- gen_die "Udev tarball ${UDEV_SRCTAR} is invalid"
-
- cd "${UDEV_DIR}"
- local extras="extras/scsi_id extras/volume_id extras/ata_id extras/run_directory extras/usb_id extras/floppy extras/cdrom_id extras/firmware"
- # No selinux support yet .. someday maybe
- #use selinux && myconf="${myconf} USE_SELINUX=true"
- print_info 1 'udev: >> Compiling...'
- # SPARC fixup
- if [ "${UTILS_ARCH}" = 'sparc' ]
- then
- echo "CFLAGS += -mcpu=v8 -mtune=v8" >> Makefile
- fi
- # PPC fixup for 2.6.14
- if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
- then
- if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
- then
- # Headers are moving around .. need to make them available
- echo "CFLAGS += -I${KERNEL_DIR}/arch/${ARCH}/include" >> Makefile
- fi
- fi
-
- if [ "${ARCH}" = 'um' ]
- then
- compile_generic "EXTRAS=\"${extras}\" ARCH=um USE_KLIBC=true KLCC=${TEMP}/klibc-build/bin/klcc USE_LOG=false DEBUG=false udevdir=/dev all" utils
- else
- # This *needs* to be runtask, or else it breakson most
- # architectures. -- wolf31o2
- compile_generic "EXTRAS=\"${extras}\" USE_KLIBC=true KLCC=${TEMP}/klibc-build/bin/klcc USE_LOG=false DEBUG=false udevdir=/dev all" runtask
- fi
-
-
- print_info 1 ' >> Installing...'
- install -d "${TEMP}/udev/etc/udev" "${TEMP}/udev/sbin" "${TEMP}/udev/etc/udev/scripts" "${TEMP}/udev/etc/udev/rules.d" "${TEMP}/udev/etc/udev/permissions.d" "${TEMP}/udev/etc/udev/extras" "${TEMP}/udev/etc" "${TEMP}/udev/sbin" "${TEMP}/udev/usr/" "${TEMP}/udev/usr/bin" "${TEMP}/udev/usr/sbin"||
- gen_die 'Could not create directory hierarchy'
-
- install -c etc/udev/gentoo/udev.rules "${TEMP}/udev/etc/udev/rules.d/50-udev.rules" ||
- gen_die 'Could not copy gentoo udev.rules to 50-udev.rules'
-
-# compile_generic "EXTRAS=\"${extras}\" DESTDIR=${TEMP}/udev install-config" utils
-# compile_generic "EXTRAS=\"${extras}\" DESTDIR=${TEMP}/udev install-bin" utils
- # We are going to install our files by hand. Why are we doing this?
- # Well, the udev ebuild does so, and I tend to think that Greg
- # Kroah-Hartman knows what he's doing with regards to udev.
- for i in udev udevd udevsend udevstart udevtrigger
+ rm -rf "${ISCSI_DIR}"
+ tar -zxpf "${ISCSI_SRCTAR}"
+ [ ! -d "${ISCSI_DIR}" ] &&
+ gen_die "ISCSI directory ${ISCSI_DIR} invalid"
+ print_info 1 'iSCSI: >> Compiling...'
+ cd "${TEMP}/${ISCSI_DIR}"
+ apply_patches iscsi ${ISCSI_VER}
+
+ # Only build userspace
+ print_info 1 'iSCSI: >> Configuring userspace...'
+ cd utils/open-isns || gen_die 'Could not enter open-isns dir'
+ # we currently have a patch that changes configure.ac
+ # once given patch is dropped, drop autoconf too
+ autoconf || gen_die 'Could not tweak open-iscsi configuration'
+ ./configure --without-slp >> ${LOGFILE} 2>&1 || gen_die 'Could not configure userspace'
+ cd ../.. || gen_die 'wtf?'
+ MAKE=${UTILS_MAKE} compile_generic "user" ""
+
+ # if kernel modules exist, copy them to initramfs, otherwise it will be compiled into the kernel
+ mkdir -p "${TEMP}/initramfs-iscsi-temp/lib/modules/${RELEASE}/kernel/drivers/scsi/"
+ for modname in iscsi_tcp libiscsi scsi_transport_iscsi
do
- install -D $i "${TEMP}/udev/sbin"
+ if [ -e "${CMD_KERNEL_DIR}/drivers/scsi/${modname}.ko" ]
+ then
+ cp ${CMD_KERNEL_DIR}/drivers/scsi/${modname}.ko "${TEMP}/initramfs-iscsi-temp/lib/modules/${RELEASE}/kernel/drivers/scsi/"
+ fi
done
- install -c extras/ide-devfs.sh "${TEMP}/udev/etc/udev/scripts"
- install -c extras/scsi-devfs.sh "${TEMP}/udev/etc/udev/scripts"
- install -c extras/raid-devfs.sh "${TEMP}/udev/etc/udev/scripts"
- cd "${TEMP}/udev"
- print_info 1 ' >> Copying to bincache...'
- /bin/tar -cjf "${UDEV_BINCACHE}" * ||
- gen_die 'Could not create binary cache'
+ cd "${TEMP}/initramfs-iscsi-temp/"
+ print_info 1 'iscsistart: >> Copying to cache...'
+ [ -f "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ] ||
+ gen_die 'iscsistart executable does not exist!'
+ strip "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ||
+ gen_die 'Could not strip iscsistart binary!'
+ bzip2 "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ||
+ gen_die 'bzip2 compression of iscsistart failed!'
+ mv "${TEMP}/${ISCSI_DIR}/usr/iscsistart.bz2" "${ISCSI_BINCACHE}" ||
+ gen_die 'Could not copy the iscsistart binary to the package directory, does the directory exist?'
cd "${TEMP}"
- rm -rf "${UDEV_DIR}" udev
-
- # PPC fixup for 2.6.14
- if [ "${VER}" -eq '2' -a "${PAT}" -eq '6' -a "${SUB}" -ge '14' ]
- then
- if [ "${ARCH}" = 'ppc' -o "${ARCH}" = 'ppc64' ]
- then
- cd ${KERNEL_DIR}
- compile_generic 'archclean' kernel
- cd "${TEMP}"
- fi
- fi
+ rm -rf "${ISCSI_DIR}" > /dev/null
fi
}
-compile_e2fsprogs() {
- if [ ! -f "${BLKID_BINCACHE}" ]
+compile_gpg() {
+ if [ -f "${GPG_BINCACHE}" ]
then
- [ ! -f "${E2FSPROGS_SRCTAR}" ] &&
- gen_die "Could not find e2fsprogs source tarball: ${E2FSPROGS_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+ print_info 1 "gnupg: >> Using cache"
+ else
+ [ ! -f "${GPG_SRCTAR}" ] &&
+ gen_die "Could not find gnupg source tarball: ${GPG_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
cd "${TEMP}"
- rm -rf "${E2FSPROGS_DIR}"
- tar -zxpf "${E2FSPROGS_SRCTAR}"
- [ ! -d "${E2FSPROGS_DIR}" ] &&
- gen_die "e2fsprogs directory ${E2FSPROGS_DIR} invalid"
- cd "${E2FSPROGS_DIR}"
- print_info 1 'e2fsprogs: >> Configuring...'
- ./configure --with-ldopts=-static >> ${DEBUGFILE} 2>&1 ||
- gen_die 'Configuring e2fsprogs failed!'
- print_info 1 'e2fsprogs: >> Compiling...'
- MAKE=${UTILS_MAKE} compile_generic "" ""
- print_info 1 'blkid: >> Copying to cache...'
- [ -f "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ] ||
- gen_die 'Blkid executable does not exist!'
- strip "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
- gen_die 'Could not strip blkid binary!'
- bzip2 "${TEMP}/${E2FSPROGS_DIR}/misc/blkid" ||
- gen_die 'bzip2 compression of blkid failed!'
- mv "${TEMP}/${E2FSPROGS_DIR}/misc/blkid.bz2" "${BLKID_BINCACHE}" ||
- gen_die 'Could not copy the blkid binary to the package directory, does the directory exist?'
+ rm -rf "${GPG_DIR}"
+ tar -jxf "${GPG_SRCTAR}"
+ [ ! -d "${GPG_DIR}" ] &&
+ gen_die "gnupg directory ${GPG_DIR} invalid"
+ cd "${GPG_DIR}"
+ apply_patches gnupg ${GPG_VER}
+ print_info 1 'gnupg: >> Configuring...'
+ # --enable-minimal works, but it doesn't reduce the command length much.
+ # Given its history and the precision this needs, explicit is cleaner.
+ LDFLAGS='-static' CFLAGS='-Os' ./configure --prefix=/ \
+ --enable-static-rnd=linux --disable-dev-random --disable-asm \
+ --disable-selinux-support --disable-gnupg-iconv --disable-card-support \
+ --disable-agent-support --disable-bzip2 --disable-exec \
+ --disable-photo-viewers --disable-keyserver-helpers --disable-ldap \
+ --disable-hkp --disable-finger --disable-generic --disable-mailto \
+ --disable-keyserver-path --disable-dns-srv --disable-dns-pka \
+ --disable-dns-cert --disable-nls --disable-threads --disable-regex \
+ --disable-optimization --with-included-zlib --without-capabilities \
+ --without-tar --without-ldap --without-libcurl --without-mailprog \
+ --without-libpth-prefix --without-libiconv-prefix --without-libintl-prefix\
+ --without-zlib --without-bzip2 --without-libusb --without-readline \
+ >> ${LOGFILE} 2>&1 || gen_die 'Configuring gnupg failed!'
+ print_info 1 'gnupg: >> Compiling...'
+ compile_generic "" "utils"
+ print_info 1 'gnupg: >> Copying to cache...'
+ [ -f "${TEMP}/${GPG_DIR}/g10/gpg" ] ||
+ gen_die 'gnupg executable does not exist!'
+ strip "${TEMP}/${GPG_DIR}/g10/gpg" ||
+ gen_die 'Could not strip gpg binary!'
+ bzip2 -z -c "${TEMP}/${GPG_DIR}/g10/gpg" > "${GPG_BINCACHE}" ||
+ gen_die 'Could not copy the gpg binary to the package directory, does the directory exist?'
cd "${TEMP}"
- rm -rf "${E2FSPROGS_DIR}" > /dev/null
+ rm -rf "${GPG_DIR}" > /dev/null
fi
}