diff options
author | Luka Perkov <luka@openwrt.org> | 2014-04-19 21:39:09 +0000 |
---|---|---|
committer | Luka Perkov <luka@openwrt.org> | 2014-04-19 21:39:09 +0000 |
commit | 2f82f5dbfd3de93da644179de685c75799c15ff0 (patch) | |
tree | f87cee73cff34b1bb1811fd29cb1066eead3ad4f /package/boot | |
parent | 5ecc844892e9deef9540c778296574179ed27aa0 (diff) | |
download | master-187ad058-2f82f5dbfd3de93da644179de685c75799c15ff0.tar.gz master-187ad058-2f82f5dbfd3de93da644179de685c75799c15ff0.tar.bz2 master-187ad058-2f82f5dbfd3de93da644179de685c75799c15ff0.zip |
kobs-ng: Add support for overriding size
By default kobs-ng will use the size of /dev/mtd0 for the IMX bootstreams.
This patch allows overriding that size in order to reserve space at the end
of the mtd partition for u-boot.img in the case of using an SPL bootloader.
For example, to flash an SPL bootloader that loads u-boot.img from 0xe0000
(14MB) offset in a 16MB /dev/mtd0:
kobs-ng init -v -x --search_exponent=1 --chip_0_size=0xe00000 SPL
nandwrite --start=0xe00000 --pad /dev/mtd0 u-boot.img
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@40532 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/boot')
-rw-r--r-- | package/boot/kobs-ng/Makefile | 4 | ||||
-rw-r--r-- | package/boot/kobs-ng/patches/002-add-init-size-param.patch | 42 |
2 files changed, 44 insertions, 2 deletions
diff --git a/package/boot/kobs-ng/Makefile b/package/boot/kobs-ng/Makefile index 1554e6835d..c43fa19243 100644 --- a/package/boot/kobs-ng/Makefile +++ b/package/boot/kobs-ng/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2013 OpenWrt.org +# Copyright (C) 2013-2014 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=kobs-ng PKG_VERSION:=3.0.35-4.0.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://repository.timesys.com/buildsources/k/kobs-ng/kobs-ng-$(PKG_VERSION)/ diff --git a/package/boot/kobs-ng/patches/002-add-init-size-param.patch b/package/boot/kobs-ng/patches/002-add-init-size-param.patch new file mode 100644 index 0000000000..e0e89b2aec --- /dev/null +++ b/package/boot/kobs-ng/patches/002-add-init-size-param.patch @@ -0,0 +1,42 @@ +--- a/src/main.c ++++ b/src/main.c +@@ -94,6 +94,7 @@ void usage(void) + " [KOBS] boot structures config options\n" + " --chip_0_device_path=<path> .......... Device of boot (default /dev/mtd0)\n" + " --chip_1_device_path=<path> .......... The second chip in case of multichip NAND\n" ++ " --chip_0_size=<size> ................. Override size of chip_0 device\n" + " --search_exponent=<value> ............ NCB field (default 2)\n" + " --data_setup_time=<value> ............ NCB field (default 80)\n" + " --data_hold_time=<value> ............. NCB field (default 60)\n" +--- a/src/mtd.c ++++ b/src/mtd.c +@@ -716,6 +716,11 @@ struct mtd_data *mtd_open(const struct m + goto out; + } + ++ /* override MTD size */ ++ if (md->cfg.chip_0_size) { ++ miu->size = md->cfg.chip_0_size; ++ } ++ + /* verify it's a nand */ + if (miu->type != MTD_NANDFLASH) { + fprintf(stderr, "mtd: device %s not NAND\n", mp->name); +@@ -2914,7 +2919,7 @@ static const struct { + } mtd_int_args[] = { + ARG_IGNORE(chip_count), + ARG_IGNORE(chip_0_offset), +- ARG_IGNORE(chip_0_size), ++ ARG(chip_0_size), + ARG_IGNORE(chip_1_offset), + ARG_IGNORE(chip_1_size), + ARG(search_exponent), +@@ -3107,7 +3112,7 @@ void mtd_cfg_dump(struct mtd_config *cfg + // Pd(chip_count); + Ps(chip_0_device_path); + // Pd(chip_0_offset); +-// Pd(chip_0_size); ++ Pd(chip_0_size); + Ps(chip_1_device_path); + // Pd(chip_1_offset); + // Pd(chip_1_size); |