local ARGS
ARGS=''
- if [ "${KERNEL_CC}" != '' ]
- then
- ARGS="CC=\"${KERNEL_CC}\""
- fi
- if [ "${KERNEL_LD}" != '' ]
- then
- ARGS="${ARGS} LD=\"${KERNEL_LD}\""
- fi
- if [ "${KERNEL_AS}" != '' ]
- then
- ARGS="${ARGS} AS=\"${KERNEL_AS}\""
- fi
-
if [ "${KERNEL_CROSS_COMPILE}" != '' ]
then
ARGS="${ARGS} CROSS_COMPILE=\"${KERNEL_CROSS_COMPILE}\""
+ else
+ if [ "${KERNEL_CC}" != '' ]
+ then
+ ARGS="CC=\"${KERNEL_CC}\""
+ fi
+ if [ "${KERNEL_LD}" != '' ]
+ then
+ ARGS="${ARGS} LD=\"${KERNEL_LD}\""
+ fi
+ if [ "${KERNEL_AS}" != '' ]
+ then
+ ARGS="${ARGS} AS=\"${KERNEL_AS}\""
+ fi
fi
-
echo -n "${ARGS}"
}
local ARGS
ARGS=''
+ if [ "${UTILS_ARCH}" != '' ]
+ then
+ ARGS="ARCH=\"${UTILS_ARCH}\""
+ fi
if [ "${UTILS_CC}" != '' ]
then
ARGS="CC=\"${UTILS_CC}\""
export_utils_args()
{
+ save_args
+ if [ "${UTILS_ARCH}" != '' ]
+ then
+ export ARCH="${UTILS_ARCH}"
+ fi
if [ "${UTILS_CC}" != '' ]
then
export CC="${UTILS_CC}"
unset_utils_args()
{
+ if [ "${UTILS_ARCH}" != '' ]
+ then
+ unset ARCH
+ fi
if [ "${UTILS_CC}" != '' ]
then
unset CC
then
unset AS
fi
+ reset_args
}
export_kernel_args()
unset CROSS_COMPILE
fi
}
+save_args()
+{
+ if [ "${ARCH}" != '' ]
+ then
+ export ORIG_ARCH="${ARCH}"
+ fi
+ if [ "${CC}" != '' ]
+ then
+ export ORIG_CC="${CC}"
+ fi
+ if [ "${LD}" != '' ]
+ then
+ export ORIG_LD="${LD}"
+ fi
+ if [ "${AS}" != '' ]
+ then
+ export ORIG_AS="${AS}"
+ fi
+ if [ "${CROSS_COMPILE}" != '' ]
+ then
+ export ORIG_CROSS_COMPILE="${CROSS_COMPILE}"
+ fi
+}
+reset_args()
+{
+ if [ "${ORIG_ARCH}" != '' ]
+ then
+ export ARCH="${ORIG_ARCH}"
+ unset ORIG_ARCH
+ fi
+ if [ "${ORIG_CC}" != '' ]
+ then
+ export CC="${ORIG_CC}"
+ unset ORIG_CC
+ fi
+ if [ "${ORIG_LD}" != '' ]
+ then
+ export LD="${ORIG_LD}"
+ unset ORIG_LD
+ fi
+ if [ "${ORIG_AS}" != '' ]
+ then
+ export AS="${ORIG_AS}"
+ unset ORIG_AS
+ fi
+ if [ "${ORIG_CROSS_COMPILE}" != '' ]
+ then
+ export CROSS_COMPILE="${ORIG_CROSS_COMPILE}"
+ unset ORIG_CROSS_COMPILE
+ fi
+}
+
compile_generic() {
local RET
[ "$#" -lt '2' ] &&
gen_die 'compile_generic(): improper usage!'
+ local target=${1}
+ local argstype=${2}
- if [ "${2}" = 'kernel' ] || [ "${2}" = 'runtask' ]
+ if [ "${argstype}" = 'kernel' ] || [ "${argstype}" = 'runtask' ]
then
export_kernel_args
MAKE=${KERNEL_MAKE}
export_utils_args
MAKE=${UTILS_MAKE}
fi
- case "$2" in
+ case "${argstype}" in
kernel) ARGS="`compile_kernel_args`" ;;
utils) ARGS="`compile_utils_args`" ;;
*) ARGS="" ;; # includes runtask
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 [ "${2}" == 'runtask' ]
+ if [ "${argstype}" == 'runtask' ]
then
- print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS/-j?/j1} ${ARGS} ${1}" 1 0 1
- eval ${MAKE} -s ${MAKEOPTS/-j?/-j1} "${ARGS}" ${1}
+ print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS/-j?/j1} ${ARGS} ${target} $*" 1 0 1
+ eval ${MAKE} -s ${MAKEOPTS/-j?/-j1} "${ARGS}" ${target} $*
RET=$?
elif [ "${DEBUGLEVEL}" -gt "1" ]
then
# Output to stdout and debugfile
- print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1}" 1 0 1
- eval ${MAKE} ${MAKEOPTS} ${ARGS} ${1} 2>&1 | tee -a ${DEBUGFILE}
+ print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $*" 1 0 1
+ eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* 2>&1 | tee -a ${DEBUGFILE}
RET=${PIPESTATUS[0]}
else
# Output to debugfile only
- print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1}" 1 0 1
- eval ${MAKE} ${MAKEOPTS} ${ARGS} ${1} >> ${DEBUGFILE} 2>&1
+ print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1} $*" 1 0 1
+ eval ${MAKE} ${MAKEOPTS} ${ARGS} ${target} $* >> ${DEBUGFILE} 2>&1
RET=$?
fi
[ "${RET}" -ne '0' ] &&
- gen_die "Failed to compile the \"${1}\" target..."
+ gen_die "Failed to compile the \"${target}\" target..."
unset MAKE
unset ARGS
- if [ "${2}" = 'kernel' ]
+ if [ "${argstype}" = 'kernel' ]
then
unset_kernel_args
- elif [ "${2}" = 'utils' ]
+ elif [ "${argstype}" = 'utils' ]
then
unset_utils_args
fi
fi
if ! isTrue "${CMD_NOINSTALL}"
then
- cp "${KERNEL_BINARY}" "/boot/kernel-${KNAME}-${ARCH}-${KV}" ||
- gen_die 'Could not copy the kernel binary to /boot!'
- cp "System.map" "/boot/System.map-${KNAME}-${ARCH}-${KV}" ||
- gen_die 'Could not copy System.map to /boot!'
+ copy_image_with_preserve "kernel" \
+ "${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' ]
then
- cp "${KERNEL_BINARY_2}" "/boot/kernelz-${KV}" ||
- gen_die 'Could not copy the kernelz binary to /boot!'
+ copy_image_with_preserve "kernelz" \
+ "${KERNEL_BINARY_2}" \
+ "kernelz-${KV}"
fi
else
cp "${KERNEL_BINARY}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||
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
- /bin/tar -zxpf ${UNIONFS_SRCTAR} ||
+ 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...'
- sed -i Makefile -e "s|LINUXSRC =.*|LINUXSRC =${KERNEL_DIR}|g"
-
- #Fix for hardened/selinux systems to have extened attributes
- #per r2d2's request
- sed -i Makefile -e "s|# \(EXTRACFLAGS=-DUNIONFS_XATTR -DFIST_SETXATTR_CONSTVOID\)|\1|g"
+ 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
- # Setup the kernel sources to compile modules
- cd ${KERNEL_DIR}
- compile_generic "modules_prepare" kernel
-
- cd "${TEMP}"
- cd "${UNIONFS_DIR}"
- compile_generic unionfs2.6 kernel
+ # 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
- compile_generic unionfs2.4 kernel
+ 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
+ mkdir -p ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs/unionfs
if [ -f unionfs.ko ]
then
- cp unionfs.ko ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs
- else
- cp unionfs.o ${TEMP}/unionfs/lib/modules/${KV}/kernel/fs
+ 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
+ cd ${TEMP}/unionfs
/bin/tar -cjf "${UNIONFS_MODULES_BINCACHE}" . ||
gen_die 'Could not create unionfs modules binary cache'
gen_die "Could not find unionfs source tarball: ${UNIONFS_SRCTAR}!"
cd "${TEMP}"
rm -rf ${UNIONFS_DIR} > /dev/null
- rm -rf unionfs > /dev/null
+ rm -rf unionfs* > /dev/null
mkdir -p unionfs/sbin
/bin/tar -zxpf ${UNIONFS_SRCTAR} ||
gen_die 'Could not extract unionfs source tarball!'
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
+ cd ${TEMP}/unionfs
/bin/tar -cjf "${UNIONFS_BINCACHE}" . ||
gen_die 'Could not create unionfs tools binary cache'
}
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}"
+ 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...'
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() {
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
mkdir -p "${TEMP}/dmraid"
print_info 1 'dmraid: >> Compiling...'
compile_generic '' utils
fi
}
-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}" ]
- then
- [ ! -f "${MODUTILS_SRCTAR}" ] &&
- gen_die "Could not find modutils source tarball: ${MODUTILS_SRCTAR}!"
- 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!'
-
- cd "${TEMP}"
- rm -rf "${MODULE_INIT_TOOLS_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}" ]
- 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!'
-
- cd "${TEMP}"
- rm -rf "${MODULE_INIT_TOOLS_DIR}" > /dev/null
- 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_devfsd() {
[ ! -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 >> ${DEBUGFILE} 2>&1 ||
+ ./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
rm -rf "${TEMP}/diet" > /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}" ]
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
cd "${TEMP}"
rm -rf "${UDEV_DIR}" udev
[ ! -f "${UDEV_SRCTAR}" ] &&
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
- ln -snf "${KERNEL_DIR}" klibc/linux || gen_die "Could not link to ${KERNEL_DIR}"
if [ "${ARCH}" = 'um' ]
then
- compile_generic "ARCH=um KERNEL_DIR=$KERNEL_DIR USE_KLIBC=true USE_LOG=false DEBUG=false udevdir=/dev all etc/udev/udev.conf" runtask
- elif [ "${ARCH}" = 'sparc64' ]
- then
- compile_generic "ARCH=sparc64 CROSS=sparc64-unknown-linux-gnu- KERNEL_DIR=$KERNEL_DIR USE_KLIBC=true USE_LOG=false DEBUG=false udevdir=/dev all etc/udev/udev.conf" runtask
+ 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
- compile_generic "KERNEL_DIR=$KERNEL_DIR USE_KLIBC=true USE_LOG=false DEBUG=false udevdir=/dev all etc/udev/udev.conf" runtask
+ # 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
- strip udev || gen_die 'Failed to strip the udev binary!'
- if [ -e udevstart ]
- then
- strip udevstart || gen_die 'Failed to strip the udevstart binary!'
- fi
-
- if [ -e udevsend ]
- then
- strip udevsend || gen_die 'Failed to strip the udevsend binary!'
- 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" ||
+ 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 -m 0755 udev "${TEMP}/udev/sbin" ||
- gen_die 'Could not install udev binary!'
- if [ -e udevstart ]
- then
- install -m 0755 udevstart "${TEMP}/udev/sbin" ||
- gen_die 'Could not install udevstart binary!'
- fi
-
- if [ -e udevsend ]
- then
- install -m 0755 udevsend "${TEMP}/udev/sbin" ||
- gen_die 'Could not install udevsend binary!'
- fi
-
- install -m 0644 etc/udev/udev.conf "${TEMP}/udev/etc/udev" ||
- gen_die 'Could not install udev configuration!'
- install -m 0644 etc/udev/gentoo/udev.rules "${TEMP}/udev/etc/udev/rules.d/50-udev.rules" ||
- gen_die 'Could not install udev rules!'
-# install -m 0644 etc/udev/udev.permissions "${TEMP}/udev/etc/udev/permissions.d/50-udev.permissions" ||
-# gen_die 'Could not install udev permissions!'
- install -m 0755 extras/ide-devfs.sh "${TEMP}/udev/etc/udev/scripts" ||
- gen_die 'Could not install udev scripts!'
+ 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
+ do
+ install -D $i "${TEMP}/udev/sbin"
+ 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...'
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
fi
}