121 lines
3.7 KiB
Bash
Executable file
121 lines
3.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
|
|
# Copyright (C) 2016-2018 Team LibreELEC (https://libreelec.tv)
|
|
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)
|
|
|
|
unset _CACHE_PACKAGE_LOCAL _CACHE_PACKAGE_GLOBAL _DEBUG_DEPENDS_LIST _DEBUG_PACKAGE_LIST
|
|
|
|
. config/options ""
|
|
. config/multithread
|
|
. config/show_config
|
|
|
|
show_config
|
|
|
|
${SCRIPTS}/checkdeps
|
|
|
|
# Setup both toolchain cmake configs to avoid potentially racy behaviour later.
|
|
# Use a fork for host to isolate any variable modifications.
|
|
( setup_toolchain host )
|
|
setup_toolchain target
|
|
|
|
function do_mkimage() {
|
|
# Variables used in mkimage script must be passed
|
|
env \
|
|
ROOT="${ROOT}" \
|
|
SCRIPTS="${SCRIPTS}" \
|
|
TOOLCHAIN="${TOOLCHAIN}" \
|
|
PROJECT_DIR="${PROJECT_DIR}" \
|
|
PROJECT="${PROJECT}" \
|
|
DEVICE="${DEVICE}" \
|
|
DISTRO="${DISTRO}" \
|
|
TARGET_IMG="${TARGET_IMG}" \
|
|
BUILD_NAME="${IMAGE_NAME}" \
|
|
IMAGE_NAME="${1:-${IMAGE_NAME}}" \
|
|
BOOTLOADER="${BOOTLOADER}" \
|
|
KERNEL_NAME="${KERNEL_NAME}" \
|
|
TARGET_KERNEL_ARCH="${TARGET_KERNEL_ARCH}" \
|
|
RELEASE_DIR="${RELEASE_DIR}" \
|
|
UUID_SYSTEM="${UUID_SYSTEM}" \
|
|
UUID_STORAGE="${UUID_STORAGE}" \
|
|
DISTRO_BOOTLABEL="${DISTRO_BOOTLABEL}" \
|
|
DISTRO_DISKLABEL="${DISTRO_DISKLABEL}" \
|
|
UBOOT_SYSTEM="${UBOOT_SYSTEM}" \
|
|
UBOOT_VERSION="${UBOOT_VERSION}" \
|
|
EXTRA_CMDLINE="${EXTRA_CMDLINE}" \
|
|
SYSTEM_SIZE="${SYSTEM_SIZE}" \
|
|
SYSTEM_PART_START="${SYSTEM_PART_START}" \
|
|
OVA_SIZE="${OVA_SIZE}" \
|
|
SUBDEVICE="${SUBDEVICE}" \
|
|
${SCRIPTS}/mkimage
|
|
}
|
|
|
|
if [ -n "${CUSTOM_GIT_HASH}" ]; then
|
|
GIT_HASH="${CUSTOM_GIT_HASH}"
|
|
else
|
|
GIT_HASH=$(git rev-parse HEAD)
|
|
fi
|
|
|
|
if [ "${OS_VERSION}" = "devel" ]; then
|
|
GIT_ABBREV=${GIT_HASH:0:7}
|
|
DEVEL_VERSION=${OS_VERSION}
|
|
case "${BUILD_PERIODIC}" in
|
|
nightly) OS_VERSION=nightly-$(date +%Y%m%d)-${GIT_ABBREV};;
|
|
daily) OS_VERSION=daily-$(date +%Y%j)-${GIT_ABBREV};;
|
|
weekly) OS_VERSION=weekly-$(date +%G%V)-${GIT_ABBREV};;
|
|
monthly) OS_VERSION=monthly-$(date +%Y%m)-${GIT_ABBREV};;
|
|
*) OS_VERSION=devel-$(date +%s);;
|
|
esac
|
|
fi
|
|
|
|
# Get origin url, fix git:// and git@github.com: urls if necessary
|
|
ORIGIN_URL="$(git remote -v | awk '$1 == "origin" { print $2 }' | head -1 | sed 's#\.git$##;s#^git:#https:#;s#^git@github\.com:#https://github.com/#')"
|
|
|
|
if [ -n "${CUSTOM_VERSION}" ]; then
|
|
export OS_VERSION="${CUSTOM_VERSION}"
|
|
fi
|
|
|
|
LIBREELEC_ARCH="${DEVICE:-${PROJECT}}.${TARGET_ARCH}"
|
|
TARGET_VERSION="${LIBREELEC_ARCH}-${OS_VERSION}"
|
|
|
|
if [ -n "${CUSTOM_IMAGE_NAME}" ]; then
|
|
IMAGE_NAME="${CUSTOM_IMAGE_NAME}"
|
|
else
|
|
if [ "${DEVEL_VERSION}" = "devel" ]; then
|
|
IMAGE_NAME="${DISTRONAME}-${LIBREELEC_ARCH}-${OS_VERSION}-${OS_VERSION}"
|
|
else
|
|
IMAGE_NAME="${DISTRONAME}-${TARGET_VERSION}"
|
|
fi
|
|
|
|
if [ -n "${UBOOT_SYSTEM}" ] && [ "${UBOOT_SYSTEM}" != "${DEVICE:-${PROJECT}}" ]; then
|
|
IMAGE_NAME="${IMAGE_NAME}"
|
|
fi
|
|
fi
|
|
|
|
if [ -n "${IMAGE_SUFFIX}" ]; then
|
|
IMAGE_NAME="${IMAGE_NAME}-${IMAGE_SUFFIX}"
|
|
fi
|
|
|
|
echo "${IMAGE_NAME}" > ${BUILD}/BUILD_FILENAME
|
|
|
|
# Setup fakeroot
|
|
rm -rf ${FAKEROOT_SCRIPT} # remove ${FAKEROOT_SCRIPT} if it exist
|
|
touch ${FAKEROOT_SCRIPT} # create an empty ${FAKEROOT_SCRIPT}
|
|
chmod +x ${FAKEROOT_SCRIPT} # make ${FAKEROOT_SCRIPT} executable
|
|
echo "chown -R 0:0 ${INSTALL}" >> ${FAKEROOT_SCRIPT}
|
|
|
|
# Clean old install dirs
|
|
rm -rf ${INSTALL}
|
|
rm -rf ${STAMPS_INSTALL}
|
|
mkdir -p ${INSTALL}
|
|
|
|
# Create base layout of LibreELEC read-only file system
|
|
for directory in etc dev proc run sys tmp usr var flash storage; do
|
|
mkdir -p ${INSTALL}/${directory}
|
|
done
|
|
|
|
MTADDONBUILD=no start_multithread_build arm32 || die "Parallel build failure - see log for details. Time of failure: $(date)"
|
|
echo "Successful build! Building compatibility root..." >&2
|
|
exit 0
|
|
|