mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
u-boot: allow using UBOOT_SYSTEM
This commit is contained in:
parent
4bde836fa1
commit
5da14cfce5
@ -185,12 +185,6 @@ pre_make_target() {
|
||||
|
||||
# regdb
|
||||
cp $(get_build_dir wireless-regdb)/db.txt $PKG_BUILD/net/wireless/db.txt
|
||||
|
||||
if [ "$BOOTLOADER" = "u-boot" ]; then
|
||||
( cd $ROOT
|
||||
$SCRIPTS/build u-boot
|
||||
)
|
||||
fi
|
||||
}
|
||||
|
||||
make_target() {
|
||||
@ -222,8 +216,10 @@ make_target() {
|
||||
makeinstall_target() {
|
||||
if [ "$BOOTLOADER" = "u-boot" ]; then
|
||||
mkdir -p $INSTALL/usr/share/bootloader
|
||||
for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb; do
|
||||
cp $dtb $INSTALL/usr/share/bootloader 2>/dev/null || :
|
||||
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
|
||||
if [ -d arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic -a -f "arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/$KERNEL_UBOOT_EXTRA_TARGET" ]; then
|
||||
cp "arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/$KERNEL_UBOOT_EXTRA_TARGET" $INSTALL/usr/share/bootloader/dtb.img 2>/dev/null || :
|
||||
|
@ -18,105 +18,47 @@
|
||||
################################################################################
|
||||
|
||||
PKG_NAME="u-boot"
|
||||
PKG_DEPENDS_TARGET="toolchain"
|
||||
if [ "$UBOOT_VERSION" = "imx6-cuboxi" ]; then
|
||||
PKG_COMMIT="ad02f49"
|
||||
PKG_VERSION="imx6-$PKG_COMMIT"
|
||||
PKG_SHA256="bee9c8f4d21230a53605ed0df2ee79a9d2a18a49870d235ec0993a26a37ba0fd"
|
||||
PKG_SITE="http://solid-run.com/wiki/doku.php?id=products:imx6:software:development:u-boot"
|
||||
PKG_URL="https://github.com/SolidRun/u-boot-imx6/archive/$PKG_COMMIT.tar.gz"
|
||||
PKG_SOURCE_NAME="$PKG_NAME-sr-$PKG_VERSION.tar.gz"
|
||||
PKG_SOURCE_DIR="$PKG_NAME-imx6-${PKG_COMMIT}*"
|
||||
[ -n "$UBOOT_CONFIG_V2" ] && PKG_DEPENDS_TARGET="toolchain u-boot-v2"
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
PKG_VERSION="2017.09"
|
||||
PKG_SHA256="b2d15f2cf5f72e706025cde73d67247c6da8cd35f7e10891eefe7d9095089744"
|
||||
PKG_ARCH="arm aarch64"
|
||||
PKG_SITE="https://www.denx.de/wiki/U-Boot"
|
||||
PKG_URL="ftp://ftp.denx.de/pub/u-boot/u-boot-$PKG_VERSION.tar.bz2"
|
||||
PKG_SOURCE_DIR="u-boot-$PKG_VERSION"
|
||||
PKG_DEPENDS_TARGET="toolchain dtc:host"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SECTION="tools"
|
||||
PKG_SHORTDESC="u-boot: Universal Bootloader project"
|
||||
PKG_LONGDESC="Das U-Boot is a cross-platform bootloader for embedded systems, used as the default boot loader by several board vendors. It is intended to be easy to port and to debug, and runs on many supported architectures, including PPC, ARM, MIPS, x86, m68k, NIOS, and Microblaze."
|
||||
PKG_AUTORECONF="no"
|
||||
|
||||
pre_configure_target() {
|
||||
if [ -z "$UBOOT_CONFIG" ]; then
|
||||
echo "$TARGET_PLATFORM does not define any u-boot configuration, aborting."
|
||||
echo "Please add UBOOT_CONFIG to your project options file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$UBOOT_CONFIGFILE" ]; then
|
||||
UBOOT_CONFIGFILE="boot.scr"
|
||||
fi
|
||||
|
||||
unset LDFLAGS
|
||||
|
||||
# dont build in parallel because of problems
|
||||
MAKEFLAGS=-j1
|
||||
|
||||
# copy compiler-gcc5.h to compiler-gcc6. for fake building
|
||||
cp include/linux/compiler-gcc5.h include/linux/compiler-gcc6.h
|
||||
}
|
||||
PKG_IS_KERNEL_PKG="yes"
|
||||
|
||||
make_target() {
|
||||
# get number of targets to build
|
||||
UBOOT_TARGET_CNT=0
|
||||
for UBOOT_TARGET in $UBOOT_CONFIG; do
|
||||
UBOOT_TARGET_CNT=$((UBOOT_TARGET_CNT + 1))
|
||||
done
|
||||
|
||||
for UBOOT_TARGET in $UBOOT_CONFIG; do
|
||||
make CROSS_COMPILE="$TARGET_PREFIX" ARCH=arm mrproper
|
||||
make CROSS_COMPILE="$TARGET_PREFIX" ARCH=arm $UBOOT_TARGET
|
||||
make CROSS_COMPILE="$TARGET_PREFIX" ARCH=arm HOSTCC="$HOST_CC" HOSTSTRIP="true"
|
||||
|
||||
# rename files in case of multiple targets
|
||||
if [ $UBOOT_TARGET_CNT -gt 1 ]; then
|
||||
if [ "$UBOOT_TARGET" = "mx6_cubox-i_config" ]; then
|
||||
TARGET_NAME="cuboxi"
|
||||
elif [ "$UBOOT_TARGET" = "matrix" ]; then
|
||||
TARGET_NAME="matrix"
|
||||
elif [ "$UBOOT_TARGET" = "udoo_config" ]; then
|
||||
TARGET_NAME="udoo"
|
||||
else
|
||||
TARGET_NAME="undef"
|
||||
fi
|
||||
|
||||
[ -f u-boot.img ] && mv u-boot.img u-boot-$TARGET_NAME.img || :
|
||||
[ -f u-boot.imx ] && mv u-boot.imx u-boot-$TARGET_NAME.imx || :
|
||||
[ -f SPL ] && mv SPL SPL-$TARGET_NAME || :
|
||||
fi
|
||||
done
|
||||
if [ -z "$UBOOT_SYSTEM" ]; then
|
||||
echo "UBOOT_SYSTEM must be set to build an image"
|
||||
echo "see './scripts/uboot_helper' for more information"
|
||||
else
|
||||
CROSS_COMPILE="$TARGET_PREFIX" LDFLAGS="" ARCH=arm make mrproper
|
||||
CROSS_COMPILE="$TARGET_PREFIX" LDFLAGS="" ARCH=arm make $($ROOT/$SCRIPTS/uboot_helper $PROJECT $DEVICE $UBOOT_SYSTEM config)
|
||||
CROSS_COMPILE="$TARGET_PREFIX" LDFLAGS="" ARCH=arm make HOSTCC="$HOST_CC" HOSTSTRIP="true"
|
||||
fi
|
||||
}
|
||||
|
||||
makeinstall_target() {
|
||||
mkdir -p $TOOLCHAIN/bin
|
||||
if [ -f build/tools/mkimage ]; then
|
||||
cp build/tools/mkimage $TOOLCHAIN/bin
|
||||
else
|
||||
cp tools/mkimage $TOOLCHAIN/bin
|
||||
fi
|
||||
|
||||
BOOT_CFG="$PROJECT_DIR/$PROJECT/bootloader/boot.cfg"
|
||||
if [ -r "$BOOT_CFG" ]; then
|
||||
cp $BOOT_CFG boot.cfg
|
||||
mkimage -A "$TARGET_ARCH" \
|
||||
-O u-boot \
|
||||
-T script \
|
||||
-C none \
|
||||
-n "$DISTRONAME Boot" \
|
||||
-d boot.cfg \
|
||||
$UBOOT_CONFIGFILE
|
||||
fi
|
||||
|
||||
mkdir -p $INSTALL/usr/share/bootloader
|
||||
|
||||
cp $PKG_BUILD/u-boot*.imx $INSTALL/usr/share/bootloader 2>/dev/null || :
|
||||
cp $PKG_BUILD/u-boot*.img $INSTALL/usr/share/bootloader 2>/dev/null || :
|
||||
cp $PKG_BUILD/SPL* $INSTALL/usr/share/bootloader 2>/dev/null || :
|
||||
|
||||
cp $PKG_BUILD/$UBOOT_CONFIGFILE $INSTALL/usr/share/bootloader 2>/dev/null || :
|
||||
|
||||
cp -PR $PROJECT_DIR/$PROJECT/bootloader/uEnv*.txt $INSTALL/usr/share/bootloader 2>/dev/null || :
|
||||
# Only install u-boot.img et al when building a board specific image
|
||||
if [ -n "$UBOOT_SYSTEM" ]; then
|
||||
if [ -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/install ]; then
|
||||
. $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/install
|
||||
elif [ -f $PROJECT_DIR/$PROJECT/bootloader/install ]; then
|
||||
. $PROJECT_DIR/$PROJECT/bootloader/install
|
||||
fi
|
||||
fi
|
||||
|
||||
# Always install the update script
|
||||
if [ -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/update.sh ]; then
|
||||
cp -av $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/update.sh $INSTALL/usr/share/bootloader
|
||||
elif [ -f $PROJECT_DIR/$PROJECT/bootloader/update.sh ]; then
|
||||
cp -av $PROJECT_DIR/$PROJECT/bootloader/update.sh $INSTALL/usr/share/bootloader
|
||||
fi
|
||||
}
|
||||
|
38
packages/tools/u-boot/patches/2017.09/u-boot-0001-dont-build-libfdt.patch
vendored
Normal file
38
packages/tools/u-boot/patches/2017.09/u-boot-0001-dont-build-libfdt.patch
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
diff -Naur a/Makefile b/Makefile
|
||||
--- a/Makefile 2017-09-11 11:10:40.000000000 -0700
|
||||
+++ b/Makefile 2017-10-03 13:41:57.992106628 -0700
|
||||
@@ -1379,7 +1379,7 @@
|
||||
$(call filechk,timestamp.h)
|
||||
|
||||
checkbinman: tools
|
||||
- @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \
|
||||
+ @if ! ( echo 'from pylibfdt import libfdt' | ( python )); then \
|
||||
echo >&2; \
|
||||
echo >&2 '*** binman needs the Python libfdt library.'; \
|
||||
echo >&2 '*** Either install it on your system, or try:'; \
|
||||
diff -Naur a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
|
||||
--- a/tools/dtoc/fdt.py 2017-09-11 11:10:40.000000000 -0700
|
||||
+++ b/tools/dtoc/fdt.py 2017-10-03 13:42:18.398306028 -0700
|
||||
@@ -10,7 +10,7 @@
|
||||
import sys
|
||||
|
||||
import fdt_util
|
||||
-import libfdt
|
||||
+from pylibfdt import libfdt
|
||||
|
||||
# This deals with a device tree, presenting it as an assortment of Node and
|
||||
# Prop objects, representing nodes and properties, respectively. This file
|
||||
diff -Naur a/tools/Makefile b/tools/Makefile
|
||||
--- a/tools/Makefile 2017-09-11 11:10:40.000000000 -0700
|
||||
+++ b/tools/Makefile 2017-10-03 13:42:33.286451519 -0700
|
||||
@@ -232,10 +232,6 @@
|
||||
|
||||
always := $(hostprogs-y)
|
||||
|
||||
-# Build a libfdt Python module if swig is available
|
||||
-# Use 'sudo apt-get install swig libpython-dev' to enable this
|
||||
-always += $(if $(shell which swig 2> /dev/null),_libfdt.so)
|
||||
-
|
||||
# Generated LCD/video logo
|
||||
LOGO_H = $(objtree)/include/bmp_logo.h
|
||||
LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h
|
@ -1,38 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# OpenELEC is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OpenELEC is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
. config/options $1
|
||||
|
||||
if [ -z "$UBOOT_CONFIGFILE" ]; then
|
||||
UBOOT_CONFIGFILE="boot.scr"
|
||||
fi
|
||||
|
||||
mkdir -p $RELEASE_DIR/3rdparty/bootloader
|
||||
if [ -e $BUILD/u-boot-*/$UBOOT_CONFIGFILE ]; then
|
||||
cp -PR $BUILD/u-boot-*/$UBOOT_CONFIGFILE $RELEASE_DIR/3rdparty/bootloader
|
||||
fi
|
||||
|
||||
cp -PR $BUILD/u-boot-*/SPL* $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || :
|
||||
cp -PR $BUILD/u-boot-*/u-boot*.imx $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || :
|
||||
cp -PR $BUILD/u-boot-*/u-boot*.img $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || :
|
||||
|
||||
cp -PR $PROJECT_DIR/$PROJECT/bootloader/uEnv*.txt $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || :
|
||||
|
||||
cp -PR $BUILD/linux-*/arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb $RELEASE_DIR/3rdparty/bootloader 2>/dev/null || :
|
@ -1,98 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# OpenELEC is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OpenELEC is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
[ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT=""
|
||||
[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash"
|
||||
[ -z "$BOOT_PART" ] && BOOT_PART=$(df "$BOOT_ROOT" | tail -1 | awk {' print $1 '})
|
||||
if [ -z "$BOOT_DISK" ]; then
|
||||
case $BOOT_PART in
|
||||
/dev/sd[a-z][0-9]*)
|
||||
BOOT_DISK=$(echo $BOOT_PART | sed -e "s,[0-9]*,,g")
|
||||
;;
|
||||
/dev/mmcblk*)
|
||||
BOOT_DISK=$(echo $BOOT_PART | sed -e "s,p[0-9]*,,g")
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
SYSTEM_TYPE=""
|
||||
if [ -f $SYSTEM_ROOT/usr/lib/libreelec/imx6-system-type ]; then
|
||||
. $SYSTEM_ROOT/usr/lib/libreelec/imx6-system-type
|
||||
fi
|
||||
|
||||
# mount $BOOT_ROOT r/w
|
||||
mount -o remount,rw $BOOT_ROOT
|
||||
|
||||
# update Device Tree Blobs
|
||||
for all_dtb in /flash/*.dtb; do
|
||||
dtb=$(basename $all_dtb)
|
||||
if [ -f $SYSTEM_ROOT/usr/share/bootloader/$dtb ]; then
|
||||
echo "*** updating Device Tree Blob: $dtb ..."
|
||||
cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT
|
||||
fi
|
||||
done
|
||||
|
||||
# update bootloader files
|
||||
if [ "$SYSTEM_TYPE" = "matrix" ]; then
|
||||
if [ -f $SYSTEM_ROOT/usr/share/bootloader/u-boot-$SYSTEM_TYPE.imx ]; then
|
||||
echo "*** updating u-boot image in eMMC ..."
|
||||
# clean up u-boot parameters
|
||||
#dd if=/dev/zero of=/dev/mmcblk0 bs=1024 seek=384 count=8
|
||||
# access boot partition 1
|
||||
echo 0 > /sys/block/mmcblk0boot0/force_ro
|
||||
# write u-boot to eMMC
|
||||
dd if=$SYSTEM_ROOT/usr/share/bootloader/u-boot-$SYSTEM_TYPE.imx of=/dev/mmcblk0boot0 bs=1k seek=1 conv=fsync &>/dev/null
|
||||
# re-enable read-only access
|
||||
echo 1 > /sys/block/mmcblk0boot0/force_ro
|
||||
# enable boot partion 1 to boot
|
||||
echo 8 > /sys/devices/soc0/soc.1/2100000.aips-bus/219c000.usdhc/mmc_host/mmc2/mmc2:0001/boot_config
|
||||
fi
|
||||
else
|
||||
if [ -n "$SYSTEM_TYPE" ]; then
|
||||
UBOOT_IMG_SRC=u-boot-$SYSTEM_TYPE.img
|
||||
SPL_SRC=SPL-$SYSTEM_TYPE
|
||||
else
|
||||
UBOOT_IMG_SRC=u-boot.img
|
||||
SPL_SRC=SPL
|
||||
fi
|
||||
|
||||
if [ -f $SYSTEM_ROOT/usr/share/bootloader/$UBOOT_IMG_SRC ]; then
|
||||
echo "*** updating u-boot image: $BOOT_ROOT/u-boot.img ..."
|
||||
cp -p $SYSTEM_ROOT/usr/share/bootloader/$UBOOT_IMG_SRC $BOOT_ROOT/u-boot.img
|
||||
fi
|
||||
|
||||
if [ -f $SYSTEM_ROOT/usr/share/bootloader/$SPL_SRC ]; then
|
||||
echo "*** updating u-boot SPL Blob on: $BOOT_DISK ..."
|
||||
dd if="$SYSTEM_ROOT/usr/share/bootloader/$SPL_SRC" of="$BOOT_DISK" bs=1k seek=1 conv=fsync &>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
# prefer uEnv.txt over boot.scr
|
||||
if [ -n "$SYSTEM_TYPE" -a -f $SYSTEM_ROOT/usr/share/bootloader/uEnv-$SYSTEM_TYPE.txt -a ! -f $BOOT_ROOT/uEnv.txt ]; then
|
||||
cp -p $SYSTEM_ROOT/usr/share/bootloader/uEnv-$SYSTEM_TYPE.txt $BOOT_ROOT/uEnv.txt
|
||||
elif [ -f $SYSTEM_ROOT/usr/share/bootloader/uEnv.txt -a ! -f $BOOT_ROOT/uEnv.txt ]; then
|
||||
cp -p $SYSTEM_ROOT/usr/share/bootloader/uEnv.txt $BOOT_ROOT
|
||||
elif [ -f $SYSTEM_ROOT/usr/share/bootloader/boot.scr -a ! -f $BOOT_ROOT/boot.scr ]; then
|
||||
cp -p $SYSTEM_ROOT/usr/share/bootloader/boot.scr $BOOT_ROOT
|
||||
fi
|
||||
|
||||
# mount $BOOT_ROOT r/o
|
||||
sync
|
||||
mount -o remount,ro $BOOT_ROOT
|
@ -65,6 +65,10 @@ if [ -f $STAMP ] ; then
|
||||
if [ ! "$PKG_DEEPMD5" = "$STAMP_PKG_DEEPMD5" ] ; then
|
||||
rm -f $STAMP
|
||||
fi
|
||||
|
||||
if [ "$1" = "u-boot" -a ! "$UBOOT_SYSTEM" = "$STAMP_UBOOT_SYSTEM" ]; then
|
||||
rm -f $STAMP
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f $STAMP ]; then
|
||||
@ -478,4 +482,8 @@ if [ ! -f $STAMP ]; then
|
||||
for i in PKG_NAME PKG_DEEPMD5; do
|
||||
echo "STAMP_$i=\"${!i}\"" >> $STAMP
|
||||
done
|
||||
|
||||
if [ "$1" = "u-boot" ]; then
|
||||
echo "STAMP_UBOOT_SYSTEM=\"${UBOOT_SYSTEM}\"" >> $STAMP
|
||||
fi
|
||||
fi
|
||||
|
@ -75,8 +75,8 @@ if [ "$DEVEL_VERSION" = "devel" ] ; then
|
||||
IMAGE_NAME="$DISTRONAME-$LIBREELEC_ARCH-$OS_VERSION-$LIBREELEC_VERSION"
|
||||
fi
|
||||
|
||||
if [ "$PROJECT" == "imx6" -a -n "$SYSTEM" ]; then
|
||||
IMAGE_NAME="$IMAGE_NAME-$SYSTEM"
|
||||
if [ -n "$UBOOT_SYSTEM" ]; then
|
||||
IMAGE_NAME="$IMAGE_NAME-$UBOOT_SYSTEM"
|
||||
fi
|
||||
|
||||
if [ -n "$CUSTOM_IMAGE_NAME" ]; then
|
||||
@ -267,31 +267,17 @@ if [ "$1" = "release" -o "$1" = "mkimage" -o "$1" = "amlpkg" -o "$1" = "noobs" ]
|
||||
|
||||
# remove n previous created release image
|
||||
rm -rf $TARGET_IMG/$IMAGE_NAME.img.gz
|
||||
if [ -n "$BOOTLOADER" ]; then
|
||||
|
||||
BOOTLOADER_DIR="$(get_pkg_directory "$BOOTLOADER")"
|
||||
|
||||
if [ -d $BOOTLOADER_DIR/files ]; then
|
||||
cp -R $BOOTLOADER_DIR/files/* $RELEASE_DIR
|
||||
fi
|
||||
|
||||
if [ -n "$DEVICE" -a -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/release ]; then
|
||||
if [ "$BOOTLOADER" = "u-boot" ]; then
|
||||
if [ -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/release ]; then
|
||||
echo "Running $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/release"
|
||||
. $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/release
|
||||
elif [ -f $PROJECT_DIR/$PROJECT/bootloader/release ]; then
|
||||
echo "Running $PROJECT_DIR/$PROJECT/bootloader/release"
|
||||
. $PROJECT_DIR/$PROJECT/bootloader/release
|
||||
elif [ -f $BOOTLOADER_DIR/release ]; then
|
||||
. $BOOTLOADER_DIR/release
|
||||
fi
|
||||
fi
|
||||
|
||||
# MfgTool2 for TBS Matrix support (add it to .tar)
|
||||
# only for matrix system or all? (one tar for all updates?)
|
||||
if [ "$PROJECT" == "imx6" -a "$SYSTEM" == "matrix" ]; then
|
||||
$SCRIPTS/unpack imx6-mfgtool2-tbs-matrix
|
||||
mkdir -p $RELEASE_DIR/MfgTool2-TBS-Matrix
|
||||
cp -PR $BUILD/imx6-mfgtool2-tbs-matrix-*/* $RELEASE_DIR/MfgTool2-TBS-Matrix
|
||||
fi
|
||||
|
||||
cp $ROOT/README* $RELEASE_DIR
|
||||
cp $ROOT/CHANGELOG* $RELEASE_DIR
|
||||
echo "$TARGET_VERSION" > $RELEASE_DIR/RELEASE
|
||||
@ -329,19 +315,11 @@ if [ "$1" = "release" -o "$1" = "mkimage" -o "$1" = "amlpkg" -o "$1" = "noobs" ]
|
||||
KERNEL_NAME="KERNEL"
|
||||
fi
|
||||
|
||||
UBOOT_SYSTEM=""
|
||||
if [ "$PROJECT" == "imx6" ]; then
|
||||
if [ -n "$SYSTEM" ]; then
|
||||
UBOOT_SYSTEM="$SYSTEM"
|
||||
else
|
||||
UBOOT_SYSTEM="cuboxi"
|
||||
fi
|
||||
fi
|
||||
|
||||
# variables used in image script must be passed
|
||||
env \
|
||||
PATH="$PATH:/sbin" \
|
||||
ROOT="$ROOT" \
|
||||
SCRIPTS="$SCRIPTS" \
|
||||
TOOLCHAIN="$TOOLCHAIN" \
|
||||
PROJECT_DIR="$PROJECT_DIR" \
|
||||
PROJECT="$PROJECT" \
|
||||
|
@ -225,34 +225,35 @@ EOF
|
||||
mcopy -s $RELEASE_DIR/3rdparty/bootloader/overlays ::
|
||||
fi
|
||||
|
||||
elif [ "$BOOTLOADER" = "u-boot" ]; then
|
||||
elif [ "$BOOTLOADER" = "u-boot" -a \( -n "$UBOOT_SYSTEM" -o "$PROJECT" = "Odroid_C2" \) ]; then
|
||||
# create bootloader configuration
|
||||
echo "image: creating bootloader configuration..."
|
||||
if [ -n "$UBOOT_SYSTEM" -a -f "$RELEASE_DIR/3rdparty/bootloader/uEnv-$UBOOT_SYSTEM.txt" ]; then
|
||||
mcopy "$RELEASE_DIR/3rdparty/bootloader/uEnv-$UBOOT_SYSTEM.txt" ::/uEnv.txt
|
||||
elif [ -f "$RELEASE_DIR/3rdparty/bootloader/uEnv.txt" ]; then
|
||||
mcopy $RELEASE_DIR/3rdparty/bootloader/uEnv.txt ::
|
||||
elif [ -f "$RELEASE_DIR/3rdparty/bootloader/boot.scr" ]; then
|
||||
mcopy $RELEASE_DIR/3rdparty/bootloader/boot.scr ::
|
||||
elif [ -f "$RELEASE_DIR/3rdparty/bootloader/boot.ini" ]; then
|
||||
mcopy $RELEASE_DIR/3rdparty/bootloader/boot.ini ::
|
||||
|
||||
if [ "$PROJECT" != "Odroid_C2" ]; then
|
||||
DTB="$($SCRIPTS/uboot_helper $PROJECT $DEVICE $UBOOT_SYSTEM dtb)"
|
||||
|
||||
if [ -f "$RELEASE_DIR/3rdparty/bootloader/$DTB" ]; then
|
||||
mcopy $RELEASE_DIR/3rdparty/bootloader/$DTB ::
|
||||
fi
|
||||
|
||||
mkdir -p "$LE_TMP"/extlinux
|
||||
|
||||
cat << EOF > "$LE_TMP"/extlinux/extlinux.conf
|
||||
LABEL $DISTRO
|
||||
LINUX /$KERNEL_NAME
|
||||
FDT /$DTB
|
||||
APPEND boot=UUID=$UUID_SYSTEM disk=UUID=$UUID_STORAGE quiet $EXTRA_CMDLINE
|
||||
EOF
|
||||
|
||||
mcopy -s "$LE_TMP"/extlinux ::
|
||||
fi
|
||||
|
||||
echo "image: installing u-boot bootloader..."
|
||||
if [ -n "$UBOOT_SYSTEM" -a -f "$RELEASE_DIR/3rdparty/bootloader/SPL-$UBOOT_SYSTEM" ]; then
|
||||
dd if="$RELEASE_DIR/3rdparty/bootloader/SPL-$UBOOT_SYSTEM" of="$DISK" bs=512 seek=2 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error
|
||||
elif [ -f "$RELEASE_DIR/3rdparty/bootloader/SPL" ]; then
|
||||
dd if="$RELEASE_DIR/3rdparty/bootloader/SPL" of="$DISK" bs=512 seek=2 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error
|
||||
elif [ -n "$UBOOT_SYSTEM" -a -f "$RELEASE_DIR/3rdparty/bootloader/u-boot-$UBOOT_SYSTEM.imx" ]; then
|
||||
dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot-$UBOOT_SYSTEM.imx" of="$DISK" bs=512 seek=2 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error
|
||||
elif [ -f "$RELEASE_DIR/3rdparty/bootloader/u-boot.imx" ]; then
|
||||
dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot.imx" of="$DISK" bs=512 seek=2 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error
|
||||
elif [ -f "$RELEASE_DIR/3rdparty/bootloader/u-boot-fuse" ]; then
|
||||
# allow custom dd script for vendor specific fusing
|
||||
. $RELEASE_DIR/3rdparty/bootloader/u-boot-fuse
|
||||
elif [ -f "$RELEASE_DIR/3rdparty/bootloader/u-boot" ]; then
|
||||
dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot" of="$DISK" conv=fsync,notrunc bs=1 count=112 >"$SAVE_ERROR" 2>&1 || show_error
|
||||
dd if="$RELEASE_DIR/3rdparty/bootloader/u-boot" of="$DISK" conv=fsync,notrunc bs=512 skip=1 seek=1 >"$SAVE_ERROR" 2>&1 || show_error
|
||||
if [ -f $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/mkimage ]; then
|
||||
. $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/mkimage
|
||||
elif [ -f $PROJECT_DIR/$PROJECT/bootloader/mkimage ]; then
|
||||
. $PROJECT_DIR/$PROJECT/bootloader/mkimage
|
||||
else
|
||||
echo "No specific mkimage script found. u-boot will not be written"
|
||||
fi
|
||||
|
||||
echo "image: copying files to part1..."
|
||||
@ -261,26 +262,9 @@ elif [ "$BOOTLOADER" = "u-boot" ]; then
|
||||
mcopy $RELEASE_DIR/target/KERNEL.md5 "::/$KERNEL_NAME.md5"
|
||||
mcopy $RELEASE_DIR/target/SYSTEM.md5 ::/SYSTEM.md5
|
||||
|
||||
if [ -n "$UBOOT_SYSTEM" -a -f "$RELEASE_DIR/3rdparty/bootloader/u-boot-$UBOOT_SYSTEM.img" ]; then
|
||||
mcopy "$RELEASE_DIR/3rdparty/bootloader/u-boot-$UBOOT_SYSTEM.img" ::/u-boot.img
|
||||
elif [ -f $RELEASE_DIR/3rdparty/bootloader/u-boot.img ]; then
|
||||
mcopy $RELEASE_DIR/3rdparty/bootloader/u-boot.img ::
|
||||
fi
|
||||
|
||||
if [ -f $RELEASE_DIR/3rdparty/bootloader/boot-logo.bmp.gz ]; then
|
||||
mcopy $RELEASE_DIR/3rdparty/bootloader/boot-logo.bmp.gz ::
|
||||
fi
|
||||
|
||||
for dtb in $RELEASE_DIR/3rdparty/bootloader/*.dtb ; do
|
||||
if [ -f $dtb ] ; then
|
||||
mcopy "$dtb" ::/$(basename "$dtb")
|
||||
fi
|
||||
done
|
||||
|
||||
# copy Amlogic device tree image
|
||||
if [ -f "$RELEASE_DIR/3rdparty/bootloader/dtb.img" ]; then
|
||||
mcopy $RELEASE_DIR/3rdparty/bootloader/dtb.img ::
|
||||
fi
|
||||
elif [ "$BOOTLOADER" = "u-boot" ]; then
|
||||
echo "to make an image using u-boot UBOOT_SYSTEM must be set"
|
||||
cleanup
|
||||
fi # bootloader
|
||||
|
||||
# extract part2 from image to format and copy files
|
||||
|
67
scripts/uboot_helper
Executable file
67
scripts/uboot_helper
Executable file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
devices = {
|
||||
'project' : {
|
||||
'device' : {
|
||||
'board_name' : { 'dtb' : 'board_name.dtb', 'config' : 'board_name_defconfig' },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
def usage():
|
||||
print(' '.join(['Usage:', sys.argv[0], '<project>', '<soc>', '<board-name>', 'dtb|config']))
|
||||
print(' '.join([' ', sys.argv[0], '<project>', '<soc>']))
|
||||
print(' '.join([' ', sys.argv[0], '<project>']) + '\n')
|
||||
print('Projects:' + '\n')
|
||||
for project in devices:
|
||||
print(' ' + project + ':')
|
||||
for soc in devices[project]:
|
||||
print(' ' + soc + ':')
|
||||
for board in devices[project][soc]:
|
||||
print(' ' + board)
|
||||
print('')
|
||||
print('')
|
||||
|
||||
# Get dtb or u-boot config for a given project, soc, and board
|
||||
# ./scripts/uboot_helper project device board_name dtb
|
||||
if len(sys.argv) == 5:
|
||||
if sys.argv[1] in devices:
|
||||
if sys.argv[2] in devices[sys.argv[1]]:
|
||||
if sys.argv[3] in devices[sys.argv[1]][sys.argv[2]]:
|
||||
if sys.argv[4] in ['dtb', 'config']:
|
||||
print(devices[sys.argv[1]][sys.argv[2]][sys.argv[3]][sys.argv[4]])
|
||||
sys.exit(0)
|
||||
|
||||
# List boards supported by a given project and soc
|
||||
# ./scripts/uboot_helper project device
|
||||
elif len(sys.argv) == 3:
|
||||
if sys.argv[1] in devices:
|
||||
if sys.argv[2] in devices[sys.argv[1]]:
|
||||
boards = []
|
||||
for board in devices[sys.argv[1]][sys.argv[2]]:
|
||||
boards.append(board)
|
||||
print(' '.join(boards))
|
||||
sys.exit(0)
|
||||
|
||||
# List socs supported by a given project
|
||||
# ./scripts/uboot_helper project
|
||||
elif len(sys.argv) == 2:
|
||||
if sys.argv[1] in devices:
|
||||
socs = []
|
||||
for soc in devices[sys.argv[1]]:
|
||||
socs.append(soc)
|
||||
print(' '.join(socs))
|
||||
sys.exit(0)
|
||||
|
||||
# List projects
|
||||
# ./scripts/uboot_helper
|
||||
elif len(sys.argv) == 1:
|
||||
projects = []
|
||||
for project in devices:
|
||||
projects.append(project)
|
||||
print(' '.join(projects))
|
||||
sys.exit(0)
|
||||
|
||||
usage()
|
Loading…
x
Reference in New Issue
Block a user