* Housekeeping.
* Fix install to properly create extlinux.conf.
This commit is contained in:
parent
df69684957
commit
dd917ef7f2
4 changed files with 161 additions and 156 deletions
|
@ -5,26 +5,26 @@
|
|||
PKG_RKBIN="$(get_build_dir rkbin)"
|
||||
source ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options
|
||||
|
||||
if [ -n "$PKG_DATAFILE" -a -n "$PKG_LOADER" ]; then
|
||||
if [ -n "${PKG_DATAFILE}" -a -n "${PKG_LOADER}" ]; then
|
||||
tools/mkimage -n ${PKG_SOC} -T rksd -d "${PKG_DATAFILE}" idbloader.img
|
||||
cat "$PKG_LOADER" >> idbloader.img
|
||||
cp -av idbloader.img $INSTALL/usr/share/bootloader
|
||||
cat "${PKG_LOADER}" >> idbloader.img
|
||||
cp -av idbloader.img ${INSTALL}/usr/share/bootloader
|
||||
fi
|
||||
|
||||
if [ ! -n "${PKG_LOAD_ADDR}" ]; then
|
||||
PKG_LOAD_ADDR="0x00200000"
|
||||
fi
|
||||
|
||||
$PKG_RKBIN/tools/loaderimage --pack --uboot u-boot-dtb.bin uboot.img ${PKG_LOAD_ADDR}
|
||||
cp -av uboot.img $INSTALL/usr/share/bootloader
|
||||
${PKG_RKBIN}/tools/loaderimage --pack --uboot u-boot-dtb.bin uboot.img ${PKG_LOAD_ADDR}
|
||||
cp -av uboot.img ${INSTALL}/usr/share/bootloader
|
||||
|
||||
if [ -n "$PKG_BL31" ]; then
|
||||
if [ -n "${PKG_BL31}" ]; then
|
||||
cat >trust.ini <<EOF
|
||||
[BL30_OPTION]
|
||||
SEC=0
|
||||
[BL31_OPTION]
|
||||
SEC=1
|
||||
PATH=$PKG_BL31
|
||||
PATH=${PKG_BL31}
|
||||
ADDR=0x00010000
|
||||
[BL32_OPTION]
|
||||
SEC=0
|
||||
|
@ -39,13 +39,13 @@ EOF
|
|||
else
|
||||
TROPTS="--verbose"
|
||||
fi
|
||||
$PKG_RKBIN/tools/trust_merger ${TROPTS} trust.ini
|
||||
cp -av trust.img $INSTALL/usr/share/bootloader
|
||||
${PKG_RKBIN}/tools/trust_merger ${TROPTS} trust.ini
|
||||
cp -av trust.img ${INSTALL}/usr/share/bootloader
|
||||
fi
|
||||
|
||||
if [ "${BOOT_INI}" == true ]
|
||||
then
|
||||
cat >$INSTALL/usr/share/bootloader/boot.ini <<EOF
|
||||
cat >${INSTALL}/usr/share/bootloader/boot.ini <<EOF
|
||||
odroidgoa-uboot-config
|
||||
|
||||
setenv fdt_addr_r "0x01f00000"
|
||||
|
@ -58,3 +58,11 @@ sysboot mmc 1:1 any \${scriptaddr} /extlinux/extlinux.conf
|
|||
|
||||
EOF
|
||||
fi
|
||||
|
||||
mkdir -p "${INSTALL}/usr/share/bootloader/extlinux"
|
||||
cat << EOF > "${INSTALL}/usr/share/bootloader/extlinux/extlinux.conf"
|
||||
LABEL ${DISTRO}
|
||||
LINUX /${KERNEL_NAME}
|
||||
FDT /${DEVICE_DTB}.dtb
|
||||
APPEND boot=UUID=@BOOT_UUID@ disk=UUID=@DISK_UUID@ ${EXTRA_CMDLINE}
|
||||
EOF
|
||||
|
|
|
@ -4,35 +4,27 @@
|
|||
|
||||
source ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options
|
||||
|
||||
if [ -f "$RELEASE_DIR/3rdparty/bootloader/idbloader.img" ]; then
|
||||
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/idbloader.img" ]; then
|
||||
echo "image: burn idbloader.img to image..."
|
||||
dd if="$RELEASE_DIR/3rdparty/bootloader/idbloader.img" of="$DISK" bs=32k seek=1 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error
|
||||
dd if="${RELEASE_DIR}/3rdparty/bootloader/idbloader.img" of="$DISK" bs=32k seek=1 conv=fsync,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
|
||||
fi
|
||||
if [ -f "$RELEASE_DIR/3rdparty/bootloader/uboot.img" ]; then
|
||||
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/uboot.img" ]; then
|
||||
echo "image: burn uboot.img to image..."
|
||||
dd if="$RELEASE_DIR/3rdparty/bootloader/uboot.img" of="$DISK" bs=64k seek=128 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error
|
||||
dd if="${RELEASE_DIR}/3rdparty/bootloader/uboot.img" of="$DISK" bs=64k seek=128 conv=fsync,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
|
||||
fi
|
||||
if [ -f "$RELEASE_DIR/3rdparty/bootloader/trust.img" ]; then
|
||||
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/trust.img" ]; then
|
||||
echo "image: burn trust.img to image..."
|
||||
dd if="$RELEASE_DIR/3rdparty/bootloader/trust.img" of="$DISK" bs=64k seek=192 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error
|
||||
dd if="${RELEASE_DIR}/3rdparty/bootloader/trust.img" of="$DISK" bs=64k seek=192 conv=fsync,notrunc >"${SAVE_ERROR}" 2>&1 || show_error
|
||||
fi
|
||||
|
||||
if [ -f "$RELEASE_DIR/3rdparty/bootloader/boot.ini" ]; then
|
||||
cp "$RELEASE_DIR/3rdparty/bootloader/boot.ini" "${LE_TMP}/boot.ini"
|
||||
if [ -f "${RELEASE_DIR}/3rdparty/bootloader/boot.ini" ]; then
|
||||
cp "${RELEASE_DIR}/3rdparty/bootloader/boot.ini" "${LE_TMP}/boot.ini"
|
||||
mcopy -so "${LE_TMP}/boot.ini" ::
|
||||
fi
|
||||
|
||||
#if [ -f "$RELEASE_DIR/3rdparty/bootloader/logo.bmp" ]; then
|
||||
# cp "$RELEASE_DIR/3rdparty/bootloader/logo.bmp" "${LE_TMP}/logo.bmp"
|
||||
# mcopy -so "${LE_TMP}/logo.bmp" ::
|
||||
#fi
|
||||
|
||||
mkdir -p "${LE_TMP}/extlinux"
|
||||
|
||||
# copy device trees to part1
|
||||
#for dtb in $RELEASE_DIR/3rdparty/bootloader/*.dtb; do
|
||||
# [ -e "$dtb" ] && mcopy -o "$dtb" ::
|
||||
#done
|
||||
if [ -e "${DEVICE_DTB}.dtb" ]
|
||||
then
|
||||
mcopy -o "${DEVICE_DTB}.dtb" ::
|
||||
|
|
|
@ -2,31 +2,31 @@
|
|||
# Copyright (C) 2017-2021 Team LibreELEC (https://libreelec.tv)
|
||||
# Copyright (C) 2021-present Fewtarius
|
||||
|
||||
mkdir -p $RELEASE_DIR/3rdparty/bootloader
|
||||
if [ -n "$UBOOT_SYSTEM" ]; then
|
||||
BOOTLOADER_DIR=$(get_build_dir $BOOTLOADER)
|
||||
if [ -f $BOOTLOADER_DIR/idbloader.img ]; then
|
||||
cp -a $BOOTLOADER_DIR/idbloader.img $RELEASE_DIR/3rdparty/bootloader
|
||||
mkdir -p ${RELEASE_DIR}/3rdparty/bootloader
|
||||
if [ -n "${UBOOT_SYSTEM}" ]; then
|
||||
BOOTLOADER_DIR=$(get_build_dir ${BOOTLOADER})
|
||||
if [ -f ${BOOTLOADER_DIR}/idbloader.img ]; then
|
||||
cp -a ${BOOTLOADER_DIR}/idbloader.img ${RELEASE_DIR}/3rdparty/bootloader
|
||||
fi
|
||||
if [ -f $BOOTLOADER_DIR/uboot.img ]; then
|
||||
cp -a $BOOTLOADER_DIR/uboot.img $RELEASE_DIR/3rdparty/bootloader
|
||||
if [ -f ${BOOTLOADER_DIR}/uboot.img ]; then
|
||||
cp -a ${BOOTLOADER_DIR}/uboot.img ${RELEASE_DIR}/3rdparty/bootloader
|
||||
fi
|
||||
if [ -f $BOOTLOADER_DIR/trust.img ]; then
|
||||
cp -a $BOOTLOADER_DIR/trust.img $RELEASE_DIR/3rdparty/bootloader
|
||||
if [ -f ${BOOTLOADER_DIR}/trust.img ]; then
|
||||
cp -a ${BOOTLOADER_DIR}/trust.img ${RELEASE_DIR}/3rdparty/bootloader
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f $INSTALL/usr/share/bootloader/logo.bmp ]; then
|
||||
cp -a $INSTALL/usr/share/bootloader/logo.bmp $RELEASE_DIR/3rdparty/bootloader
|
||||
if [ -f ${INSTALL}/usr/share/bootloader/logo.bmp ]; then
|
||||
cp -a ${INSTALL}/usr/share/bootloader/logo.bmp ${RELEASE_DIR}/3rdparty/bootloader
|
||||
fi
|
||||
|
||||
if [ -f $INSTALL/usr/share/bootloader/boot.ini ]; then
|
||||
cp -a $INSTALL/usr/share/bootloader/boot.ini $RELEASE_DIR/3rdparty/bootloader
|
||||
if [ -f ${INSTALL}/usr/share/bootloader/boot.ini ]; then
|
||||
cp -a ${INSTALL}/usr/share/bootloader/boot.ini ${RELEASE_DIR}/3rdparty/bootloader
|
||||
fi
|
||||
|
||||
LINUX_DTS_DIR=$(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dts/
|
||||
for dtb in $(find $LINUX_DTS_DIR -name "*.dtb") ; do
|
||||
LINUX_DTS_DIR=$(get_build_dir linux)/arch/${TARGET_KERNEL_ARCH}/boot/dts/
|
||||
for dtb in $(find ${LINUX_DTS_DIR} -name "*.dtb") ; do
|
||||
if [ -f $dtb ]; then
|
||||
cp -a $dtb $RELEASE_DIR/3rdparty/bootloader
|
||||
cp -a $dtb ${RELEASE_DIR}/3rdparty/bootloader
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -10,132 +10,132 @@ PKG_GIT_CLONE_BRANCH="main"
|
|||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://www.kernel.org"
|
||||
PKG_DEPENDS_HOST="ccache:host openssl:host"
|
||||
PKG_DEPENDS_TARGET="toolchain linux:host cpio:host kmod:host xz:host wireless-regdb keyutils $KERNEL_EXTRA_DEPENDS_TARGET"
|
||||
PKG_DEPENDS_TARGET="toolchain linux:host cpio:host kmod:host xz:host wireless-regdb keyutils ${KERNEL_EXTRA_DEPENDS_TARGET}"
|
||||
PKG_DEPENDS_INIT="toolchain"
|
||||
PKG_NEED_UNPACK="$LINUX_DEPENDS $(get_pkg_directory busybox)"
|
||||
PKG_NEED_UNPACK="${LINUX_DEPENDS} $(get_pkg_directory busybox)"
|
||||
PKG_LONGDESC="This package builds the kernel for the RG552"
|
||||
PKG_IS_KERNEL_PKG="yes"
|
||||
PKG_STAMP="$KERNEL_TARGET $KERNEL_MAKE_EXTRACMD"
|
||||
PKG_STAMP="${KERNEL_TARGET} ${KERNEL_MAKE_EXTRACMD}"
|
||||
PKG_PATCH_DIRS+="${DEVICE}"
|
||||
GET_HANDLER_SUPPORT="git"
|
||||
|
||||
PKG_KERNEL_CFG_FILE=$(kernel_config_path) || die
|
||||
|
||||
if [ -n "$KERNEL_TOOLCHAIN" ]; then
|
||||
PKG_DEPENDS_HOST="$PKG_DEPENDS_HOST gcc-arm-$KERNEL_TOOLCHAIN:host"
|
||||
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET gcc-arm-$KERNEL_TOOLCHAIN:host"
|
||||
HEADERS_ARCH=$TARGET_ARCH
|
||||
if [ -n "${KERNEL_TOOLCHAIN}" ]; then
|
||||
PKG_DEPENDS_HOST="${PKG_DEPENDS_HOST} gcc-arm-${KERNEL_TOOLCHAIN}:host"
|
||||
PKG_DEPENDS_TARGET="${PKG_DEPENDS_TARGET} gcc-arm-${KERNEL_TOOLCHAIN}:host"
|
||||
HEADERS_ARCH=${TARGET_ARCH}
|
||||
fi
|
||||
|
||||
if [ "$PKG_BUILD_PERF" != "no" ] && grep -q ^CONFIG_PERF_EVENTS= $PKG_KERNEL_CFG_FILE ; then
|
||||
if [ "${PKG_BUILD_PERF}" != "no" ] && grep -q ^CONFIG_PERF_EVENTS= ${PKG_KERNEL_CFG_FILE} ; then
|
||||
PKG_BUILD_PERF="yes"
|
||||
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET binutils elfutils libunwind zlib openssl"
|
||||
PKG_DEPENDS_TARGET="${PKG_DEPENDS_TARGET} binutils elfutils libunwind zlib openssl"
|
||||
fi
|
||||
|
||||
if [ "$TARGET_ARCH" = "x86_64" ]; then
|
||||
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET intel-ucode:host kernel-firmware elfutils:host pciutils"
|
||||
if [ "${TARGET_ARCH}" = "x86_64" ]; then
|
||||
PKG_DEPENDS_TARGET="${PKG_DEPENDS_TARGET} intel-ucode:host kernel-firmware elfutils:host pciutils"
|
||||
fi
|
||||
|
||||
if [[ "$KERNEL_TARGET" = uImage* ]]; then
|
||||
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET u-boot-tools:host"
|
||||
if [[ "${KERNEL_TARGET}" = uImage* ]]; then
|
||||
PKG_DEPENDS_TARGET="${PKG_DEPENDS_TARGET} u-boot-tools:host"
|
||||
fi
|
||||
|
||||
post_patch() {
|
||||
cp $PKG_KERNEL_CFG_FILE $PKG_BUILD/.config
|
||||
cp ${PKG_KERNEL_CFG_FILE} ${PKG_BUILD}/.config
|
||||
|
||||
sed -i -e "s|^CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"$BUILD/image/initramfs.cpio\"|" $PKG_BUILD/.config
|
||||
sed -i -e '/^CONFIG_INITRAMFS_SOURCE=*./ a CONFIG_INITRAMFS_ROOT_UID=0\nCONFIG_INITRAMFS_ROOT_GID=0' $PKG_BUILD/.config
|
||||
sed -i -e "s|^CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"${BUILD}/image/initramfs.cpio\"|" ${PKG_BUILD}/.config
|
||||
sed -i -e '/^CONFIG_INITRAMFS_SOURCE=*./ a CONFIG_INITRAMFS_ROOT_UID=0\nCONFIG_INITRAMFS_ROOT_GID=0' ${PKG_BUILD}/.config
|
||||
|
||||
# set default hostname based on $DISTRONAME
|
||||
sed -i -e "s|@DISTRONAME@|$DISTRONAME|g" $PKG_BUILD/.config
|
||||
# set default hostname based on ${DISTRONAME}
|
||||
sed -i -e "s|@DISTRONAME@|${DISTRONAME}|g" ${PKG_BUILD}/.config
|
||||
|
||||
# disable swap support if not enabled
|
||||
if [ ! "$SWAP_SUPPORT" = yes ]; then
|
||||
sed -i -e "s|^CONFIG_SWAP=.*$|# CONFIG_SWAP is not set|" $PKG_BUILD/.config
|
||||
if [ ! "${SWAP_SUPPORT}" = yes ]; then
|
||||
sed -i -e "s|^CONFIG_SWAP=.*$|# CONFIG_SWAP is not set|" ${PKG_BUILD}/.config
|
||||
fi
|
||||
|
||||
# disable nfs support if not enabled
|
||||
if [ ! "$NFS_SUPPORT" = yes ]; then
|
||||
sed -i -e "s|^CONFIG_NFS_FS=.*$|# CONFIG_NFS_FS is not set|" $PKG_BUILD/.config
|
||||
if [ ! "${NFS_SUPPORT}" = yes ]; then
|
||||
sed -i -e "s|^CONFIG_NFS_FS=.*$|# CONFIG_NFS_FS is not set|" ${PKG_BUILD}/.config
|
||||
fi
|
||||
|
||||
# disable cifs support if not enabled
|
||||
if [ ! "$SAMBA_SUPPORT" = yes ]; then
|
||||
sed -i -e "s|^CONFIG_CIFS=.*$|# CONFIG_CIFS is not set|" $PKG_BUILD/.config
|
||||
if [ ! "${SAMBA_SUPPORT}" = yes ]; then
|
||||
sed -i -e "s|^CONFIG_CIFS=.*$|# CONFIG_CIFS is not set|" ${PKG_BUILD}/.config
|
||||
fi
|
||||
|
||||
# disable iscsi support if not enabled
|
||||
if [ ! "$ISCSI_SUPPORT" = yes ]; then
|
||||
sed -i -e "s|^CONFIG_SCSI_ISCSI_ATTRS=.*$|# CONFIG_SCSI_ISCSI_ATTRS is not set|" $PKG_BUILD/.config
|
||||
sed -i -e "s|^CONFIG_ISCSI_TCP=.*$|# CONFIG_ISCSI_TCP is not set|" $PKG_BUILD/.config
|
||||
sed -i -e "s|^CONFIG_ISCSI_BOOT_SYSFS=.*$|# CONFIG_ISCSI_BOOT_SYSFS is not set|" $PKG_BUILD/.config
|
||||
sed -i -e "s|^CONFIG_ISCSI_IBFT_FIND=.*$|# CONFIG_ISCSI_IBFT_FIND is not set|" $PKG_BUILD/.config
|
||||
sed -i -e "s|^CONFIG_ISCSI_IBFT=.*$|# CONFIG_ISCSI_IBFT is not set|" $PKG_BUILD/.config
|
||||
if [ ! "${ISCSI_SUPPORT}" = yes ]; then
|
||||
sed -i -e "s|^CONFIG_SCSI_ISCSI_ATTRS=.*$|# CONFIG_SCSI_ISCSI_ATTRS is not set|" ${PKG_BUILD}/.config
|
||||
sed -i -e "s|^CONFIG_ISCSI_TCP=.*$|# CONFIG_ISCSI_TCP is not set|" ${PKG_BUILD}/.config
|
||||
sed -i -e "s|^CONFIG_ISCSI_BOOT_SYSFS=.*$|# CONFIG_ISCSI_BOOT_SYSFS is not set|" ${PKG_BUILD}/.config
|
||||
sed -i -e "s|^CONFIG_ISCSI_IBFT_FIND=.*$|# CONFIG_ISCSI_IBFT_FIND is not set|" ${PKG_BUILD}/.config
|
||||
sed -i -e "s|^CONFIG_ISCSI_IBFT=.*$|# CONFIG_ISCSI_IBFT is not set|" ${PKG_BUILD}/.config
|
||||
fi
|
||||
|
||||
# install extra dts files
|
||||
for f in $PROJECT_DIR/$PROJECT/config/*-overlay.dts; do
|
||||
[ -f "$f" ] && cp -v $f $PKG_BUILD/arch/$TARGET_KERNEL_ARCH/boot/dts/overlays || true
|
||||
for f in ${PROJECT_DIR}/${PROJECT}/config/*-overlay.dts; do
|
||||
[ -f "${f}" ] && cp -v ${f} ${PKG_BUILD}/arch/${TARGET_KERNEL_ARCH}/boot/dts/overlays || true
|
||||
done
|
||||
if [ -n "$DEVICE" ]; then
|
||||
for f in $PROJECT_DIR/$PROJECT/devices/$DEVICE/config/*-overlay.dts; do
|
||||
[ -f "$f" ] && cp -v $f $PKG_BUILD/arch/$TARGET_KERNEL_ARCH/boot/dts/overlays || true
|
||||
if [ -n "${DEVICE}" ]; then
|
||||
for f in ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/config/*-overlay.dts; do
|
||||
[ -f "${f}" ] && cp -v ${f} ${PKG_BUILD}/arch/${TARGET_KERNEL_ARCH}/boot/dts/overlays || true
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
make_host() {
|
||||
make \
|
||||
ARCH=${HEADERS_ARCH:-$TARGET_KERNEL_ARCH} \
|
||||
HOSTCC="$TOOLCHAIN/bin/host-gcc" \
|
||||
HOSTCXX="$TOOLCHAIN/bin/host-g++" \
|
||||
HOSTCFLAGS="$HOST_CFLAGS" \
|
||||
HOSTCXXFLAGS="$HOST_CXXFLAGS" \
|
||||
HOSTLDFLAGS="$HOST_LDFLAGS" \
|
||||
ARCH=${HEADERS_ARCH:-${TARGET_KERNEL_ARCH}} \
|
||||
HOSTCC="${TOOLCHAIN}/bin/host-gcc" \
|
||||
HOSTCXX="${TOOLCHAIN}/bin/host-g++" \
|
||||
HOSTCFLAGS="${HOST_CFLAGS}" \
|
||||
HOSTCXXFLAGS="${HOST_CXXFLAGS}" \
|
||||
HOSTLDFLAGS="${HOST_LDFLAGS}" \
|
||||
headers_check
|
||||
}
|
||||
|
||||
makeinstall_host() {
|
||||
make \
|
||||
ARCH=${HEADERS_ARCH:-$TARGET_KERNEL_ARCH} \
|
||||
HOSTCC="$TOOLCHAIN/bin/host-gcc" \
|
||||
HOSTCXX="$TOOLCHAIN/bin/host-g++" \
|
||||
HOSTCFLAGS="$HOST_CFLAGS" \
|
||||
HOSTCXXFLAGS="$HOST_CXXFLAGS" \
|
||||
HOSTLDFLAGS="$HOST_LDFLAGS" \
|
||||
ARCH=${HEADERS_ARCH:-${TARGET_KERNEL_ARCH}} \
|
||||
HOSTCC="${TOOLCHAIN}/bin/host-gcc" \
|
||||
HOSTCXX="${TOOLCHAIN}/bin/host-g++" \
|
||||
HOSTCFLAGS="${HOST_CFLAGS}" \
|
||||
HOSTCXXFLAGS="${HOST_CXXFLAGS}" \
|
||||
HOSTLDFLAGS="${HOST_LDFLAGS}" \
|
||||
INSTALL_HDR_PATH=dest \
|
||||
headers_install
|
||||
mkdir -p $SYSROOT_PREFIX/usr/include
|
||||
cp -R dest/include/* $SYSROOT_PREFIX/usr/include
|
||||
mkdir -p ${SYSROOT_PREFIX}/usr/include
|
||||
cp -R dest/include/* ${SYSROOT_PREFIX}/usr/include
|
||||
}
|
||||
|
||||
pre_make_target() {
|
||||
if [ "$TARGET_ARCH" = "x86_64" ]; then
|
||||
if [ "${TARGET_ARCH}" = "x86_64" ]; then
|
||||
# copy some extra firmware to linux tree
|
||||
mkdir -p $PKG_BUILD/external-firmware
|
||||
cp -a $(get_build_dir kernel-firmware)/{amdgpu,amd-ucode,i915,radeon,e100,rtl_nic} $PKG_BUILD/external-firmware
|
||||
mkdir -p ${PKG_BUILD}/external-firmware
|
||||
cp -a $(get_build_dir kernel-firmware)/{amdgpu,amd-ucode,i915,radeon,e100,rtl_nic} ${PKG_BUILD}/external-firmware
|
||||
|
||||
cp -a $(get_build_dir intel-ucode)/intel-ucode $PKG_BUILD/external-firmware
|
||||
cp -a $(get_build_dir intel-ucode)/intel-ucode ${PKG_BUILD}/external-firmware
|
||||
|
||||
FW_LIST="$(find $PKG_BUILD/external-firmware \( -type f -o -type l \) \( -iname '*.bin' -o -iname '*.fw' -o -path '*/intel-ucode/*' \) | sed 's|.*external-firmware/||' | sort | xargs)"
|
||||
sed -i "s|CONFIG_EXTRA_FIRMWARE=.*|CONFIG_EXTRA_FIRMWARE=\"${FW_LIST}\"|" $PKG_BUILD/.config
|
||||
FW_LIST="$(find ${PKG_BUILD}/external-firmware \( -type f -o -type l \) \( -iname '*.bin' -o -iname '*.fw' -o -path '*/intel-ucode/*' \) | sed 's|.*external-firmware/||' | sort | xargs)"
|
||||
sed -i "s|CONFIG_EXTRA_FIRMWARE=.*|CONFIG_EXTRA_FIRMWARE=\"${FW_LIST}\"|" ${PKG_BUILD}/.config
|
||||
fi
|
||||
|
||||
kernel_make oldconfig
|
||||
|
||||
# regdb (backward compatability with pre-4.15 kernels)
|
||||
if grep -q ^CONFIG_CFG80211_INTERNAL_REGDB= $PKG_BUILD/.config ; then
|
||||
cp $(get_build_dir wireless-regdb)/db.txt $PKG_BUILD/net/wireless/db.txt
|
||||
if grep -q ^CONFIG_CFG80211_INTERNAL_REGDB= ${PKG_BUILD}/.config ; then
|
||||
cp $(get_build_dir wireless-regdb)/db.txt ${PKG_BUILD}/net/wireless/db.txt
|
||||
fi
|
||||
}
|
||||
|
||||
make_target() {
|
||||
|
||||
if [ "$PKG_BUILD_PERF" = "yes" ] ; then
|
||||
if [ "${PKG_BUILD_PERF}" = "yes" ] ; then
|
||||
( cd tools/perf
|
||||
|
||||
# arch specific perf build args
|
||||
case "$TARGET_ARCH" in
|
||||
case "${TARGET_ARCH}" in
|
||||
x86_64)
|
||||
PERF_BUILD_ARGS="ARCH=x86"
|
||||
;;
|
||||
|
@ -143,7 +143,7 @@ make_target() {
|
|||
PERF_BUILD_ARGS="ARCH=arm64"
|
||||
;;
|
||||
*)
|
||||
PERF_BUILD_ARGS="ARCH=$TARGET_ARCH"
|
||||
PERF_BUILD_ARGS="ARCH=${TARGET_ARCH}"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -156,90 +156,95 @@ make_target() {
|
|||
NO_LIBAUDIT=1 \
|
||||
NO_LZMA=1 \
|
||||
NO_SDT=1 \
|
||||
CROSS_COMPILE="$TARGET_PREFIX" \
|
||||
JOBS="$CONCURRENCY_MAKE_LEVEL" \
|
||||
make $PERF_BUILD_ARGS
|
||||
mkdir -p $INSTALL/usr/bin
|
||||
cp perf $INSTALL/usr/bin
|
||||
CROSS_COMPILE="${TARGET_PREFIX}" \
|
||||
JOBS="${CONCURRENCY_MAKE_LEVEL}" \
|
||||
make ${PERF_BUILD_ARGS}
|
||||
mkdir -p ${INSTALL}/usr/bin
|
||||
cp perf ${INSTALL}/usr/bin
|
||||
)
|
||||
fi
|
||||
|
||||
( cd $ROOT
|
||||
rm -rf $BUILD/initramfs
|
||||
$SCRIPTS/install initramfs
|
||||
( cd ${ROOT}
|
||||
rm -rf ${BUILD}/initramfs
|
||||
${SCRIPTS}/install initramfs
|
||||
)
|
||||
pkg_lock_status "ACTIVE" "linux:target" "build"
|
||||
|
||||
# arm64 target does not support creating uImage.
|
||||
# Build Image first, then wrap it using u-boot's mkimage.
|
||||
if [[ "$TARGET_KERNEL_ARCH" == "arm64" && "$KERNEL_TARGET" == uImage* ]]; then
|
||||
if [ -z "$KERNEL_UIMAGE_LOADADDR" -o -z "$KERNEL_UIMAGE_ENTRYADDR" ]; then
|
||||
if [[ "${TARGET_KERNEL_ARCH}" == "arm64" && "${KERNEL_TARGET}" == uImage* ]]; then
|
||||
if [ -z "${KERNEL_UIMAGE_LOADADDR}" -o -z "${KERNEL_UIMAGE_ENTRYADDR}" ]; then
|
||||
die "ERROR: KERNEL_UIMAGE_LOADADDR and KERNEL_UIMAGE_ENTRYADDR have to be set to build uImage - aborting"
|
||||
fi
|
||||
KERNEL_UIMAGE_TARGET="$KERNEL_TARGET"
|
||||
KERNEL_UIMAGE_TARGET="${KERNEL_TARGET}"
|
||||
KERNEL_TARGET="${KERNEL_TARGET/uImage/Image}"
|
||||
fi
|
||||
|
||||
if [ -d "${INSTALL}/$(get_kernel_overlay_dir)" ]
|
||||
then
|
||||
rm -rf ${INSTALL}/$(get_kernel_overlay_dir)
|
||||
fi
|
||||
|
||||
# the modules target is required to get a proper Module.symvers
|
||||
# file with symbols from built-in and external modules.
|
||||
# Without that it'll contain only the symbols from the kernel
|
||||
kernel_make $KERNEL_TARGET $KERNEL_MAKE_EXTRACMD modules
|
||||
kernel_make INSTALL_MOD_PATH=$INSTALL/$(get_kernel_overlay_dir) modules_install
|
||||
rm -f $INSTALL/$(get_kernel_overlay_dir)/lib/modules/*/build
|
||||
rm -f $INSTALL/$(get_kernel_overlay_dir)/lib/modules/*/source
|
||||
kernel_make ${KERNEL_TARGET} ${KERNEL_MAKE_EXTRACMD} modules
|
||||
kernel_make INSTALL_MOD_PATH=${INSTALL}/$(get_kernel_overlay_dir) modules_install
|
||||
rm -f ${INSTALL}/$(get_kernel_overlay_dir)/lib/modules/*/build
|
||||
rm -f ${INSTALL}/$(get_kernel_overlay_dir)/lib/modules/*/source
|
||||
|
||||
if [ -n "$KERNEL_UIMAGE_TARGET" ] ; then
|
||||
if [ -n "${KERNEL_UIMAGE_TARGET}" ] ; then
|
||||
|
||||
# determine compression used for kernel image
|
||||
KERNEL_UIMAGE_COMP=${KERNEL_UIMAGE_TARGET:7}
|
||||
KERNEL_UIMAGE_COMP=${KERNEL_UIMAGE_COMP:-none}
|
||||
|
||||
# calculate new load address to make kernel Image unpack to memory area after compressed image
|
||||
if [ "$KERNEL_UIMAGE_COMP" != "none" ] ; then
|
||||
COMPRESSED_SIZE=$(stat -t "arch/$TARGET_KERNEL_ARCH/boot/$KERNEL_TARGET" | awk '{print $2}')
|
||||
if [ "${KERNEL_UIMAGE_COMP}" != "none" ] ; then
|
||||
COMPRESSED_SIZE=$(stat -t "arch/${TARGET_KERNEL_ARCH}/boot/${KERNEL_TARGET}" | awk '{print $2}')
|
||||
# align to 1 MiB
|
||||
COMPRESSED_SIZE=$(( (($COMPRESSED_SIZE - 1 >> 20) + 1) << 20 ))
|
||||
PKG_KERNEL_UIMAGE_LOADADDR=$(printf '%X' "$(( $KERNEL_UIMAGE_LOADADDR + $COMPRESSED_SIZE ))")
|
||||
PKG_KERNEL_UIMAGE_ENTRYADDR=$(printf '%X' "$(( $KERNEL_UIMAGE_ENTRYADDR + $COMPRESSED_SIZE ))")
|
||||
COMPRESSED_SIZE=$(( ((${COMPRESSED_SIZE} - 1 >> 20) + 1) << 20 ))
|
||||
PKG_KERNEL_UIMAGE_LOADADDR=$(printf '%X' "$(( ${KERNEL_UIMAGE_LOADADDR} + ${COMPRESSED_SIZE} ))")
|
||||
PKG_KERNEL_UIMAGE_ENTRYADDR=$(printf '%X' "$(( ${KERNEL_UIMAGE_ENTRYADDR} + ${COMPRESSED_SIZE} ))")
|
||||
else
|
||||
PKG_KERNEL_UIMAGE_LOADADDR=${KERNEL_UIMAGE_LOADADDR}
|
||||
PKG_KERNEL_UIMAGE_ENTRYADDR=${KERNEL_UIMAGE_ENTRYADDR}
|
||||
fi
|
||||
|
||||
mkimage -A $TARGET_KERNEL_ARCH \
|
||||
mkimage -A ${TARGET_KERNEL_ARCH} \
|
||||
-O linux \
|
||||
-T kernel \
|
||||
-C $KERNEL_UIMAGE_COMP \
|
||||
-a $PKG_KERNEL_UIMAGE_LOADADDR \
|
||||
-e $PKG_KERNEL_UIMAGE_ENTRYADDR \
|
||||
-d arch/$TARGET_KERNEL_ARCH/boot/$KERNEL_TARGET \
|
||||
arch/$TARGET_KERNEL_ARCH/boot/$KERNEL_UIMAGE_TARGET
|
||||
-C ${KERNEL_UIMAGE_COMP} \
|
||||
-a ${PKG_KERNEL_UIMAGE_LOADADDR} \
|
||||
-e ${PKG_KERNEL_UIMAGE_ENTRYADDR} \
|
||||
-d arch/${TARGET_KERNEL_ARCH}/boot/${KERNEL_TARGET} \
|
||||
arch/${TARGET_KERNEL_ARCH}/boot/${KERNEL_UIMAGE_TARGET}
|
||||
|
||||
KERNEL_TARGET="${KERNEL_UIMAGE_TARGET}"
|
||||
fi
|
||||
}
|
||||
|
||||
makeinstall_target() {
|
||||
if [ "$BOOTLOADER" = "u-boot" ]; then
|
||||
mkdir -p $INSTALL/usr/share/bootloader
|
||||
for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb arch/$TARGET_KERNEL_ARCH/boot/dts/*/*.dtb; do
|
||||
if [ -f $dtb ]; then
|
||||
cp -v $dtb $INSTALL/usr/share/bootloader
|
||||
if [ "${BOOTLOADER}" = "u-boot" ]; then
|
||||
mkdir -p ${INSTALL}/usr/share/bootloader
|
||||
for dtb in arch/${TARGET_KERNEL_ARCH}/boot/dts/*.dtb arch/${TARGET_KERNEL_ARCH}/boot/dts/*/*.dtb; do
|
||||
if [ -f ${dtb} ]; then
|
||||
cp -v ${dtb} ${INSTALL}/usr/share/bootloader
|
||||
fi
|
||||
done
|
||||
elif [ "$BOOTLOADER" = "bcm2835-bootloader" ]; then
|
||||
mkdir -p $INSTALL/usr/share/bootloader/overlays
|
||||
elif [ "${BOOTLOADER}" = "bcm2835-bootloader" ]; then
|
||||
mkdir -p ${INSTALL}/usr/share/bootloader/overlays
|
||||
|
||||
# install platform dtbs, but remove upstream kernel dtbs (i.e. without downstream
|
||||
# drivers and decent USB support) as these are not required by LibreELEC
|
||||
cp -p arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb $INSTALL/usr/share/bootloader
|
||||
rm -f $INSTALL/usr/share/bootloader/bcm283*.dtb
|
||||
cp -p arch/${TARGET_KERNEL_ARCH}/boot/dts/*.dtb ${INSTALL}/usr/share/bootloader
|
||||
rm -f ${INSTALL}/usr/share/bootloader/bcm283*.dtb
|
||||
|
||||
# install overlay dtbs
|
||||
for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/overlays/*.dtbo; do
|
||||
cp $dtb $INSTALL/usr/share/bootloader/overlays 2>/dev/null || :
|
||||
for dtb in arch/${TARGET_KERNEL_ARCH}/boot/dts/overlays/*.dtbo; do
|
||||
cp ${dtb} ${INSTALL}/usr/share/bootloader/overlays 2>/dev/null || :
|
||||
done
|
||||
cp -p arch/$TARGET_KERNEL_ARCH/boot/dts/overlays/README $INSTALL/usr/share/bootloader/overlays
|
||||
cp -p arch/${TARGET_KERNEL_ARCH}/boot/dts/overlays/README ${INSTALL}/usr/share/bootloader/overlays
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -248,34 +253,34 @@ make_init() {
|
|||
}
|
||||
|
||||
makeinstall_init() {
|
||||
if [ -n "$INITRAMFS_MODULES" ]; then
|
||||
mkdir -p $INSTALL/etc
|
||||
mkdir -p $INSTALL/usr/lib/modules
|
||||
if [ -n "${INITRAMFS_MODULES}" ]; then
|
||||
mkdir -p ${INSTALL}/etc
|
||||
mkdir -p ${INSTALL}/usr/lib/modules
|
||||
|
||||
for i in $INITRAMFS_MODULES; do
|
||||
module=`find .install_pkg/$(get_full_module_dir)/kernel -name $i.ko`
|
||||
if [ -n "$module" ]; then
|
||||
echo $i >> $INSTALL/etc/modules
|
||||
cp $module $INSTALL/usr/lib/modules/`basename $module`
|
||||
for i in ${INITRAMFS_MODULES}; do
|
||||
module=`find .install_pkg/$(get_full_module_dir)/kernel -name ${i}.ko`
|
||||
if [ -n "${module}" ]; then
|
||||
echo ${i} >> ${INSTALL}/etc/modules
|
||||
cp ${module} ${INSTALL}/usr/lib/modules/`basename ${module}`
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$UVESAFB_SUPPORT" = yes ]; then
|
||||
mkdir -p $INSTALL/usr/lib/modules
|
||||
if [ "${UVESAFB_SUPPORT}" = yes ]; then
|
||||
mkdir -p ${INSTALL}/usr/lib/modules
|
||||
uvesafb=`find .install_pkg/$(get_full_module_dir)/kernel -name uvesafb.ko`
|
||||
cp $uvesafb $INSTALL/usr/lib/modules/`basename $uvesafb`
|
||||
cp ${uvesafb} ${INSTALL}/usr/lib/modules/`basename ${uvesafb}`
|
||||
fi
|
||||
}
|
||||
|
||||
post_install() {
|
||||
if [ ! -d $INSTALL/$(get_full_firmware_dir) ]
|
||||
if [ ! -d ${INSTALL}/$(get_full_firmware_dir) ]
|
||||
then
|
||||
mkdir -p $INSTALL/$(get_full_firmware_dir)/
|
||||
mkdir -p ${INSTALL}/$(get_full_firmware_dir)/
|
||||
fi
|
||||
|
||||
# regdb and signature is now loaded as firmware by 4.15+
|
||||
if grep -q ^CONFIG_CFG80211_REQUIRE_SIGNED_REGDB= $PKG_BUILD/.config; then
|
||||
cp $(get_build_dir wireless-regdb)/regulatory.db{,.p7s} $INSTALL/$(get_full_firmware_dir)
|
||||
if grep -q ^CONFIG_CFG80211_REQUIRE_SIGNED_REGDB= ${PKG_BUILD}/.config; then
|
||||
cp $(get_build_dir wireless-regdb)/regulatory.db{,.p7s} ${INSTALL}/$(get_full_firmware_dir)
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue