Skip to content

Commit

Permalink
u-boot-Odroid_C4: add package
Browse files Browse the repository at this point in the history
  • Loading branch information
Portisch committed Apr 8, 2020
1 parent f9f74b3 commit 5f73869
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 13 deletions.
48 changes: 48 additions & 0 deletions projects/Amlogic-ng/bootloader/Odroid_C4_boot.ini
@@ -0,0 +1,48 @@
ODROID-UBOOT-CONFIG

#------------------------------------------------------------------------------------------------------
#
# boot.ini
#
# WARNING DO NOT MODIFY THIS FILE! ALL CHANGES WILL BE LOST WITH THE NEXT UPDATE!
# Set your own settings in config.ini
#
#------------------------------------------------------------------------------------------------------

setenv bootlabel "CoreELEC"
setenv max_freq_a73 "1800"
setenv max_freq_a53 "1896"
setenv remotewakeup "0x23dc4db2"
setenv decode_type "0"
setenv remotewakeupmask "0xffffffff"
setenv heartbeat "1"
setenv emmc_timeout "0"
setenv coreelec "quiet"

setenv rootopt "BOOT_IMAGE=kernel.img boot=UUID=@BOOT_UUID@ disk=UUID=@DISK_UUID@"
setenv consoleopt "console=ttyS0,115200 console=tty0 no_console_suspend"
setenv displayopt "hdmimode=1080p60hz logo=osd0,loaded,0x3d800000 vout=1080p60hz,enable"

setenv loadaddr 0x11000000
setenv dtb_mem_addr 0x1000000
setenv uenv_addr 0x13000000

if load mmc ${mmc_dev}:1 ${uenv_addr} config.ini; then env import -t ${uenv_addr} $filesize; fi

if test "${cec_func_config}" != ""; then setenv cec "hdmitx=cec${cec_func_config}"; fi
if test "${emmc_timeout}" = "1"; then showlogo 1080p60hz 1920 1080 timeout-logo-1080.bmp.gz; sleep 30; mmc dev 1; mmc dev 0; fi
if test "${gpiopower}" != ""; then setenv gpiopower "gpiopower=${gpiopower}"; fi
setenv irsetup "remotewakeup=${remotewakeup} decode_type=${decode_type} remotewakeupmask=${remotewakeupmask}"
if test "${usbopts}" != ""; then setenv usbopts "usbopts=${usbopts}"; fi
if test "${usbpower}" != ""; then setenv usbpower "enable_system_power=${usbpower}"; fi
if test "${modeline}" != ""; then setenv cmode "modeline=${modeline}"; fi
if test "${wol}" != ""; then setenv wol "enable_wol=${wol}"; fi
setenv initargs "${rootopt} ${consoleopt} max_freq_a53=${max_freq_a53} max_freq_a73=${max_freq_a73} ${wol} ${cec} ${irsetup} ${usbpower} ${gpiopower} ${usbopts} ${cmode}"
setenv bootargs "${initargs} ${displayopt} ${coreelec}"

load mmc ${mmc_dev}:1 ${loadaddr} kernel.img
load mmc ${mmc_dev}:1 ${dtb_mem_addr} dtb.img
fdt addr ${dtb_mem_addr}
if test "${heartbeat}" = "0"; then fdt set /leds/blueled linux,default-trigger "none"; fi
booti ${loadaddr} - ${dtb_mem_addr}
bootm
8 changes: 4 additions & 4 deletions projects/Amlogic-ng/bootloader/config.ini
Expand Up @@ -57,7 +57,7 @@
#------------------------------------------------------------------------------------------------------
#
# IR setup
# Setup a custom keycode to wake the N2 from suspend or poweroff
# Setup a custom keycode to wake the N2/C4 from suspend or poweroff
# You can stop kodi and eventlircd and use "ir-keytable -u" to obtain a compatible u-boot
# IR keycode
# This setting will require a injected bl301 blob.
Expand Down Expand Up @@ -91,7 +91,7 @@

#------------------------------------------------------------------------------------------------------
#
# Heartbeat for Odroid N2
# Heartbeat for Odroid N2/C4
# You can disable the blue LED heartbeat with this option, 0=off/1=on
#
# heartbeat=1
Expand All @@ -100,7 +100,7 @@

#------------------------------------------------------------------------------------------------------
#
# EMMC Timeout for Odroid N2
# EMMC Timeout for Odroid N2/C4
# BL1 is configured to boot from eMMC before SD-card, this option is useful if you have another OS
# installed on to an eMMC as it will delay bootup by 30s allowing you to boot from an SD-card and
# attach the eMMC during this time, u-boot will then boot from the SD-card and the eMMC will be
Expand All @@ -113,7 +113,7 @@
#------------------------------------------------------------------------------------------------------
#
# Power Off and Wake Up using GPIO Key Button
# Valid options for Odroid N2 are 476,477,478,479,480,481,483,484,485,486,487,488,489,490,491,492
# Valid options for Odroid N2/C4 are 476,477,478,479,480,481,483,484,485,486,487,488,489,490,491,492
# Valid option for Khadas VIM3 is 503
#
# gpiopower=476 # (pin 16 of J2 header)
Expand Down
6 changes: 3 additions & 3 deletions projects/Amlogic-ng/bootloader/mkimage
Expand Up @@ -3,8 +3,8 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)

# copy amlogic autoscript files to part1 for all img except Odroid N2
if [ "${SUBDEVICE}" != "Odroid_N2" ]; then
# copy amlogic autoscript files to part1 for all img except Odroid N2/C4
if [ "${SUBDEVICE}" != "Odroid_N2" -o "${SUBDEVICE}" == "Odroid_C4" ]; then
for f in $RELEASE_DIR/3rdparty/bootloader/*autoscript; do
[ -e "$f" ] && mcopy "$f" ::
done
Expand Down Expand Up @@ -41,7 +41,7 @@ if [ "${SUBDEVICE}" != "Generic" ]; then
mcopy "$LE_TMP/boot.ini" ::
fi

if [ "${SUBDEVICE}" == "Odroid_N2" ]; then
if [ "${SUBDEVICE}" == "Odroid_N2" -o "${SUBDEVICE}" == "Odroid_C4" ]; then
if [ -f "$RELEASE_DIR/3rdparty/bootloader/boot-logo-1080.bmp.gz" ]; then
mcopy $RELEASE_DIR/3rdparty/bootloader/boot-logo-1080.bmp.gz ::
fi
Expand Down
6 changes: 4 additions & 2 deletions projects/Amlogic-ng/bootloader/update.sh
Expand Up @@ -45,7 +45,9 @@ for arg in $(cat /proc/cmdline); do
case $DT_ID in
*odroid_n2*)
SUBDEVICE="Odroid_N2"
DT_ID=$(echo "$DT_ID" | sed 's/g12b_a311d_odroid_n2/g12b_s922x_odroid_n2/g')
;;
*odroid_c4*)
SUBDEVICE="Odroid_C4"
;;
*khadas_vim3*)
SUBDEVICE="Khadas_VIM3"
Expand Down Expand Up @@ -123,7 +125,7 @@ if [ -f $SYSTEM_ROOT/usr/share/bootloader/config.ini ]; then
fi
fi

if [ "${SUBDEVICE}" == "Odroid_N2" ]; then
if [ "${SUBDEVICE}" == "Odroid_N2" -o "${SUBDEVICE}" == "Odroid_C4" ]; then
if [ -f $SYSTEM_ROOT/usr/share/bootloader/boot-logo-1080.bmp.gz ]; then
echo "Updating boot logos..."
cp -p $SYSTEM_ROOT/usr/share/bootloader/boot-logo-1080.bmp.gz $BOOT_ROOT
Expand Down
7 changes: 5 additions & 2 deletions projects/Amlogic-ng/filesystem/usr/sbin/installtoemmc
Expand Up @@ -137,15 +137,18 @@ case $DT_ID in
*odroid_n2)
DEVICE="Odroid_N2"
;;
*odroid_c4)
DEVICE="Odroid_C4"
;;
*)
echo "This script is only for Odroid N2. It won't work on other devices!"
echo "This script is only for Odroid N2/C4. It won't work on other devices!"
exit 1
;;
esac

echo $DEVICE

if [ "$DEVICE" = "Odroid_N2" ]; then
if [ "$DEVICE" = "Odroid_N2" -o "${SUBDEVICE}" == "Odroid_C4" ]; then
echo "This script will help you move a CoreELEC install on to an Odroid_N2 eMMC module"
echo "from an existing CoreELEC install on an SD card or USB drive."
echo ""
Expand Down
2 changes: 1 addition & 1 deletion projects/Amlogic-ng/options
Expand Up @@ -161,4 +161,4 @@
ENTWARE_ARCH="aarch64-k3.10"

# CoreELEC Subdevices
SUBDEVICES="Odroid_N2"
SUBDEVICES="Odroid_N2 Odroid_C4"
32 changes: 32 additions & 0 deletions projects/Amlogic-ng/packages/u-boot-Odroid_C4/package.mk
@@ -0,0 +1,32 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)

PKG_NAME="u-boot-Odroid_C4"
PKG_VERSION="dde2b5a85a08474d4a4e13f8feb9b992b0b305da"
PKG_SHA256="a71493ed7e9dacb7840f544ad67b5883f4d38c0abfc4a55c16081dcdc19dc2ca"
PKG_LICENSE="GPL"
PKG_SITE="https://www.denx.de/wiki/U-Boot"
PKG_URL="https://github.com/CoreELEC/u-boot/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain gcc-linaro-aarch64-elf:host gcc-linaro-arm-eabi:host"
PKG_LONGDESC="Das U-Boot is a cross-platform bootloader for embedded systems."
PKG_TOOLCHAIN="manual"

pre_make_target() {
sed -i "s|arm-none-eabi-|arm-eabi-|g" $PKG_BUILD/Makefile $PKG_BUILD/arch/arm/cpu/armv8/*/firmware/scp_task/Makefile 2>/dev/null || true
}

configure_package() {
PKG_UBOOT_CONFIG="odroidc4_defconfig"
}

make_target() {
[ "${BUILD_WITH_DEBUG}" = "yes" ] && PKG_DEBUG=1 || PKG_DEBUG=0
export PATH=$TOOLCHAIN/lib/gcc-linaro-aarch64-elf/bin/:$TOOLCHAIN/lib/gcc-linaro-arm-eabi/bin/:$PATH
DEBUG=${PKG_DEBUG} CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make mrproper
DEBUG=${PKG_DEBUG} CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make $PKG_UBOOT_CONFIG
DEBUG=${PKG_DEBUG} CROSS_COMPILE=aarch64-elf- ARCH=arm CFLAGS="" LDFLAGS="" make HOSTCC="$HOST_CC" HOSTSTRIP="true"
}

makeinstall_target() {
: # nothing
}
2 changes: 1 addition & 1 deletion projects/Amlogic-ng/packages/u-boot/package.mk
Expand Up @@ -39,7 +39,7 @@ makeinstall_target() {

for PKG_SUBDEVICE in $SUBDEVICES; do
find_file_path bootloader/${PKG_SUBDEVICE}_boot.ini && cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader
if [ $PKG_SUBDEVICE = "Odroid_N2" ]; then
if [ $PKG_SUBDEVICE = "Odroid_N2" -o $PKG_SUBDEVICE = "Odroid_C4" ]; then
PKG_UBOOTBIN=$(get_build_dir u-boot-${PKG_SUBDEVICE})/sd_fuse/u-boot.bin.sd.bin
fi
cp -av ${PKG_UBOOTBIN} $INSTALL/usr/share/bootloader/${PKG_SUBDEVICE}_u-boot
Expand Down

0 comments on commit 5f73869

Please sign in to comment.