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
3 changes: 3 additions & 0 deletions package/boot/uboot-envtools/files/ipq50xx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ touch /etc/config/ubootenv

board=$(board_name)
case "$board" in
cmcc,pz-l8)
ubootenv_add_uci_config "/dev/mtd10" "0x0" "0x40000" "0x20000"
;;
cmcc,rax3000q|\
redmi,ax3000|\
xiaomi,cr881x)
Expand Down
2 changes: 2 additions & 0 deletions package/firmware/ipq-wifi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ endef

ALLWIFIBOARDS:= \
buffalo_wxr-5950ax12 \
cmcc_pz-l8 \
cmcc_rax3000q \
compex_wpq873 \
dynalink_dl-wrx36 \
Expand Down Expand Up @@ -125,6 +126,7 @@ endef
# Add $(eval $(call generate-ipq-wifi-package,<devicename>,<display name>))

$(eval $(call generate-ipq-wifi-package,buffalo_wxr-5950ax12,Buffalo WXR-5950AX12))
$(eval $(call generate-ipq-wifi-package,cmcc_pz-l8,CMCC PZ-L8))
$(eval $(call generate-ipq-wifi-package,cmcc_rax3000q,CMCC RAX3000Q))
$(eval $(call generate-ipq-wifi-package,compex_wpq873,Compex WPQ-873))
$(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36))
Expand Down
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions target/linux/ipq50xx/base-files/etc/board.d/01_leds
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ board_config_update
board=$(board_name)

case $board in
cmcc,pz-l8)
ucidef_set_led_switch "wan" "WAN" "green:internet" "switch1" "$( bits 4 )"
;;
redmi,ax3000)
ucidef_set_led_switch "wan" "WAN" "blue:internet" "switch1" "$( bits 4 )"
;;
Expand Down
6 changes: 6 additions & 0 deletions target/linux/ipq50xx/base-files/etc/board.d/02_network
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ ipq50xx_setup_interfaces()
{
local board="$1"
case $board in
cmcc,pz-l8)
ucidef_add_switch "switch1" \
"6u@eth1" "5u@eth0" \
"3:lan:1" "2:lan:2" "1:lan:3" \
"4:wan"
;;
redmi,ax3000)
ucidef_add_switch "switch1" \
"6u@eth1" "5u@eth0" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ board=$(board_name)
case "$FIRMWARE" in
"ath11k/IPQ5018/hw1.0/caldata.bin")
case "$board" in
cmcc,pz-l8|\
cmcc,rax3000q|\
redmi,ax3000|\
xiaomi,cr881x)
Expand All @@ -18,6 +19,7 @@ case "$FIRMWARE" in
;;
"ath11k/qcn6122/hw1.0/caldata_1.bin")
case "$board" in
cmcc,pz-l8|\
cmcc,rax3000q|\
redmi,ax3000|\
xiaomi,cr881x)
Expand Down
119 changes: 119 additions & 0 deletions target/linux/ipq50xx/base-files/lib/upgrade/elecom.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
. /lib/functions.sh

bootconfig_find_entry() {
local cfgbin="$1"
local partname="$2"
local i part parts offset

parts=$(hexdump -n 4 -s 8 -e '1/4 "%d"' "$cfgbin")
# partition count: <= 10
[ -z "$parts" ] || [ "$parts" = "0" ] || [ "$parts" -gt "10" ] && \
return 1

for i in $(seq 1 $parts); do
offset=$((0xc + 0x14 * (i - 1)))
part=$(dd if="$cfgbin" iflag=skip_bytes \
skip=$offset bs=16 count=1 2>/dev/null)
if [ "$part" = "$partname" ]; then
printf "0x%08x" $offset
return
fi
done

return 1
}

# Read or update an entry in Qualcomm bootconfig partition
#
# parameters:
# $1: partition name of bootconfig (ex.: "0:bootconfig", "0:bootconfig1", etc)
# $2: entry name in bootconfig (ex.: "0:hlos", "rootfs", etc)
# $3: index to set for the entry (0/1)
#
# operations:
# read : bootconfig_rw_index <bootconfig> <entry>
# write: bootconfig_rw_index <bootconfig> <entry> <index>
bootconfig_rw_index() {
local bootcfg="$1"
local partname="$2"
local index="$3"
local mtddev
local offset
local current

if [ -z "$bootcfg" ] || [ -z "$partname" ]; then
echo "no value specified for bootconfig or partition entry"
return 1
fi

case "$index" in
0|1|"") ;;
*) echo "invalid bootconfig index specified \"$index\""; return 1 ;;
esac

mtddev="$(find_mtd_part $bootcfg)"
[ -z "$mtddev" ] && \
return 1

dd if=$mtddev of=/tmp/${mtddev##*/} bs=1k

offset=$(bootconfig_find_entry "/tmp/${mtddev##*/}" $partname) || return 1
current=$(hexdump -n 4 -s $((offset + 0x10)) -e '1/4 "%d"' /tmp/${mtddev##*/})

[ -z "$index" ] && \
echo "$current" && return 0

if [ "$current" != "$index" ]; then
printf "\x$index" | \
dd of=$mtddev conv=notrunc bs=1 seek=$((offset + 0x10))
fi
}

# Qcom U-Boot always sets a name of current active partition to "rootfs" and
# inactive partition is named as "rootfs_1", in the smem partition table.
# When the second partition is active, "rootfs" and "rootfs_1" are swapped.
smempart_next_root() {
local index="$1"
local root_idx="$(find_mtd_index rootfs)"
local root1_idx="$(find_mtd_index rootfs_1)"
local root_offset root1_offset

[ -z "$root_idx" ] || [ -z "$root1_idx" ] && \
return 1

root_offset=$(cat /sys/block/mtdblock$root_idx/device/offset)
root1_offset=$(cat /sys/block/mtdblock$root1_idx/device/offset)

case "$index" in
0)
[ "$root_offset" -lt "$root1_offset" ] && \
echo "rootfs" || \
echo "rootfs_1"
;;
1)
[ "$root_offset" -lt "$root1_offset" ] && \
echo "rootfs_1" || \
echo "rootfs"
;;
*)
echo "invalid index specified..."
return 1
;;
esac
}

elecom_upgrade_prepare() {
local index

if ! index=$(bootconfig_rw_index "0:BOOTCONFIG" rootfs); then
v "failed to read bootconfig index..."
nand_do_upgrade_failed
fi

if ! CI_UBIPART=$(smempart_next_root $index); then
v "failed to get next root..."
nand_do_upgrade_failed
fi

v "next rootfs: $index (current: $CI_UBIPART)"
}
44 changes: 43 additions & 1 deletion target/linux/ipq50xx/base-files/lib/upgrade/platform.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
. /lib/functions.sh

RAMFS_COPY_BIN='fw_printenv fw_setenv'
#RAMFS_COPY_BIN='fw_printenv fw_setenv'
RAMFS_COPY_BIN='dumpimage fw_printenv fw_setenv head seq'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'

remove_oem_ubi_volume() {
local oem_volume_name="$1"
local oem_ubivol
local mtdnum
local ubidev

mtdnum=$(find_mtd_index "$CI_UBIPART")
if [ ! "$mtdnum" ]; then
return
fi

ubidev=$(nand_find_ubi "$CI_UBIPART")
if [ ! "$ubidev" ]; then
ubiattach --mtdn="$mtdnum"
ubidev=$(nand_find_ubi "$CI_UBIPART")
fi

if [ "$ubidev" ]; then
oem_ubivol=$(nand_find_volume "$ubidev" "$oem_volume_name")
[ "$oem_ubivol" ] && ubirmvol "/dev/$ubidev" --name="$oem_volume_name"
fi
}


platform_check_image() {
local board=$(board_name)
case $board in
Expand All @@ -11,6 +36,9 @@ platform_check_image() {
mi_dualboot_check_image "$1"
return $?
;;
cmcc,pz-l8)
return 0;
;;
*)
v "Sysupgrade is not supported on your board($board) yet."
return 1
Expand All @@ -21,6 +49,20 @@ platform_check_image() {
platform_do_upgrade() {
local board=$(board_name)
case $board in
cmcc,pz-l8)
local delay

delay=$(fw_printenv bootdelay)
[ -z "$delay" ] || [ "$delay" -eq "0" ] && \
fw_setenv bootdelay 3

elecom_upgrade_prepare

remove_oem_ubi_volume bt_fw
remove_oem_ubi_volume ubi_rootfs
remove_oem_ubi_volume wifi_fw
nand_do_upgrade "$1"
;;
redmi,ax3000|\
xiaomi,cr881x)
mi_dualboot_do_upgrade "$1"
Expand Down
Loading