diff options
author | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2019-10-22 21:46:57 +0200 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2019-10-27 14:24:22 +0100 |
commit | 0130022baec0a90c6cb039a5cbe9b9c65c01672f (patch) | |
tree | 93815b43aaf2d13863c0beb78e95cf443c29606a /target/linux/ath79/base-files/lib/functions/k2t.sh | |
parent | c36ef5970b0342f01f1f3bfc7452b86992c7201b (diff) | |
download | upstream-0130022baec0a90c6cb039a5cbe9b9c65c01672f.tar.gz upstream-0130022baec0a90c6cb039a5cbe9b9c65c01672f.tar.bz2 upstream-0130022baec0a90c6cb039a5cbe9b9c65c01672f.zip |
ath79: split base-files into subtargets
While most of the target's contents are split into subtargets, the
base-files are maintained for the target as a whole.
However, OpenWrt already implements a mechanism that will use (and
even prefer) files in the subtargets' directories. This can be
exploited to make several scripts subtarget-specific and thus save
some space (especially helpful for the tiny devices).
The only script remaining in parent base-files is
/etc/hotplug.d/ieee80211/00-wifi-migration, everything else is
moved/split.
Note that this will increase overall code lines, but reduce code
per subtarget.
base-files ipk size reduction:
master (generic) 49135 B
split (generic) 48533 B (- 0.6 kiB)
split (tiny) 43337 B (- 5.7 kiB)
split (nand) 44423 B (- 4.6 kiB)
Tested on TL-WR1043ND v4 (generic) and TL-WR841N v12 (tiny).
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Diffstat (limited to 'target/linux/ath79/base-files/lib/functions/k2t.sh')
-rwxr-xr-x | target/linux/ath79/base-files/lib/functions/k2t.sh | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/target/linux/ath79/base-files/lib/functions/k2t.sh b/target/linux/ath79/base-files/lib/functions/k2t.sh deleted file mode 100755 index 1158df818b..0000000000 --- a/target/linux/ath79/base-files/lib/functions/k2t.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2018 Weijie Gao <hackpascal@gmail.com> -# -# Helper function to extract mac addresses from mtd part for Phicomm K2T -# - -. /lib/functions.sh -. /lib/functions/system.sh -. /usr/share/libubox/jshn.sh - -k2t_config_load() { - local mtd_blk=$(find_mtd_part config) - - if [ -z "$mtd_blk" ]; then - echo "k2t_config_load: no mtd part named config" >&2 - exit 1 - fi - - local json_size=$(dd if=$mtd_blk bs=1 count=8 2>/dev/null) - - json_size="0x$json_size" - json_size=$((json_size)) - - if [ "$?" -ne 0 ]; then - echo "k2t_config_load: invalid json data size" >&2 - exit 2 - fi - - if [ "$json_size" -eq 0 ]; then - echo "k2t_config_load: empty json data" >&2 - exit 3 - fi - - local json_data=$(dd if=$mtd_blk bs=1 skip=8 count=$json_size 2>/dev/null) - - json_load "$json_data" -} - -k2t_get_mac() { - local old_ns - - json_set_namespace "k2t" old_ns - - if k2t_config_load; then - json_select "this_dev_info" - json_get_var val "$1" - json_select .. - fi - - json_set_namespace old_ns - - echo $val -} - |