diff --git a/addons/tools/u-boot-tools/icon/icon.png b/addons/tools/u-boot-tools/icon/icon.png new file mode 100644 index 000000000..9fab42997 Binary files /dev/null and b/addons/tools/u-boot-tools/icon/icon.png differ diff --git a/addons/tools/u-boot-tools/package.mk b/addons/tools/u-boot-tools/package.mk new file mode 100644 index 000000000..db43480f2 --- /dev/null +++ b/addons/tools/u-boot-tools/package.mk @@ -0,0 +1,76 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 OpenELEC +# Copyright (C) 2016 Peter Smorada (smoradap@gmail.com) +# +# This Program 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, or (at your option) +# any later version. +# +# This Program 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.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="u-boot-tools" +PKG_VERSION="2016.01" +PKG_REV="0" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.denx.de/wiki/U-Boot/WebHome" +PKG_URL="ftp://ftp.denx.de/pub/u-boot/u-boot-$PKG_VERSION.tar.bz2" +PKG_DEPENDS_TARGET="toolchain" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="U-Boot bootloader utility tools" +PKG_LONGDESC="U-Boot bootloader utility tools. This package includes the mkimage program, which allows generation of U-Boot images in various formats, and the fw_printenv and fw_setenv programs to read and modify U-Boot's environment and other tools." +PKG_DISCLAIMER="This addon can make your device unusable if improperly configured. Use at your own risk. This is an unofficial addon. Please don't ask for support in openelec forum / irc channel" + +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.python.script" +PKG_ADDON_PROVIDES="" +PKG_ADDON_NAME="uboot-tools" +PKG_ADDON_REPOVERSION="7.0" + +PKG_MAINTAINER="Peter Smorada (smoradap at gmail dot com)" + +unpack() { + tar jxf "$SOURCES/$PKG_NAME/u-boot-${PKG_VERSION}.tar.bz2" -C $BUILD + mv $BUILD/u-boot-$PKG_VERSION $BUILD/u-boot-tools-$PKG_VERSION +} + + +make_target() { + make dummy_defconfig + make CROSS_COMPILE="$TARGET_PREFIX" ARCH="$TARGET_ARCH" env + make CROSS_COMPILE="$TARGET_PREFIX" cross_tools +} + +makeinstall_target() { + : # nop +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp $PKG_BUILD/tools/env/fw_printenv $ADDON_BUILD/$PKG_ADDON_ID/bin/fw_printenv + cp $PKG_BUILD/tools/env/fw_printenv $ADDON_BUILD/$PKG_ADDON_ID/bin/fw_setenv + cp $PKG_BUILD/tools/dumpimage $ADDON_BUILD/$PKG_ADDON_ID/bin/dumpimage + cp $PKG_BUILD/tools/fdtgrep $ADDON_BUILD/$PKG_ADDON_ID/bin/fdtgrep + cp $PKG_BUILD/tools/gen_eth_addr $ADDON_BUILD/$PKG_ADDON_ID/bin/gen_eth_addr + cp $PKG_BUILD/tools/img2srec $ADDON_BUILD/$PKG_ADDON_ID/bin/img2srec + cp $PKG_BUILD/tools/mkenvimage $ADDON_BUILD/$PKG_ADDON_ID/bin/mkenvimage + cp $PKG_BUILD/tools/mkimage $ADDON_BUILD/$PKG_ADDON_ID/bin/mkimage + cp $PKG_BUILD/tools/proftool $ADDON_BUILD/$PKG_ADDON_ID/bin/proftool + cp $PKG_BUILD/tools/relocate-rela $ADDON_BUILD/$PKG_ADDON_ID/bin/relocate-rela +} + + diff --git a/addons/tools/u-boot-tools/patches/u-boot-tools-0001-fw_env.patch b/addons/tools/u-boot-tools/patches/u-boot-tools-0001-fw_env.patch new file mode 100644 index 000000000..83d1769bd --- /dev/null +++ b/addons/tools/u-boot-tools/patches/u-boot-tools-0001-fw_env.patch @@ -0,0 +1,11 @@ +--- a/tools/env/fw_env.h 2016-01-12 15:06:54.000000000 +0100 ++++ b/tools/env/fw_env.h 2016-02-03 21:07:46.371967129 +0100 +@@ -22,7 +22,7 @@ + * See included "fw_env.config" sample file + * for notes on configuration. + */ +-#define CONFIG_FILE "/etc/fw_env.config" ++#define CONFIG_FILE "/storage/.kodi/userdata/addon_data/tools.u-boot-tools/fw_env.config" + + #ifndef CONFIG_FILE + #define HAVE_REDUND /* For systems with 2 env sectors */ diff --git a/addons/tools/u-boot-tools/patches/u-boot-tools-0002-dummy_defconfig.patch b/addons/tools/u-boot-tools/patches/u-boot-tools-0002-dummy_defconfig.patch new file mode 100644 index 000000000..dc6e08c38 --- /dev/null +++ b/addons/tools/u-boot-tools/patches/u-boot-tools-0002-dummy_defconfig.patch @@ -0,0 +1,5 @@ +--- a/configs/dummy_defconfig 1970-01-01 01:00:00.000000000 +0100 ++++ b/configs/dummy_defconfig 2016-01-22 18:00:39.189797998 +0100 +@@ -0,0 +1,2 @@ ++CONFIG_ARM=y ++ diff --git a/addons/tools/u-boot-tools/source/default.py b/addons/tools/u-boot-tools/source/default.py new file mode 100644 index 000000000..fa4ec39b5 --- /dev/null +++ b/addons/tools/u-boot-tools/source/default.py @@ -0,0 +1,22 @@ +################################################################################ +# empty placeholder +################################################################################ +import xbmcgui +import xbmc +import xbmcaddon +import os + +# Show Readme file if in the addon folder otherwise shows only simple ok dialog +addon = xbmcaddon.Addon() +readmePath = os.path.join(addon.getAddonInfo("path"), "readme") +if(os.path.exists(readmePath)): + with open(readmePath, "r") as file: + text = file.read() + window = xbmcgui.Window(10147) + xbmc.executebuiltin("ActivateWindow(10147)") + xbmc.sleep(500) + window.getControl(5).setText(text) + window.getControl(1).setLabel(addon.getAddonInfo("name")) +else: + dialog = xbmcgui.Dialog() + dialog.ok('', 'This is a console-only addon') diff --git a/addons/tools/u-boot-tools/source/fw_env.config b/addons/tools/u-boot-tools/source/fw_env.config new file mode 100644 index 000000000..bd1d63ea1 --- /dev/null +++ b/addons/tools/u-boot-tools/source/fw_env.config @@ -0,0 +1,28 @@ +# Configuration file for fw_(printenv/setenv) utility. +# Up to two entries are valid, in this case the redundant +# environment sector is assumed present. +# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash. +# Futhermore, if the Flash sector size is ommitted, this value is assumed to +# be the same as the Environment size, which is valid for NOR and SPI-dataflash + +# Amlogic M8N configuration +#/dev/mtd1 0x100000 0x10000 0x10000 + +# NOR example +# MTD device name Device offset Env. size Flash sector size Number of sectors +#/dev/mtd1 0x0000 0x4000 0x4000 +#/dev/mtd2 0x0000 0x4000 0x4000 + +# MTD SPI-dataflash example +# MTD device name Device offset Env. size Flash sector size Number of sectors +#/dev/mtd5 0x4200 0x4200 +#/dev/mtd6 0x4200 0x4200 + +# NAND example +#/dev/mtd0 0x4000 0x4000 0x20000 2 + +# Block device example +#/dev/mmcblk0 0xc0000 0x20000 + +# VFAT example +#/boot/uboot.env 0x0000 0x4000 diff --git a/addons/tools/u-boot-tools/source/readme b/addons/tools/u-boot-tools/source/readme new file mode 100644 index 000000000..be4d2c162 --- /dev/null +++ b/addons/tools/u-boot-tools/source/readme @@ -0,0 +1,19 @@ +This addon can make your device unusable if improperly configured!!! Use at your own risk. +This is an unofficial addon. Please don't ask for support in openelec forum / irc channel. + +THIS IS COMMAND LINE ONLY ADDON. + +Usage of fw_printenv and fw_setenv requires proper configuration. Never ever try to use +fw_setenv when fw_printenv will prints any error(something like bad checksum etc.) at start +of its output - if you do it there is a big change to brick your device. Unbricking may require +access to device serial console, which may not be directly available on your device and may +require soldering of proper pins on the device and USB-TTL adapter!!! + +fw_printenv and fw_setenv needs configuration file to be located in +/storage/.kodi/userdata/addon_data/tools.u-boot-tools/fw_env.config +example configuaration can be found in /storage/.kodi/addons/tools.u-boot-tools/fw_env.config + +Addon may requre reboot to work properly + +example for my Amlogic M8N device: +/dev/mtd1 0x100000 0x10000 0x10000 \ No newline at end of file