Skip to content

Commit acbcbe8

Browse files
committed
new addon: u-boot-tools
1 parent 2a04682 commit acbcbe8

7 files changed

Lines changed: 160 additions & 0 deletions

File tree

28.2 KB
Loading
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
################################################################################
2+
# This file is part of OpenELEC - http://www.openelec.tv
3+
# Copyright (C) 2016 Peter Smorada
4+
#
5+
# This Program is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 2, or (at your option)
8+
# any later version.
9+
#
10+
# This Program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with OpenELEC.tv; see the file COPYING. If not, write to
17+
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
18+
# http://www.gnu.org/copyleft/gpl.html
19+
################################################################################
20+
21+
PKG_NAME="u-boot-tools"
22+
PKG_VERSION="2016.01"
23+
PKG_REV="0"
24+
PKG_ARCH="any"
25+
PKG_LICENSE="GPL"
26+
PKG_SITE="http://www.denx.de/wiki/U-Boot/WebHome"
27+
PKG_URL="ftp://ftp.denx.de/pub/u-boot/u-boot-$PKG_VERSION.tar.bz2"
28+
PKG_DEPENDS_TARGET="toolchain"
29+
PKG_PRIORITY="optional"
30+
PKG_SECTION="tools"
31+
PKG_SHORTDESC="U-Boot bootloader utility tools"
32+
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."
33+
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"
34+
35+
PKG_AUTORECONF="no"
36+
37+
PKG_IS_ADDON="yes"
38+
PKG_ADDON_TYPE="xbmc.python.script"
39+
PKG_ADDON_PROVIDES=""
40+
PKG_ADDON_NAME="uboot-tools"
41+
PKG_ADDON_REPOVERSION="7.0"
42+
43+
PKG_MAINTAINER="Peter Smorada (smoradap at gmail dot com)"
44+
45+
unpack() {
46+
tar jxf "$SOURCES/$PKG_NAME/u-boot-${PKG_VERSION}.tar.bz2" -C $BUILD
47+
mv $BUILD/u-boot-$PKG_VERSION $BUILD/u-boot-tools-$PKG_VERSION
48+
}
49+
50+
51+
make_target() {
52+
make dummy_defconfig
53+
make CROSS_COMPILE="$TARGET_PREFIX" ARCH="$TARGET_ARCH" env
54+
make CROSS_COMPILE="$TARGET_PREFIX" cross_tools
55+
}
56+
57+
makeinstall_target() {
58+
: # nop
59+
}
60+
61+
addon() {
62+
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin
63+
cp $PKG_BUILD/tools/env/fw_printenv $ADDON_BUILD/$PKG_ADDON_ID/bin/fw_printenv
64+
cp $PKG_BUILD/tools/env/fw_printenv $ADDON_BUILD/$PKG_ADDON_ID/bin/fw_setenv
65+
cp $PKG_BUILD/tools/dumpimage $ADDON_BUILD/$PKG_ADDON_ID/bin/dumpimage
66+
cp $PKG_BUILD/tools/fdtgrep $ADDON_BUILD/$PKG_ADDON_ID/bin/fdtgrep
67+
cp $PKG_BUILD/tools/gen_eth_addr $ADDON_BUILD/$PKG_ADDON_ID/bin/gen_eth_addr
68+
cp $PKG_BUILD/tools/img2srec $ADDON_BUILD/$PKG_ADDON_ID/bin/img2srec
69+
cp $PKG_BUILD/tools/mkenvimage $ADDON_BUILD/$PKG_ADDON_ID/bin/mkenvimage
70+
cp $PKG_BUILD/tools/mkimage $ADDON_BUILD/$PKG_ADDON_ID/bin/mkimage
71+
cp $PKG_BUILD/tools/proftool $ADDON_BUILD/$PKG_ADDON_ID/bin/proftool
72+
cp $PKG_BUILD/tools/relocate-rela $ADDON_BUILD/$PKG_ADDON_ID/bin/relocate-rela
73+
}
74+
75+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/tools/env/fw_env.h 2016-01-12 15:06:54.000000000 +0100
2+
+++ b/tools/env/fw_env.h 2016-02-03 21:07:46.371967129 +0100
3+
@@ -22,7 +22,7 @@
4+
* See included "fw_env.config" sample file
5+
* for notes on configuration.
6+
*/
7+
-#define CONFIG_FILE "/etc/fw_env.config"
8+
+#define CONFIG_FILE "/storage/.kodi/userdata/addon_data/tools.u-boot-tools/fw_env.config"
9+
10+
#ifndef CONFIG_FILE
11+
#define HAVE_REDUND /* For systems with 2 env sectors */
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--- a/configs/dummy_defconfig 1970-01-01 01:00:00.000000000 +0100
2+
+++ b/configs/dummy_defconfig 2016-01-22 18:00:39.189797998 +0100
3+
@@ -0,0 +1,2 @@
4+
+CONFIG_ARM=y
5+
+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
################################################################################
2+
# empty placeholder
3+
################################################################################
4+
import xbmcgui
5+
import xbmc
6+
import xbmcaddon
7+
import os
8+
9+
# Show Readme file if in the addon folder otherwise shows only simple ok dialog
10+
addon = xbmcaddon.Addon()
11+
readmePath = os.path.join(addon.getAddonInfo("path"), "readme")
12+
if(os.path.exists(readmePath)):
13+
with open(readmePath, "r") as file:
14+
text = file.read()
15+
window = xbmcgui.Window(10147)
16+
xbmc.executebuiltin("ActivateWindow(10147)")
17+
xbmc.sleep(500)
18+
window.getControl(5).setText(text)
19+
window.getControl(1).setLabel(addon.getAddonInfo("name"))
20+
else:
21+
dialog = xbmcgui.Dialog()
22+
dialog.ok('', 'This is a console-only addon')
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Configuration file for fw_(printenv/setenv) utility.
2+
# Up to two entries are valid, in this case the redundant
3+
# environment sector is assumed present.
4+
# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash.
5+
# Futhermore, if the Flash sector size is ommitted, this value is assumed to
6+
# be the same as the Environment size, which is valid for NOR and SPI-dataflash
7+
8+
# Amlogic M8N configuration
9+
#/dev/mtd1 0x100000 0x10000 0x10000
10+
11+
# NOR example
12+
# MTD device name Device offset Env. size Flash sector size Number of sectors
13+
#/dev/mtd1 0x0000 0x4000 0x4000
14+
#/dev/mtd2 0x0000 0x4000 0x4000
15+
16+
# MTD SPI-dataflash example
17+
# MTD device name Device offset Env. size Flash sector size Number of sectors
18+
#/dev/mtd5 0x4200 0x4200
19+
#/dev/mtd6 0x4200 0x4200
20+
21+
# NAND example
22+
#/dev/mtd0 0x4000 0x4000 0x20000 2
23+
24+
# Block device example
25+
#/dev/mmcblk0 0xc0000 0x20000
26+
27+
# VFAT example
28+
#/boot/uboot.env 0x0000 0x4000
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
This addon can make your device unusable if improperly configured!!! Use at your own risk.
2+
This is an unofficial addon. Please don't ask for support in openelec forum / irc channel.
3+
4+
THIS IS COMMAND LINE ONLY ADDON.
5+
6+
Usage of fw_printenv and fw_setenv requires proper configuration. Never ever try to use
7+
fw_setenv when fw_printenv will prints any error(something like bad checksum etc.) at start
8+
of its output - if you do it there is a big change to brick your device. Unbricking may require
9+
access to device serial console, which may not be directly available on your device and may
10+
require soldering of proper pins on the device and USB-TTL adapter!!!
11+
12+
fw_printenv and fw_setenv needs configuration file to be located in
13+
/storage/.kodi/userdata/addon_data/tools.u-boot-tools/fw_env.config
14+
example configuaration can be found in /storage/.kodi/addons/tools.u-boot-tools/fw_env.config
15+
16+
Addon may requre reboot to work properly
17+
18+
example for my Amlogic M8N device:
19+
/dev/mtd1 0x100000 0x10000 0x10000

0 commit comments

Comments
 (0)