aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ipq40xx/base-files
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ipq40xx/base-files')
-rw-r--r--target/linux/ipq40xx/base-files/etc/board.d/01_leds5
-rw-r--r--target/linux/ipq40xx/base-files/etc/board.d/02_network3
-rw-r--r--target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches3
-rw-r--r--target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata6
-rw-r--r--target/linux/ipq40xx/base-files/lib/upgrade/platform.sh3
-rw-r--r--target/linux/ipq40xx/base-files/lib/upgrade/sony.sh91
6 files changed, 110 insertions, 1 deletions
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/01_leds b/target/linux/ipq40xx/base-files/etc/board.d/01_leds
index 0e473534f5..4b9522af92 100644
--- a/target/linux/ipq40xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq40xx/base-files/etc/board.d/01_leds
@@ -94,6 +94,11 @@ qxwlan,e2600ac-c2)
ucidef_set_led_wlan "wlan2g" "WLAN0" "green:wlan0" "phy0tpt"
ucidef_set_led_wlan "wlan5g" "WLAN1" "green:wlan1" "phy1tpt"
;;
+sony,ncp-hg100-cellular)
+ ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0"
+ ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
+ ucidef_set_led_netdev "wwan" "WWAN" "green:wan-4" "wwan0"
+ ;;
zyxel,nbg6617 |\
zyxel,wre6606)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy0tpt"
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index 040f3ee619..74a1d61d06 100644
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -19,7 +19,8 @@ ipq40xx_setup_interfaces()
luma,wrtq-329acn|\
netgear,wac510|\
plasmacloud,pa1200|\
- plasmacloud,pa2200)
+ plasmacloud,pa2200|\
+ sony,ncp-hg100-cellular)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
aruba,ap-303|\
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches b/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches
index a52a33d2f4..2ead17b152 100644
--- a/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches
+++ b/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches
@@ -24,6 +24,9 @@ mikrotik,cap-ac)
mikrotik,hap-ac3)
ucidef_add_gpio_switch "poe_passtrough" "PoE Passthrough" "452" "0"
;;
+sony,ncp-hg100-cellular)
+ ucidef_add_gpio_switch "uart_dbgcon_en" "debug console enable" "427" "1"
+ ;;
zte,mf286d)
ucidef_add_gpio_switch "power_btn_block" "Power button blocker" "421" "0"
;;
diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 6adf6f23f1..f8d270a659 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -142,6 +142,9 @@ case "$FIRMWARE" in
caldata_extract "0:ART" 0x1000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary "0:CONFIG" 0x0) 2)
;;
+ sony,ncp-hg100-cellular)
+ caldata_extract_mmc "0:ART" 0x1000 0x2f20
+ ;;
zyxel,nbg6617 |\
zyxel,wre6606)
caldata_extract "ART" 0x1000 0x2f20
@@ -237,6 +240,9 @@ case "$FIRMWARE" in
caldata_extract "0:ART" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary "0:CONFIG" 0x0) 3)
;;
+ sony,ncp-hg100-cellular)
+ caldata_extract_mmc "0:ART" 0x5000 0x2f20
+ ;;
zyxel,nbg6617 |\
zyxel,wre6606)
caldata_extract "ART" 0x5000 0x2f20
diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
index 0fa30db7cf..8a45bb213c 100644
--- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
@@ -194,6 +194,9 @@ platform_do_upgrade() {
PART_NAME="inactive"
platform_do_upgrade_dualboot_datachk "$1"
;;
+ sony,ncp-hg100-cellular)
+ sony_emmc_do_upgrade "$1"
+ ;;
teltonika,rutx10 |\
zte,mf286d)
CI_UBIPART="rootfs"
diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/sony.sh b/target/linux/ipq40xx/base-files/lib/upgrade/sony.sh
new file mode 100644
index 0000000000..8ff9df0fac
--- /dev/null
+++ b/target/linux/ipq40xx/base-files/lib/upgrade/sony.sh
@@ -0,0 +1,91 @@
+. /lib/functions.sh
+
+update_bootconfig() {
+ local offset=$1
+ local index="$2"
+ local cfgpart=$(find_mmc_part "0:BOOTCONFIG")
+ local cur_index
+
+ if [ -z "$cfgpart" ]; then
+ echo "failed to get the partition: \"0:BOOTCONFIG\""
+ return 1
+ fi
+
+ cur_index=$(dd if=${cfgpart} bs=1 count=1 skip=$offset 2> /dev/null | hexdump -e '"%d"')
+ if [ ${index} != ${cur_index} ]; then
+ echo "updating \"0:BOOTCONFIG\""
+ echo -en "\x0${index}" | \
+ dd of=${cfgpart} bs=1 count=1 seek=$offset conv=notrunc 2>/dev/null
+ fi
+
+ # also update 0:BOOTCONFIG1 if exists
+ cfgpart=$(find_mmc_part "0:BOOTCONFIG1")
+ [ -z "$cfgpart" ] && return
+
+ cur_index=$(dd if=${cfgpart} bs=1 count=1 skip=$offset 2> /dev/null | hexdump -e '"%d"')
+ if [ ${index} != ${cur_index} ]; then
+ echo "updating \"0:BOOTCONFIG1\""
+ echo -en "\x0${index}" | \
+ dd of=${cfgpart} bs=1 count=1 seek=$offset conv=notrunc 2>/dev/null
+ fi
+}
+
+### Note ###
+# After the commit bad1835f27ec31dbc30060b03cc714212275168a in fstools,
+# p17 (label: "rootfs_data") is mounted as a rootfs_data on boot instead
+# of the loop device labeled as "rootfs_data" in p15 (label: "rootfs").
+#
+# cmdline flag is added to avoid mount "rootfs_data" partition by the
+# commit 964d1e3af0e111bad6d393f8a3be702e334c2398 in fstools, but
+# NCP-HG100 doesn't use it because it has a large (abount 1.6GB)
+# "rootfs_data" partition and the advantage is larger than the
+# disadvantages, such as overwriting the stock data in "rootfs_data"
+# partition.
+sony_emmc_do_upgrade() {
+ local tar_file=$1
+ local kernel_dev
+ local rootfs_dev
+ local board_dir
+
+ kernel_dev=$(find_mmc_part "0:HLOS")
+ rootfs_dev=$(find_mmc_part "rootfs")
+ rootfs_data_dev=$(find_mmc_part "rootfs_data")
+
+ if [ -z "$kernel_dev" ] || [ -z "$rootfs_dev" ] || [ -z "$rootfs_data_dev" ]; then
+ echo "The partition name for kernel or rootfs or rootfs_data is not specified or failed to get the mmc device."
+ exit 1
+ fi
+
+ # use first partitions of kernel/rootfs for NCP-HG100
+ # - offset 88 (0x58): 0:HLOS (kernel)
+ # - offset 108 (0x6c): rootfs
+ update_bootconfig 88 0 || exit 1
+ update_bootconfig 108 0 || exit 1
+
+ board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
+ board_dir=${board_dir%/}
+
+ echo "Flashing kernel to ${kernel_dev}"
+ tar xf $tar_file ${board_dir}/kernel -O > $kernel_dev
+
+ echo "Flashing rootfs to ${rootfs_dev}"
+ tar xf $tar_file ${board_dir}/root -O > $rootfs_dev
+
+ echo "Format new rootfs_data"
+ mkfs.ext4 -F -L rootfs_data $rootfs_data_dev
+
+ if [ -e "$UPGRADE_BACKUP" ]; then
+ mkdir /tmp/new_root
+ mount -t ext4 $rootfs_data_dev /tmp/new_root && {
+ echo "Saving configurations to rootfs_data"
+ cp "$UPGRADE_BACKUP" "/tmp/new_root/$BACKUP_FILE"
+ umount /tmp/new_root
+ }
+ fi
+
+ echo "sysupgrade successful"
+
+ sync
+ umount -a
+ reboot -f
+}