Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added addons/tools/u-boot-tools/icon/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions addons/tools/u-boot-tools/package.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2016 OpenELEC
# Copyright (C) 2016 Peter Smorada ([email protected])
#
# 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
}


11 changes: 11 additions & 0 deletions addons/tools/u-boot-tools/patches/u-boot-tools-0001-fw_env.patch
Original file line number Diff line number Diff line change
@@ -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 */
Original file line number Diff line number Diff line change
@@ -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
+
22 changes: 22 additions & 0 deletions addons/tools/u-boot-tools/source/default.py
Original file line number Diff line number Diff line change
@@ -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')
28 changes: 28 additions & 0 deletions addons/tools/u-boot-tools/source/fw_env.config
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions addons/tools/u-boot-tools/source/readme
Original file line number Diff line number Diff line change
@@ -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