Update eclass to newet imcarnatiopn from sabayon

This commit is contained in:
Mario Fetka 2012-10-23 19:09:03 +02:00
parent 37a872ab19
commit cdf5e32fa5
2 changed files with 394 additions and 251 deletions

View File

@ -68,12 +68,12 @@ K_KERNEL_PATCH_VER="${K_KERNEL_PATCH_VER:-}"
# pointing to space separated list of patch paths.
K_KERNEL_PATCH_HOTFIXES="${K_KERNEL_PATCH_HOTFIXES:-}"
# @ECLASS-VARIABLE: K_KERNEL_DINASLE_PR_EXTRAVERSION
# @ECLASS-VARIABLE: K_KERNEL_DISABLE_PR_EXTRAVERSION
# @DESCRIPTION:
# Set this to "1" if you want to tell kernel-2 eclass to
# not use ${PR} in kernel EXTRAVERSION (K_NOUSEPR). Otherwise, set
# this to "0" to not set K_NOUSEPR at all.
K_KERNEL_DINASLE_PR_EXTRAVERSION="${K_KERNEL_DINASLE_PR_EXTRAVERSION:-1}"
K_KERNEL_DISABLE_PR_EXTRAVERSION="${K_KERNEL_DISABLE_PR_EXTRAVERSION:-1}"
# @ECLASS-VARIABLE: K_KERNEL_SLOT_USEPVR
# @DESCRIPTION:
@ -115,44 +115,23 @@ K_WORKAROUND_USE_REAL_EXTRAVERSION="${K_WORKAROUND_USE_REAL_EXTRAVERSION:-}"
# @ECLASS-VARIABLE: K_GENKERNEL_ARGS
# @DESCRIPTION:
# Provide extra genkernel arguments using K_GENKERNEL_ARGS
K_GENKERNEL_ARGS="${K_GENKERNEL_ARGS-}"
K_GENKERNEL_ARGS="${K_GENKERNEL_ARGS:-}"
# @ECLASS-VARIABLE: K_NASKERNEL_XLOADER_VER
# @ECLASS-VARIABLE: K_MKIMAGE_RAMDISK_ADDRESS
# @DESCRIPTION:
# If set to "1.5.1" for example, it downloads the selected version
K_NASKERNEL_XLOADER_VER="${K_NASKERNEL_XLOADER_VER:-}"
# [ARM ONLY] Provide the ramdisk load address to be used with mkimage
K_MKIMAGE_RAMDISK_ADDRESS="${K_MKIMAGE_RAMDISK_ADDRESS:-}"
# @ECLASS-VARIABLE: K_NASKERNEL_XLOADER_PATCHES_VER
# @ECLASS-VARIABLE: K_MKIMAGE_RAMDISK_ENTRYPOINT
# @DESCRIPTION:
# If set to "3" for example, it applies the
# patchs corresponding to x-loader-${K_NASKERNEL_XLOADER_VER}
K_NASKERNEL_XLOADER_PATCHES_VER="${K_NASKERNEL_XLOADER_PATCHES_VER:-}"
# @ECLASS-VARIABLE: K_NASKERNEL_XLOADER_TARGET
# @DESCRIPTION:
# If set to "omap4430panda_config" for example, it is build for that arch
K_NASKERNEL_XLOADER_TARGET="${K_NASKERNEL_XLOADER_TARGET:-}"
# @ECLASS-VARIABLE: K_KERNEL_UBOOT_VER
# @DESCRIPTION:
# If set to "2011.12" for example, it downloads the selected version
K_NASKERNEL_UBOOT_VER="${K_NASKERNEL_UBOOT_VER:-}"
# @ECLASS-VARIABLE: K_KERNEL_UBOOT_PATCHES_VER
# @DESCRIPTION:
# If set to "3" for example, it applies the
# patchs corresponding to u-boot-${K_NASKERNEL_UBOOT_VER}
K_NASKERNEL_UBOOT_PATCHES_VER="${K_NASKERNEL_UBOOT_PATCHES_VER:-}"
# @ECLASS-VARIABLE: K_NASKERNEL_UBOOT_TARGET
# @DESCRIPTION:
# If set to "omap4_panda_config" for example, it is build for that arch
K_NASKERNEL_UBOOT_TARGET="${K_NASKERNEL_UBOOT_TARGET:-}"
# [ARM ONLY] Provide the ramdisk entry point address to be used with mkimage
K_MKIMAGE_RAMDISK_ENTRYPOINT="${K_MKIMAGE_RAMDISK_ENTRYPOINT:-}"
KERN_INITRAMFS_SEARCH_NAME="${KERN_INITRAMFS_SEARCH_NAME:-initramfs-genkernel*${K_NASKERNEL_NAME}}"
# Disable deblobbing feature
K_DEBLOB_AVAILABLE=0
ETYPE="sources"
inherit eutils kernel-2 mount-boot linux-info
@ -160,7 +139,7 @@ inherit eutils kernel-2 mount-boot linux-info
detect_version
detect_arch
DESCRIPTION="Sabayon Linux kernel functions and phases"
DESCRIPTION="Sablink Linux kernel functions and phases"
K_LONGTERM_URL_STR=""
@ -194,34 +173,13 @@ if [ -n "${K_KERNEL_PATCH_HOTFIXES}" ]; then
UNIPATCH_LIST="${K_KERNEL_PATCH_HOTFIXES} ${UNIPATCH_LIST}"
fi
# download x-loader if required (ubuntu is mainly supporterted by TI)
if [ -n "${K_NASKERNEL_XLOADER_VER}" ]; then
SRC_URI="${SRC_URI}
mirror://sablink/${CATEGORY}/linux-nas-patches/x-loader_${K_NASKERNEL_XLOADER_VER}.orig.tar.gz
https://launchpad.net/ubuntu/+archive/primary/+files/x-loader_${K_NASKERNEL_XLOADER_VER}.orig.tar.gz"
if [ -n "${K_NASKERNEL_XLOADER_PATCHES_VER}" ]; then
SRC_URI="${SRC_URI}
mirror://sablink/${CATEGORY}/linux-nas-patches/x-loader-patches-${K_NASKERNEL_XLOADER_VER}-${K_NASKERNEL_XLOADER_PATCHES_VER}.tar.bz2"
fi
fi
# download u-boot if required
if [ -n "${K_NASKERNEL_UBOOT_VER}" ]; then
SRC_URI="${SRC_URI}
mirror://sablink/${CATEGORY}/linux-nas-patches/u-boot-${K_NASKERNEL_UBOOT_VER}.tar.bz2
ftp://ftp.denx.de/pub/u-boot/u-boot-${K_NASKERNEL_UBOOT_VER}.tar.bz2"
if [ -n "${K_NASKERNEL_UBOOT_PATCHES_VER}" ]; then
SRC_URI="${SRC_URI}
mirror://sablink/${CATEGORY}/linux-nas-patches/u-boot-patches-${K_NASKERNEL_UBOOT_VER}-${K_NASKERNEL_UBOOT_PATCHES_VER}.tar.bz2"
fi
fi
_get_real_kv_full() {
if [[ "${KV_MAJOR}${KV_MINOR}" -eq 26 ]]; then
echo "${ORIGINAL_KV_FULL}"
elif [[ "${OKV/.*}" = "3" ]]; then
# Linux 3.x support, KV_FULL is set to: 3.0-sablink
# need to add another final .0 to the version part
#echo "${ORIGINAL_KV_FULL/-/.0-}"
echo "${ORIGINAL_KV_FULL}"
else
echo "${ORIGINAL_KV_FULL}"
@ -233,7 +191,7 @@ _get_real_kv_full() {
KV_FULL="${KV_FULL/${PN/-*}/${K_NASKERNEL_NAME}}"
EXTRAVERSION="${EXTRAVERSION/${PN/-*}/${K_NASKERNEL_NAME}}"
# drop -rX if exists
if [[ -n "${PR//r0}" ]] && [[ "${K_KERNEL_DINASLE_PR_EXTRAVERSION}" = "1" ]] \
if [[ -n "${PR//r0}" ]] && [[ "${K_KERNEL_DISABLE_PR_EXTRAVERSION}" = "1" ]] \
&& [[ -z "${K_NOSETEXTRAVERSION}" ]]; then
EXTRAVERSION="${EXTRAVERSION%-r*}"
KV_FULL="${KV_FULL%-r*}"
@ -292,9 +250,12 @@ if [ -z "${K_NASKERNEL_SELF_TARBALL_NAME}" ]; then
mirror://sablink/${CATEGORY}/linux-nas-patches/config/${K_NASKERNEL_FW_CONFIG_FILE/__ARCH__/arm} )"
use arm && K_NASKERNEL_CONFIG_FILE=${K_NASKERNEL_CONFIG_FILE/__ARCH__/arm}
use arm && K_NASKERNEL_FW_CONFIG_FILE=${K_NASKERNEL_FW_CONFIG_FILE/__ARCH__/arm}
# ARM not supported, if put in SRC_URI it tries to fetch it
else
use arm && K_NASKERNEL_CONFIG_FILE="${K_NASKERNEL_CONFIG_FILE:-${K_NASKERNEL_NAME}-${PVR}-arm.config}"
use arm && K_NASKERNEL_FW_CONFIG_FILE="${K_NASKERNEL_FW_CONFIG_FILE:-${K_NASKERNEL_NAME}-fw_env-arm.config}"
use amd64 && K_NASKERNEL_CONFIG_FILE="${K_NASKERNEL_CONFIG_FILE:-${K_NASKERNEL_NAME}-${PVR}-amd64.config}"
use x86 && K_NASKERNEL_CONFIG_FILE="${K_NASKERNEL_CONFIG_FILE:-${K_NASKERNEL_NAME}-${PVR}-x86.config}"
fi
else
K_NASKERNEL_CONFIG_FILE="${K_NASKERNEL_CONFIG_FILE:-${K_NASKERNEL_NAME}-${PVR}-__ARCH__.config}"
@ -303,7 +264,6 @@ else
if use arm; then
K_NASKERNEL_CONFIG_FILE=${K_NASKERNEL_CONFIG_FILE/__ARCH__/arm}
K_NASKERNEL_ALT_CONFIG_FILE=${K_NASKERNEL_ALT_CONFIG_FILE/__ARCH__/arm}
K_NASKERNEL_FW_CONFIG_FILE=${K_NASKERNEL_FW_CONFIG_FILE/__ARCH__/arm}
fi
fi
@ -312,7 +272,7 @@ if [ -n "${K_ONLY_SOURCES}" ] || [ -n "${K_FIRMWARE_PACKAGE}" ]; then
DEPEND="sys-apps/sed"
RDEPEND="${RDEPEND}"
else
IUSE="dmraid dracut ccache"
IUSE="dmraid dracut iscsi lvm mdadm ccache"
DEPEND="app-arch/xz-utils
sys-apps/sed
sys-devel/make
@ -322,6 +282,7 @@ else
sys-block/devio
dev-embedded/u-boot-tools
sys-fs/dosfstools"
RDEPEND="sys-apps/sed
sys-kernel/linux-firmware"
if [ -n "${K_REQUIRED_LINUX_FIRMWARE_VER}" ]; then
@ -379,28 +340,7 @@ nas-kernel_src_unpack() {
# some sources could have multiple append-based EXTRAVERSIONs
sed -i "s/^EXTRAVERSION :=.*//" "${S}/Makefile" || die
fi
sed -i "s:\$(CKVERSION)::" "${S}/Makefile" || die
OKV="${okv}"
# unpack x-loader if required
if [ -n "${K_NASKERNEL_XLOADER_VER}" ]; then
pushd ${WORKDIR}
unpack x-loader-${K_NASKERNEL_XLOADER_VER}.orig.tar.gz
if [ -n "${K_NASKERNEL_XLOADER_PATCHES_VER}" ]; then
unpack x-loader-patches-${K_NASKERNEL_XLOADER_VER}-${K_NASKERNEL_XLOADER_PATCHES_VER}.tar.bz2
fi
popd
fi
# unpack u-boot if required
if [ -n "${K_NASKERNEL_UBOOT_VER}" ]; then
pushd ${WORKDIR}
unpack u-boot-${K_NASKERNEL_UBOOT_VER}.tar.bz2
if [ -n "${K_NASKERNEL_UBOOT_PATCHES_VER}" ]; then
unpack u-boot-patches-${K_NASKERNEL_UBOOT_VER}-${K_NASKERNEL_UBOOT_PATCHES_VER}.tar.bz2
fi
popd
fi
}
nas-kernel_src_compile() {
@ -448,53 +388,11 @@ _kernel_src_compile() {
# disable sandbox
export SANDBOX_ON=0
# creating workdirs
# some kernels fail with make 3.82 if firmware dir is not created
mkdir "${WORKDIR}"/lib/lib/firmware -p
mkdir "${WORKDIR}"/cache
mkdir "${S}"/temp
# needed anyway, even if grub use flag is not used here
if use arm ; then
mkdir -p "${WORKDIR}"/boot/dtb
else
mkdir -p "${WORKDIR}"/boot
# compile x-loader if required
if [ -n "${K_NASKERNEL_XLOADER_VER}" ]; then
einfo "Starting to compile X Loader..."
pushd "${WORKDIR}/x-loader-${K_NASKERNEL_XLOADER_VER}"
if [ -n "${K_NASKERNEL_XLOADER_PATCHES_VER}" ]; then
EPATCH_SOURCE="${WORKDIR}/x-loader-patches" EPATCH_SUFFIX="patch" \
EPATCH_FORCE="yes" epatch
fi
if [ -n "${CROSS_COMPILE}" ] && [ "${CBUILD:-${CHOST}}" != "${CTARGET}" ]; then
einfo "Enabling cross-compile for ${CROSS_COMPILE}, arch: ${KARCH}"
emake ARCH=${KARCH} CROSS_COMPILE=${CROSS_COMPILE}- ${K_NASKERNEL_XLOADER_TARGET}
emake ARCH=${KARCH} CROSS_COMPILE=${CROSS_COMPILE}-
else
einfo "Cross-compile is disabled"
emake CROSS_COMPILE=${CTARGET}- ${K_NASKERNEL_XLOADER_TARGET}
emake CROSS_COMPILE=${CTARGET}-
fi
popd
fi
# compile u-boot if required
if [ -n "${K_NASKERNEL_UBOOT_VER}" ]; then
einfo "Starting to compile U Boot..."
pushd "${WORKDIR}/u-boot-${K_NASKERNEL_UBOOT_VER}"
if [ -n "${K_KERNEL_UBOOT_PATCHES_VER}" ]; then
EPATCH_SOURCE="${WORKDIR}/u-boot-patches" EPATCH_SUFFIX="patch" \
EPATCH_FORCE="yes" epatch
fi
if [ -n "${CROSS_COMPILE}" ] && [ "${CBUILD:-${CHOST}}" != "${CTARGET}" ]; then
einfo "Enabling cross-compile for ${CROSS_COMPILE}, arch: ${KARCH}"
emake ARCH=${KARCH} CROSS_COMPILE=${CROSS_COMPILE}- ${K_NASKERNEL_UBOOT_TARGET}
emake ARCH=${KARCH} CROSS_COMPILE=${CROSS_COMPILE}-
else
einfo "Cross-compile is disabled"
emake CROSS_COMPILE=${CTARGET}- ${K_NASKERNEL_UBOOT_TARGET}
emake CROSS_COMPILE=${CTARGET}-
fi
popd
fi
einfo "Starting to compile kernel..."
@ -505,11 +403,20 @@ _kernel_src_compile() {
rm -rf "${WORKDIR}"/cache
rm -rf "${S}"/temp
# creating workdirs
# some kernels fail with make 3.82 if firmware dir is not created
mkdir "${WORKDIR}"/lib/lib/firmware -p
mkdir "${WORKDIR}"/cache
mkdir "${S}"/temp
cd "${S}" || die
GKARGS="--no-save-config --disklabel"
use dracut && GKARGS="${GKARGS} --dracut"
use dmraid && GKARGS="${GKARGS} --dmraid"
use iscsi && GKARGS="${GKARGS} --iscsi"
use mdadm && GKARGS="${GKARGS} --mdadm"
use lvm && GKARGS="${GKARGS} --lvm"
export DEFAULT_KERNEL_SOURCE="${S}"
export CMD_KERNEL_DIR="${S}"
for opt in ${MAKEOPTS}; do
@ -524,19 +431,31 @@ _kernel_src_compile() {
env_setup_xmakeopts
[ -n "${xmakeopts}" ] && eval "${xmakeopts}"
if [ -n "${CROSS_COMPILE}" ] && [ "${CBUILD:-${CHOST}}" != "${CTARGET}" ]; then
einfo "Enabling cross-compile for ${CROSS_COMPILE}, arch: ${KARCH}"
einfo "Enabling cross-emerge for ${CROSS_COMPILE}, arch: ${KARCH}"
GKARGS="${GKARGS} --arch-override=${KARCH}"
GKARGS="${GKARGS} --kernel-cross-compile=${CROSS_COMPILE}"
GKARGS="${GKARGS} --utils-cross-compile=${CROSS_COMPILE}"
# ARCH= must be forced to KARCH
ARCH="${KARCH}"
else
einfo "Cross-compile is disabled"
einfo "Cross-emerge is disabled"
unset CROSS_COMPILE
unset ARCH
use ccache && GKARGS="${GKARGS} --kernel-cc=/usr/lib/ccache/bin/gcc"
fi
# If ARM, build the uImage directly
#if use arm; then
# K_GENKERNEL_ARGS+=" --kernel-target=uImage --kernel-binary=arch/arm/boot/uImage"
#fi
# Workaround bug in splash_geninitramfs corrupting the initramfs
# if xz compression is used (newer genkernel >3.4.24)
local support_comp=$(genkernel --help | grep compress-initramfs-type)
if [ -n "${support_comp}" ]; then
GKARGS+=" --compress-initramfs-type=gzip"
fi
# Buffalo anounced a new box named Pro Live (video transcode streaming)
# so the old ls_pro_live has to be split to ls_pro ls_live
# for now let it stay but a move schould be done to ls_pro
@ -614,10 +533,6 @@ _kernel_src_compile() {
--logfile="${WORKDIR}"/genkernel.log \
--bootdir="${WORKDIR}"/boot \
--mountboot \
--lvm \
--luks \
--iscsi \
--mdadm \
--module-prefix="${WORKDIR}"/lib \
all || die "genkernel failed"
ARCH=${OLDARCH}
@ -629,27 +544,32 @@ _kernel_src_compile() {
-d zImage.new "${WORKDIR}"/boot/uImage-genkernel-${ARCH}-${KV_FULL}.buffalo
mkimage -A arm -O linux -T ramdisk -C none -a 0x00000000 -e 0x00000000 -n initrd-${KV_FULL} \
-d "${WORKDIR}"/boot/initramfs-genkernel-${ARCH}-${KV_FULL} "${WORKDIR}"/boot/initrd-genkernel-${ARCH}-${KV_FULL}.buffalo
# install u-boot if required
if [ -n "${K_NASKERNEL_UBOOT_VER}" ]; then
cp "${WORKDIR}"/u-boot-${K_NASKERNEL_UBOOT_VER}/u-boot.bin "${WORKDIR}"/boot/u-boot-${ARCH}-${K_NASKERNEL_UBOOT_VER}.${K_NASKERNEL_NAME}
fi
fi
# Default uImage and uInit handling
if [ "${K_NASKERNEL_TYPE}" = "default" ]; then
cp "${WORKDIR}"/boot/kernel-genkernel-${ARCH}-${KV_FULL} "${WORKDIR}"/boot/uImage-genkernel-${ARCH}-${KV_FULL}
mkimage -A arm -O linux -T ramdisk -C none -a 0x00000000 -e 0x00000000 -n initrd-${KV_FULL} \
-d "${WORKDIR}"/boot/initramfs-genkernel-${ARCH}-${KV_FULL} "${WORKDIR}"/boot/uInitrd-genkernel-${ARCH}-${KV_FULL}
# install u-boot if required
if [ -n "${K_NASKERNEL_UBOOT_VER}" ]; then
cp "${WORKDIR}"/u-boot-${K_NASKERNEL_UBOOT_VER}/u-boot.bin "${WORKDIR}"/boot/u-boot-${ARCH}-${K_NASKERNEL_UBOOT_VER}.${K_NASKERNEL_NAME}
fi
fi
# # Default uImage and uInit handling
# if [ "${K_NASKERNEL_TYPE}" = "default" ]; then
# cp "${WORKDIR}"/boot/kernel-genkernel-${ARCH}-${KV_FULL} "${WORKDIR}"/boot/uImage-genkernel-${ARCH}-${KV_FULL}
# mkimage -A arm -O linux -T ramdisk -C none -a 0x00000000 -e 0x00000000 -n initrd-${KV_FULL} \
# -d "${WORKDIR}"/boot/initramfs-genkernel-${ARCH}-${KV_FULL} "${WORKDIR}"/boot/uInitrd-genkernel-${ARCH}-${KV_FULL}
# fi
# cleanup
rm foo zImage.new
rm "${WORKDIR}"/boot/kernel-genkernel-${ARCH}-${KV_FULL} "${WORKDIR}"/boot/initramfs-genkernel-${ARCH}-${KV_FULL}
}
_setup_mkimage_ramdisk() {
local initramfs=$(ls "${WORKDIR}"/boot/${KERN_INITRAMFS_SEARCH_NAME}* 2> /dev/null)
if [ ! -e "${initramfs}" ] || [ ! -f "${initramfs}" ]; then
ewarn "No initramfs at ${initramfs}, cannot run mkimage on it!"
else
einfo "Setting up u-boot initramfs for: ${initramfs}"
/usr/bin/mkimage -A arm -O linux -T ramdisk -C none -a "${K_MKIMAGE_RAMDISK_ADDRESS}" \
-e "${K_MKIMAGE_RAMDISK_ENTRYPOINT}" -d "${initramfs}" \
"${initramfs}.u-boot" || return 1
mv "${initramfs}.u-boot" "${initramfs}" || return 1
fi
return 0
}
nas-kernel_src_install() {
@ -693,6 +613,8 @@ _kernel_sources_src_install() {
}
_kernel_src_install() {
use arm && { _setup_mkimage_ramdisk || die "cannot setup mkimage"; }
dodir "${KV_OUT_DIR}"
insinto "${KV_OUT_DIR}"
@ -718,8 +640,8 @@ _kernel_src_install() {
doins "${S}/include/linux/version.h" || die "cannot copy version.h"
insinto "/boot"
doins "${WORKDIR}"/boot/*
cp -Rp "${WORKDIR}"/lib/* "${D}/"
doins "${WORKDIR}"/boot/* || die "cannot copy /boot over"
cp -Rp "${WORKDIR}"/lib/* "${D}/" || die "cannot copy /lib over"
# This doesn't always work because KV_FULL (when K_NOSETEXTRAVERSION=1) doesn't
# reflect the real value used in Makefile
@ -760,7 +682,6 @@ _kernel_src_install() {
einfo "Installing ${base_dir}/RELEASE_LEVEL file: ${KV_FULL}"
fi
# copy firmware config file to propper location
if [ -n "${K_NASKERNEL_SELF_TARBALL_NAME}" ]; then
local base_path="${S}/sablink/config"
@ -801,6 +722,38 @@ _get_release_level() {
fi
}
nas-kernel_uimage_config() {
# Two cases here:
# 1. /boot/uImage symlink is broken (pkg_postrm)
# 2. /boot/uImage symlink doesn't exist (pkg_postinst)
if ! has_version app-admin/eselect-uimage; then
ewarn "app-admin/eselect-uimage not installed"
ewarn "If you are using this tool, please install it"
return 0
fi
local uimage_file=$(eselect uimage show --quiet 2> /dev/null)
if [ -z "${uimage_file}" ]; then
# pick the first listed, sorry!
local eselect_list=$(eselect uimage list --quiet 2> /dev/null)
if [ -n "${eselect_list}" ]; then
eselect uimage set 1
else
echo
ewarn "No more kernels available, you won't be able to boot"
echo
fi
else
echo
elog "You are currently booting with kernel:"
elog "${uimage_file}"
elog
elog "Use 'eselect uimage' in order to switch between the available ones"
echo
fi
}
nas-kernel_pkg_postinst() {
if _is_kernel_binary; then
fstab_file="${ROOT}etc/fstab"
@ -810,6 +763,11 @@ nas-kernel_pkg_postinst() {
sed -i '/ext4/ s/extents//g' "${fstab_file}"
fi
# Setup newly installed kernel on ARM
if use arm; then
nas-kernel_uimage_config
fi
kernel-2_pkg_postinst
local depmod_r=$(_get_release_level)
_update_depmod "${depmod_r}"
@ -819,16 +777,17 @@ nas-kernel_pkg_postinst() {
elog "The source code of this kernel is located at"
elog "=${K_KERNEL_SOURCES_PKG}."
elog "Sabayon Linux recommends that portage users install"
elog "Sablink Linux recommends that portage users install"
elog "${K_KERNEL_SOURCES_PKG} if you want"
elog "to build any packages that install kernel modules"
elog "(such as ati-drivers, nvidia-drivers, virtualbox, etc...)."
elog "(such as sim-buffalo, etc...)."
# copy the firmware config for the actual hardware to the right place
device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | head -n1 | sed "s/^[^:]*: //")
if [ "${K_NASKERNEL_DEVICE}" = "$device" ]; then
cp ${ROOT}/etc/fw_env.config.${K_NASKERNEL_NAME} ${ROOT}/etc/fw_env.config
fi
else
kernel-2_pkg_postinst
fi
@ -842,7 +801,10 @@ nas-kernel_pkg_prerm() {
nas-kernel_pkg_postrm() {
if _is_kernel_binary; then
mount-boot_pkg_postrm
# Setup newly installed kernel on ARM
if use arm; then
nas-kernel_uimage_config
fi
fi
}

View File

@ -4,13 +4,13 @@
# @ECLASS-VARIABLE: K_NASPATCHES_VER
# @DESCRIPTION:
# The version of the genlink patches tarball(s) to apply.
# The version of the sablink patches tarball(s) to apply.
# A value of "5" would apply 2.6.12-5 to my-sources-2.6.12.ebuild
# @ECLASS-VARIABLE: K_NASKERNEL_NAME
# @DESCRIPTION:
# The kernel name used by the ebuild, it should be the ending ${PN} part
# for example, of linux-genlink it is "${PN/${PN/-*}-}" (genlink)
# for example, of linux-sablink it is "${PN/${PN/-*}-}" (sablink)
K_NASKERNEL_NAME="${K_NASKERNEL_NAME:-${PN/${PN/-*}-}}"
# @ECLASS-VARIABLE: K_NASKERNEL_URI_CONFIG
@ -23,14 +23,14 @@ K_NASKERNEL_URI_CONFIG="${K_NASKERNEL_URI_CONFIG:-no}"
# @ECLASS-VARIABLE: K_NASKERNEL_SELF_TARBALL_NAME
# @DESCRIPTION:
# If the main kernel sources tarball is generated in-house and available
# on the "genlink" mirror, set this variable to the extension name (see example
# on the "sablink" mirror, set this variable to the extension name (see example
# below). This will disable ALL the extra/local patches (since they have to
# be applied inside the tarball). Moreover, K_NASKERNEL_URI_CONFIG,
# K_NASPATCHES_VER, K_NASKERNEL_NAME, K_KERNEL_PATCH_VER will be ignored.
# Example:
# K_NASKERNEL_SELF_TARBALL_NAME="genlink"
# K_NASKERNEL_SELF_TARBALL_NAME="sablink"
# This would generate:
# SRC_URI="mirror://genlink/sys-kernel/linux-${PV}+genlink.tar.bz2"
# SRC_URI="mirror://sablink/sys-kernel/linux-${PV}+sablink.tar.bz2"
K_NASKERNEL_SELF_TARBALL_NAME="${K_NASKERNEL_SELF_TARBALL_NAME:-}"
# @ECLASS-VARIABLE: K_NASKERNEL_FORCE_SUBLEVEL
@ -68,12 +68,12 @@ K_KERNEL_PATCH_VER="${K_KERNEL_PATCH_VER:-}"
# pointing to space separated list of patch paths.
K_KERNEL_PATCH_HOTFIXES="${K_KERNEL_PATCH_HOTFIXES:-}"
# @ECLASS-VARIABLE: K_KERNEL_DISABLE_PR_EXTRAVERSION
# @ECLASS-VARIABLE: K_KERNEL_DINASLE_PR_EXTRAVERSION
# @DESCRIPTION:
# Set this to "1" if you want to tell kernel-2 eclass to
# not use ${PR} in kernel EXTRAVERSION (K_NOUSEPR). Otherwise, set
# this to "0" to not set K_NOUSEPR at all.
K_KERNEL_DISABLE_PR_EXTRAVERSION="${K_KERNEL_DISABLE_PR_EXTRAVERSION:-1}"
K_KERNEL_DINASLE_PR_EXTRAVERSION="${K_KERNEL_DINASLE_PR_EXTRAVERSION:-1}"
# @ECLASS-VARIABLE: K_KERNEL_SLOT_USEPVR
# @DESCRIPTION:
@ -117,6 +117,38 @@ K_WORKAROUND_USE_REAL_EXTRAVERSION="${K_WORKAROUND_USE_REAL_EXTRAVERSION:-}"
# Provide extra genkernel arguments using K_GENKERNEL_ARGS
K_GENKERNEL_ARGS="${K_GENKERNEL_ARGS-}"
# @ECLASS-VARIABLE: K_NASKERNEL_XLOADER_VER
# @DESCRIPTION:
# If set to "1.5.1" for example, it downloads the selected version
K_NASKERNEL_XLOADER_VER="${K_NASKERNEL_XLOADER_VER:-}"
# @ECLASS-VARIABLE: K_NASKERNEL_XLOADER_PATCHES_VER
# @DESCRIPTION:
# If set to "3" for example, it applies the
# patchs corresponding to x-loader-${K_NASKERNEL_XLOADER_VER}
K_NASKERNEL_XLOADER_PATCHES_VER="${K_NASKERNEL_XLOADER_PATCHES_VER:-}"
# @ECLASS-VARIABLE: K_NASKERNEL_XLOADER_TARGET
# @DESCRIPTION:
# If set to "omap4430panda_config" for example, it is build for that arch
K_NASKERNEL_XLOADER_TARGET="${K_NASKERNEL_XLOADER_TARGET:-}"
# @ECLASS-VARIABLE: K_KERNEL_UBOOT_VER
# @DESCRIPTION:
# If set to "2011.12" for example, it downloads the selected version
K_NASKERNEL_UBOOT_VER="${K_NASKERNEL_UBOOT_VER:-}"
# @ECLASS-VARIABLE: K_KERNEL_UBOOT_PATCHES_VER
# @DESCRIPTION:
# If set to "3" for example, it applies the
# patchs corresponding to u-boot-${K_NASKERNEL_UBOOT_VER}
K_NASKERNEL_UBOOT_PATCHES_VER="${K_NASKERNEL_UBOOT_PATCHES_VER:-}"
# @ECLASS-VARIABLE: K_NASKERNEL_UBOOT_TARGET
# @DESCRIPTION:
# If set to "omap4_panda_config" for example, it is build for that arch
K_NASKERNEL_UBOOT_TARGET="${K_NASKERNEL_UBOOT_TARGET:-}"
KERN_INITRAMFS_SEARCH_NAME="${KERN_INITRAMFS_SEARCH_NAME:-initramfs-genkernel*${K_NASKERNEL_NAME}}"
# Disable deblobbing feature
@ -128,7 +160,7 @@ inherit eutils kernel-2 mount-boot linux-info
detect_version
detect_arch
DESCRIPTION="Genlink Linux kernel functions and phases"
DESCRIPTION="Sabayon Linux kernel functions and phases"
K_LONGTERM_URL_STR=""
@ -138,13 +170,13 @@ fi
## kernel-2 eclass settings
if [ -n "${K_NASKERNEL_SELF_TARBALL_NAME}" ]; then
SRC_URI="mirror://genlink/${CATEGORY}/linux-${PVR}+${K_NASKERNEL_SELF_TARBALL_NAME}.tar.bz2"
SRC_URI="mirror://sablink/${CATEGORY}/linux-${PVR}+${K_NASKERNEL_SELF_TARBALL_NAME}.tar.bz2"
elif [ -n "${K_NASPATCHES_VER}" ]; then
UNIPATCH_STRICTORDER="yes"
K_NASPATCHES_PKG="nas-patches-${PV}-${K_NASPATCHES_VER}.tar.bz2"
UNIPATCH_LIST="${DISTFILES}/${K_NASPATCHES_PKG}"
SRC_URI="${KERNEL_URI}
http://ftp.disconnected-by-peer.at/genlink/${CATEGORY}/linux-nas-patches/${K_NASPATCHES_PKG}"
mirror://sablink/${CATEGORY}/linux-nas-patches/${K_NASPATCHES_PKG}"
else
SRC_URI="${KERNEL_URI}"
fi
@ -153,8 +185,7 @@ if [ -z "${K_NASKERNEL_SELF_TARBALL_NAME}" ]; then
if [ -n "${K_KERNEL_PATCH_VER}" ]; then
K_PATCH_NAME="patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.${K_KERNEL_PATCH_VER}.bz2"
SRC_URI="${SRC_URI}
mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}${K_LONGTERM_URL_STR}/${K_PATCH_NAME}
ftp://ftp.servus.at/linux-kernel/${K_PATCH_NAME}"
mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}${K_LONGTERM_URL_STR}/${K_PATCH_NAME}"
UNIPATCH_LIST="${DISTDIR}/${K_PATCH_NAME}
${UNIPATCH_LIST}"
fi
@ -163,13 +194,34 @@ if [ -n "${K_KERNEL_PATCH_HOTFIXES}" ]; then
UNIPATCH_LIST="${K_KERNEL_PATCH_HOTFIXES} ${UNIPATCH_LIST}"
fi
# download x-loader if required (ubuntu is mainly supporterted by TI)
if [ -n "${K_NASKERNEL_XLOADER_VER}" ]; then
SRC_URI="${SRC_URI}
mirror://sablink/${CATEGORY}/linux-nas-patches/x-loader_${K_NASKERNEL_XLOADER_VER}.orig.tar.gz
https://launchpad.net/ubuntu/+archive/primary/+files/x-loader_${K_NASKERNEL_XLOADER_VER}.orig.tar.gz"
if [ -n "${K_NASKERNEL_XLOADER_PATCHES_VER}" ]; then
SRC_URI="${SRC_URI}
mirror://sablink/${CATEGORY}/linux-nas-patches/x-loader-patches-${K_NASKERNEL_XLOADER_VER}-${K_NASKERNEL_XLOADER_PATCHES_VER}.tar.bz2"
fi
fi
# download u-boot if required
if [ -n "${K_NASKERNEL_UBOOT_VER}" ]; then
SRC_URI="${SRC_URI}
mirror://sablink/${CATEGORY}/linux-nas-patches/u-boot-${K_NASKERNEL_UBOOT_VER}.tar.bz2
ftp://ftp.denx.de/pub/u-boot/u-boot-${K_NASKERNEL_UBOOT_VER}.tar.bz2"
if [ -n "${K_NASKERNEL_UBOOT_PATCHES_VER}" ]; then
SRC_URI="${SRC_URI}
mirror://sablink/${CATEGORY}/linux-nas-patches/u-boot-patches-${K_NASKERNEL_UBOOT_VER}-${K_NASKERNEL_UBOOT_PATCHES_VER}.tar.bz2"
fi
fi
_get_real_kv_full() {
if [[ "${KV_MAJOR}${KV_MINOR}" -eq 26 ]]; then
echo "${ORIGINAL_KV_FULL}"
elif [[ "${OKV/.*}" = "3" ]]; then
# Linux 3.x support, KV_FULL is set to: 3.0-genlink
# Linux 3.x support, KV_FULL is set to: 3.0-sablink
# need to add another final .0 to the version part
# echo "${ORIGINAL_KV_FULL/-/.0-}"
echo "${ORIGINAL_KV_FULL}"
else
echo "${ORIGINAL_KV_FULL}"
@ -177,11 +229,11 @@ _get_real_kv_full() {
}
# replace "linux" with K_NASKERNEL_NAME, usually replaces
# "linux" with "genlink" or "server" or "openvz"
# "linux" with "sablink" or "server" or "openvz"
KV_FULL="${KV_FULL/${PN/-*}/${K_NASKERNEL_NAME}}"
EXTRAVERSION="${EXTRAVERSION/${PN/-*}/${K_NASKERNEL_NAME}}"
# drop -rX if exists
if [[ -n "${PR//r0}" ]] && [[ "${K_KERNEL_DISABLE_PR_EXTRAVERSION}" = "1" ]] \
if [[ -n "${PR//r0}" ]] && [[ "${K_KERNEL_DINASLE_PR_EXTRAVERSION}" = "1" ]] \
&& [[ -z "${K_NOSETEXTRAVERSION}" ]]; then
EXTRAVERSION="${EXTRAVERSION%-r*}"
KV_FULL="${KV_FULL%-r*}"
@ -192,7 +244,7 @@ ORIGINAL_KV_FULL="${KV_FULL}"
KV_FULL="$(_get_real_kv_full)"
# Starting from linux-3.0, we still have to install
# sources stuff into /usr/src/linux-3.0.0-genlink (example)
# sources stuff into /usr/src/linux-3.0.0-sablink (example)
# where the last part must always match uname -r
# otherwise kernel-switcher (and RELEASE_LEVEL file)
# will complain badly
@ -224,10 +276,9 @@ if _is_kernel_binary; then
fi
if [ -n "${K_NASKERNEL_SELF_TARBALL_NAME}" ]; then
HOMEPAGE="http://git.disconnected-by-peer.at"
HOMEPAGE="http://gitweb.sablink.org/?p=linux/kernel/sablink.git;a=summary"
else
HOMEPAGE="http://linamh.disconnected-by-peer.at/wiki/Genlink"
HOMEPAGE="http://www.sablink.org"
fi
@ -235,25 +286,24 @@ fi
if [ -z "${K_NASKERNEL_SELF_TARBALL_NAME}" ]; then
if [ "${K_NASKERNEL_URI_CONFIG}" = "yes" ]; then
K_NASKERNEL_CONFIG_FILE="${K_NASKERNEL_CONFIG_FILE:-${K_NASKERNEL_NAME}-${PVR}-__ARCH__.config}"
K_NASKERNEL_FW_CONFIG_FILE="${K_NASKERNEL_FW_CONFIG_FILE:-${K_NASKERNEL_NAME}-fw_env-__ARCH__.config}"
SRC_URI="${SRC_URI}
arm? ( http://ftp.disconnected-by-peer.at/genlink/${CATEGORY}/linux-nas-patches/config/${K_NASKERNEL_CONFIG_FILE/__ARCH__/arm} )"
#http://ftp.disconnected-by-peer.at/genlink/${CATEGORY}/linux-nas-patches/config/${K_NASKERNEL_CONFIG_FILE/__ARCH__/arm}"
arm? ( mirror://sablink/${CATEGORY}/linux-nas-patches/config/${K_NASKERNEL_CONFIG_FILE/__ARCH__/arm}
mirror://sablink/${CATEGORY}/linux-nas-patches/config/${K_NASKERNEL_FW_CONFIG_FILE/__ARCH__/arm} )"
use arm && K_NASKERNEL_CONFIG_FILE=${K_NASKERNEL_CONFIG_FILE/__ARCH__/arm}
#K_NASKERNEL_CONFIG_FILE=${K_NASKERNEL_CONFIG_FILE/__ARCH__/arm}
use arm && K_NASKERNEL_FW_CONFIG_FILE=${K_NASKERNEL_FW_CONFIG_FILE/__ARCH__/arm}
else
use arm && K_NASKERNEL_CONFIG_FILE="${K_NASKERNEL_CONFIG_FILE:-${K_NASKERNEL_NAME}-${PVR}-arm.config}"
#K_NASKERNEL_CONFIG_FILE="${K_NASKERNEL_CONFIG_FILE:-${K_NASKERNEL_NAME}-${PVR}-arm.config}"
use arm && K_NASKERNEL_FW_CONFIG_FILE="${K_NASKERNEL_FW_CONFIG_FILE:-${K_NASKERNEL_NAME}-fw_env-arm.config}"
fi
else
K_NASKERNEL_CONFIG_FILE="${K_NASKERNEL_CONFIG_FILE:-${K_NASKERNEL_NAME}-${PVR}-__ARCH__.config}"
K_NASKERNEL_ALT_CONFIG_FILE="${K_NASKERNEL_ALT_CONFIG_FILE:-${K_NASKERNEL_NAME}-${PV}-__ARCH__.config}"
if use amd64; then
K_NASKERNEL_CONFIG_FILE=${K_NASKERNEL_CONFIG_FILE/__ARCH__/amd64}
K_NASKERNEL_ALT_CONFIG_FILE=${K_NASKERNEL_ALT_CONFIG_FILE/__ARCH__/amd64}
elif use x86; then
K_NASKERNEL_CONFIG_FILE=${K_NASKERNEL_CONFIG_FILE/__ARCH__/x86}
K_NASKERNEL_ALT_CONFIG_FILE=${K_NASKERNEL_ALT_CONFIG_FILE/__ARCH__/x86}
K_NASKERNEL_FW_CONFIG_FILE="${K_NASKERNEL_FW_CONFIG_FILE:-${K_NASKERNEL_NAME}-fw_env-__ARCH__.config}"
if use arm; then
K_NASKERNEL_CONFIG_FILE=${K_NASKERNEL_CONFIG_FILE/__ARCH__/arm}
K_NASKERNEL_ALT_CONFIG_FILE=${K_NASKERNEL_ALT_CONFIG_FILE/__ARCH__/arm}
K_NASKERNEL_FW_CONFIG_FILE=${K_NASKERNEL_FW_CONFIG_FILE/__ARCH__/arm}
fi
fi
@ -262,18 +312,17 @@ if [ -n "${K_ONLY_SOURCES}" ] || [ -n "${K_FIRMWARE_PACKAGE}" ]; then
DEPEND="sys-apps/sed"
RDEPEND="${RDEPEND}"
else
IUSE="dmraid dracut"
IUSE="dmraid dracut ccache"
DEPEND="app-arch/xz-utils
sys-apps/sed
sys-devel/make
>=sys-kernel/genkernel-3.4.16-r1
dracut? ( sys-kernel/dracut )
ccache? ( dev-util/ccache )
sys-block/devio
dev-embedded/u-boot-tools"
# rdepend app-admin/nas-eselct
# FIXME: when grub-legacy will be removed, remove sys-boot/grub-handler
RDEPEND="
sys-apps/sed
dev-embedded/u-boot-tools
sys-fs/dosfstools"
RDEPEND="sys-apps/sed
sys-kernel/linux-firmware"
if [ -n "${K_REQUIRED_LINUX_FIRMWARE_VER}" ]; then
RDEPEND+=" >=sys-kernel/linux-firmware-${K_REQUIRED_LINUX_FIRMWARE_VER}"
@ -330,9 +379,28 @@ nas-kernel_src_unpack() {
# some sources could have multiple append-based EXTRAVERSIONs
sed -i "s/^EXTRAVERSION :=.*//" "${S}/Makefile" || die
fi
# no need for the ckversion
sed -i "s:\$(CKVERSION)::" "${S}/Makefile" || die
OKV="${okv}"
# unpack x-loader if required
if [ -n "${K_NASKERNEL_XLOADER_VER}" ]; then
pushd ${WORKDIR}
unpack x-loader-${K_NASKERNEL_XLOADER_VER}.orig.tar.gz
if [ -n "${K_NASKERNEL_XLOADER_PATCHES_VER}" ]; then
unpack x-loader-patches-${K_NASKERNEL_XLOADER_VER}-${K_NASKERNEL_XLOADER_PATCHES_VER}.tar.bz2
fi
popd
fi
# unpack u-boot if required
if [ -n "${K_NASKERNEL_UBOOT_VER}" ]; then
pushd ${WORKDIR}
unpack u-boot-${K_NASKERNEL_UBOOT_VER}.tar.bz2
if [ -n "${K_NASKERNEL_UBOOT_PATCHES_VER}" ]; then
unpack u-boot-patches-${K_NASKERNEL_UBOOT_VER}-${K_NASKERNEL_UBOOT_PATCHES_VER}.tar.bz2
fi
popd
fi
}
nas-kernel_src_compile() {
@ -359,7 +427,7 @@ _firmwares_src_compile() {
_kernel_copy_config() {
if [ -n "${K_NASKERNEL_SELF_TARBALL_NAME}" ]; then
local base_path="${S}/genlink/config"
local base_path="${S}/sablink/config"
if [ -f "${base_path}/${K_NASKERNEL_ALT_CONFIG_FILE}" ]; then
# new path, without revision
cp "${base_path}/${K_NASKERNEL_ALT_CONFIG_FILE}" "${1}" || die "cannot copy kernel config"
@ -379,15 +447,56 @@ _kernel_copy_config() {
_kernel_src_compile() {
# disable sandbox
export SANDBOX_ON=0
export LDFLAGS=""
# creating workdirs
# some kernels fail with make 3.82 if firmware dir is not created
mkdir "${WORKDIR}"/lib/lib/firmware -p
mkdir "${WORKDIR}"/cache
mkdir "${S}"/temp
# needed anyway, even if grub use flag is not used here
mkdir -p "${WORKDIR}"/boot
# compile x-loader if required
if [ -n "${K_NASKERNEL_XLOADER_VER}" ]; then
einfo "Starting to compile X Loader..."
pushd "${WORKDIR}/x-loader-${K_NASKERNEL_XLOADER_VER}"
if [ -n "${K_NASKERNEL_XLOADER_PATCHES_VER}" ]; then
EPATCH_SOURCE="${WORKDIR}/x-loader-patches" EPATCH_SUFFIX="patch" \
EPATCH_FORCE="yes" epatch
fi
if [ -n "${CROSS_COMPILE}" ] && [ "${CBUILD:-${CHOST}}" != "${CTARGET}" ]; then
einfo "Enabling cross-compile for ${CROSS_COMPILE}, arch: ${KARCH}"
emake ARCH=${KARCH} CROSS_COMPILE=${CROSS_COMPILE}- ${K_NASKERNEL_XLOADER_TARGET}
emake ARCH=${KARCH} CROSS_COMPILE=${CROSS_COMPILE}-
else
einfo "Cross-compile is disabled"
emake CROSS_COMPILE=${CTARGET}- ${K_NASKERNEL_XLOADER_TARGET}
emake CROSS_COMPILE=${CTARGET}-
fi
popd
fi
# compile u-boot if required
if [ -n "${K_NASKERNEL_UBOOT_VER}" ]; then
einfo "Starting to compile U Boot..."
pushd "${WORKDIR}/u-boot-${K_NASKERNEL_UBOOT_VER}"
if [ -n "${K_KERNEL_UBOOT_PATCHES_VER}" ]; then
EPATCH_SOURCE="${WORKDIR}/u-boot-patches" EPATCH_SUFFIX="patch" \
EPATCH_FORCE="yes" epatch
fi
if [ -n "${CROSS_COMPILE}" ] && [ "${CBUILD:-${CHOST}}" != "${CTARGET}" ]; then
einfo "Enabling cross-compile for ${CROSS_COMPILE}, arch: ${KARCH}"
emake ARCH=${KARCH} CROSS_COMPILE=${CROSS_COMPILE}- ${K_NASKERNEL_UBOOT_TARGET}
emake ARCH=${KARCH} CROSS_COMPILE=${CROSS_COMPILE}-
else
einfo "Cross-compile is disabled"
emake CROSS_COMPILE=${CTARGET}- ${K_NASKERNEL_UBOOT_TARGET}
emake CROSS_COMPILE=${CTARGET}-
fi
popd
fi
einfo "Starting to compile kernel..."
_kernel_copy_config "${WORKDIR}"/config
@ -395,8 +504,8 @@ _kernel_src_compile() {
rm -rf "${WORKDIR}"/lib
rm -rf "${WORKDIR}"/cache
rm -rf "${S}"/temp
OLDARCH="${ARCH}"
unset ARCH
cd "${S}" || die
GKARGS="--no-save-config --disklabel"
use dracut && GKARGS="${GKARGS} --dracut"
@ -411,6 +520,91 @@ _kernel_src_compile() {
done
[ -z "${mkopts}" ] && mkopts="-j3"
OLDARCH="${ARCH}"
env_setup_xmakeopts
[ -n "${xmakeopts}" ] && eval "${xmakeopts}"
if [ -n "${CROSS_COMPILE}" ] && [ "${CBUILD:-${CHOST}}" != "${CTARGET}" ]; then
einfo "Enabling cross-compile for ${CROSS_COMPILE}, arch: ${KARCH}"
GKARGS="${GKARGS} --arch-override=${KARCH}"
GKARGS="${GKARGS} --kernel-cross-compile=${CROSS_COMPILE}"
GKARGS="${GKARGS} --utils-cross-compile=${CROSS_COMPILE}"
# ARCH= must be forced to KARCH
ARCH="${KARCH}"
else
einfo "Cross-compile is disabled"
unset CROSS_COMPILE
unset ARCH
use ccache && GKARGS="${GKARGS} --kernel-cc=/usr/lib/ccache/bin/gcc"
fi
# Buffalo anounced a new box named Pro Live (video transcode streaming)
# so the old ls_pro_live has to be split to ls_pro ls_live
# for now let it stay but a move schould be done to ls_pro
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_chl" ]; then
devio > foo 'wl 0xe3a01c0B,4' 'wl 0xe3811061,4' # Linkstation Live V3 (2.6.34)
K_NASKERNEL_TYPE="buffalo"
K_NASKERNEL_DEVICE="Buffalo Linkstation LiveV3 (LS-CHL)"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_chl2" ]; then
devio > foo 'wl 0xe3a01c0a,4' 'wl 0xe3811067,4' # Linkstation XHL/CHLv2 (2.6.30)
K_NASKERNEL_TYPE="buffalo"
K_NASKERNEL_DEVICE="Buffalo LS-XHL Series"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_hgl" ]; then
devio > foo 'wl 0xe3a01c07,4' 'wl 0xe38110d5,4' # Linkstation HGL (2.6.31)
K_NASKERNEL_TYPE="buffalo"
K_NASKERNEL_DEVICE="Buffalo Linkstation LS-HGL"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_live" ]; then
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811031,4' # Linkstation Pro/Live (2.6.26)
K_NASKERNEL_TYPE="buffalo"
K_NASKERNEL_DEVICE="Buffalo Linkstation Pro/Live"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_mini" ]; then
devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811042,4' # Linkstation mini (2.6.29)
K_NASKERNEL_TYPE="buffalo"
K_NASKERNEL_DEVICE="Buffalo Linkstation Mini"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_pro" ]; then
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811031,4' # Linkstation Pro/Live (2.6.26)
K_NASKERNEL_TYPE="buffalo"
K_NASKERNEL_DEVICE="Buffalo Linkstation Pro/Live"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_pro_duo_rev1" ]; then
devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811027,4' # Linkstation Pro Duo (2.6.30)
K_NASKERNEL_TYPE="buffalo"
K_NASKERNEL_DEVICE="Buffalo Linkstation Pro Duo - Revision 1"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_pro_duo_rev2" ]; then
devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811027,4' # Linkstation Pro Duo (2.6.30)
K_NASKERNEL_TYPE="buffalo"
K_NASKERNEL_DEVICE="Buffalo Linkstation Pro Duo - Revision 2"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_vl" ]; then
devio > foo 'wl 0xe3a01c0d,4' 'wl 0xe381100a,4' # Linkstation vl (2.6.35)
K_NASKERNEL_TYPE="buffalo"
K_NASKERNEL_DEVICE="Buffalo LS-VL Series"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_wxl" ]; then
devio > foo 'wl 0xe3a01c0b,4' 'wl 0xe38110c4,4' # Linkstation WXL (2.6.35)
K_NASKERNEL_TYPE="buffalo"
# Broken hardware name needs to be correct in u-boot firmware
K_NASKERNEL_DEVICE="Buffalo Linkstation Pro/Live"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_xhl" ]; then
devio > foo 'wl 0xe3a01c0a,4' 'wl 0xe3811067,4' # Linkstation XHL/CHLv2 (2.6.30)
K_NASKERNEL_TYPE="buffalo"
K_NASKERNEL_DEVICE="Buffalo LS-XHL Series"
fi
# Freescale
if [ "${K_NASKERNEL_NAME}" = "freescale_mx53_loco" ]; then
K_NASKERNEL_TYPE="default"
K_NASKERNEL_DEVICE="Freescale MX53 LOCO Board"
K_GENKERNEL_ARGS+=" --kernel-target=uImage --kernel-binary=arch/arm/boot/uImage"
fi
unset LDFLAGS
DEFAULT_KERNEL_SOURCE="${S}" CMD_KERNEL_DIR="${S}" genkernel ${GKARGS} ${K_GENKERNEL_ARGS} \
--kerneldir="${S}" \
--kernel-config="${WORKDIR}"/config \
@ -419,63 +613,15 @@ _kernel_src_compile() {
--tempdir="${S}"/temp \
--logfile="${WORKDIR}"/genkernel.log \
--bootdir="${WORKDIR}"/boot \
--mountboot \
--lvm \
--luks \
--iscsi \
--mountboot \
--mdadm \
--module-prefix="${WORKDIR}"/lib \
all || die "genkernel failed"
ARCH=${OLDARCH}
# Buffalo anounced a new box named Pro Live (video transcode streaming)
# so the old ls_pro_live has to be split to ls_pro ls_live
# for now let it stay but a move schould be done to ls_pro
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_pro_live" ]; then
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811031,4' # Linkstation Pro/Live (2.6.26)
K_NASKERNEL_TYPE="buffalo"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_pro" ]; then
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811031,4' # Linkstation Pro/Live (2.6.26)
K_NASKERNEL_TYPE="buffalo"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_live" ]; then
devio > foo 'wl 0xe3a01c06,4' 'wl 0xe3811031,4' # Linkstation Pro/Live (2.6.26)
K_NASKERNEL_TYPE="buffalo"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_pro_duo" ]; then
devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811027,4' # Linkstation Pro Duo (2.6.30)
K_NASKERNEL_TYPE="buffalo"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_xhl" ]; then
devio > foo 'wl 0xe3a01c0a,4' 'wl 0xe3811067,4' # Linkstation XHL/CHLv2 (2.6.30)
K_NASKERNEL_TYPE="buffalo"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_chl2" ]; then
devio > foo 'wl 0xe3a01c0a,4' 'wl 0xe3811067,4' # Linkstation XHL/CHLv2 (2.6.30)
K_NASKERNEL_TYPE="buffalo"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_chl" ]; then
devio > foo 'wl 0xe3a01c0B,4' 'wl 0xe3811061,4' # Linkstation Live V3 (2.6.34)
K_NASKERNEL_TYPE="buffalo"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_wxl" ]; then
devio > foo 'wl 0xe3a01c0b,4' 'wl 0xe38110c4,4' # Linkstation WXL (2.6.35)
K_NASKERNEL_TYPE="buffalo"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_hgl" ]; then
devio > foo 'wl 0xe3a01c07,4' 'wl 0xe38110d5,4' # Linkstation HGL (2.6.31)
K_NASKERNEL_TYPE="buffalo"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_mini" ]; then
devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811042,4' # Linkstation mini (2.6.29)
K_NASKERNEL_TYPE="buffalo"
fi
if [ "${K_NASKERNEL_NAME}" = "buffalo_ls_vl" ]; then
devio > foo 'wl 0xe3a01c0d,4' 'wl 0xe381100a,4' # Linkstation vl (2.6.35)
K_NASKERNEL_TYPE="buffalo"
fi
# Buffalo Boxes have a special naming and start address
if [ "${K_NASKERNEL_TYPE}" = "buffalo" ]; then
cat foo "${WORKDIR}"/boot/kernel-genkernel-${ARCH}-${KV_FULL} > zImage.new
@ -483,11 +629,27 @@ _kernel_src_compile() {
-d zImage.new "${WORKDIR}"/boot/uImage-genkernel-${ARCH}-${KV_FULL}.buffalo
mkimage -A arm -O linux -T ramdisk -C none -a 0x00000000 -e 0x00000000 -n initrd-${KV_FULL} \
-d "${WORKDIR}"/boot/initramfs-genkernel-${ARCH}-${KV_FULL} "${WORKDIR}"/boot/initrd-genkernel-${ARCH}-${KV_FULL}.buffalo
# install u-boot if required
if [ -n "${K_NASKERNEL_UBOOT_VER}" ]; then
cp "${WORKDIR}"/u-boot-${K_NASKERNEL_UBOOT_VER}/u-boot.bin "${WORKDIR}"/boot/u-boot-${ARCH}-${K_NASKERNEL_UBOOT_VER}.${K_NASKERNEL_NAME}
fi
fi
# Default uImage and uInit handling
if [ "${K_NASKERNEL_TYPE}" = "default" ]; then
cp "${WORKDIR}"/boot/kernel-genkernel-${ARCH}-${KV_FULL} "${WORKDIR}"/boot/uImage-genkernel-${ARCH}-${KV_FULL}
mkimage -A arm -O linux -T ramdisk -C none -a 0x00000000 -e 0x00000000 -n initrd-${KV_FULL} \
-d "${WORKDIR}"/boot/initramfs-genkernel-${ARCH}-${KV_FULL} "${WORKDIR}"/boot/uInitrd-genkernel-${ARCH}-${KV_FULL}
# install u-boot if required
if [ -n "${K_NASKERNEL_UBOOT_VER}" ]; then
cp "${WORKDIR}"/u-boot-${K_NASKERNEL_UBOOT_VER}/u-boot.bin "${WORKDIR}"/boot/u-boot-${ARCH}-${K_NASKERNEL_UBOOT_VER}.${K_NASKERNEL_NAME}
fi
fi
# cleanup
rm foo zImage.new
rm "${WORKDIR}"/boot/kernel-genkernel-${ARCH}-${KV_FULL} "${WORKDIR}"/boot/initramfs-genkernel-${ARCH}-${KV_FULL}
}
nas-kernel_src_install() {
@ -597,6 +759,19 @@ _kernel_src_install() {
doins "RELEASE_LEVEL"
einfo "Installing ${base_dir}/RELEASE_LEVEL file: ${KV_FULL}"
fi
# copy firmware config file to propper location
if [ -n "${K_NASKERNEL_SELF_TARBALL_NAME}" ]; then
local base_path="${S}/sablink/config"
cp "${base_path}/${K_NASKERNEL_FW_CONFIG_FILE}" "${D}/etc/fw_env.config.${K_NASKERNEL_NAME}" || die "cannot copy firmware config"
else
if [ "${K_NASKERNEL_URI_CONFIG}" = "no" ]; then
cp "${FILESDIR}/${PF/-r0/}-${ARCH}.config" "${D}/etc/fw_env.config.${K_NASKERNEL_NAME}" || die "cannot copy firmware config"
else
cp "${DISTDIR}/${K_NASKERNEL_FW_CONFIG_FILE}" "${D}/etc/fw_env.config.${K_NASKERNEL_NAME}" || die "cannot copy firmware config"
fi
fi
}
nas-kernel_pkg_preinst() {
@ -618,7 +793,7 @@ _get_release_level() {
elif [[ "${KV_MAJOR}${KV_MINOR}" -eq 26 ]]; then
echo "${KV_FULL}"
elif [[ "${OKV/.*}" = "3" ]] && [[ "${KV_PATCH}" = "0" ]]; then
# Linux 3.x support, KV_FULL is set to: 3.0-genlink
# Linux 3.x support, KV_FULL is set to: 3.0-sablink
# need to add another final .0 to the version part
echo "${KV_FULL/-/.0-}"
else
@ -640,14 +815,20 @@ nas-kernel_pkg_postinst() {
_update_depmod "${depmod_r}"
elog "Please report kernel bugs at:"
elog "http://bugs.genlink.org"
elog "http://bugs.sablink.org"
elog "The source code of this kernel is located at"
elog "=${K_KERNEL_SOURCES_PKG}."
elog "Genlink Linux recommends that portage users install"
elog "Sabayon Linux recommends that portage users install"
elog "${K_KERNEL_SOURCES_PKG} if you want"
elog "to build any packages that install kernel modules"
elog "(such as sim_buffalo, etc...)."
elog "(such as ati-drivers, nvidia-drivers, virtualbox, etc...)."
# copy the firmware config for the actual hardware to the right place
device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | head -n1 | sed "s/^[^:]*: //")
if [ "${K_NASKERNEL_DEVICE}" = "$device" ]; then
cp ${ROOT}/etc/fw_env.config.${K_NASKERNEL_NAME} ${ROOT}/etc/fw_env.config
fi
else
kernel-2_pkg_postinst
fi