2 # Copyright 2015-2019 Traverse Technologies
9 REQUIRE_IMAGE_METADATA
=1
11 platform_do_upgrade_sdboot
() {
12 local diskdev partdev parttype
=ext4
14 local board_dir
=$
(tar tf
$tar_file |
grep -m 1 '^sysupgrade-.*/$')
15 board_dir
=${board_dir%/}
17 export_bootdevice
&& export_partdevice diskdev
0 ||
{
18 echo "Unable to determine upgrade device"
22 if export_partdevice partdev
1; then
23 mount
-t $parttype -o rw
,noatime
"/dev/$partdev" /mnt
2>&1
24 echo "Writing kernel..."
25 tar xf
$tar_file ${board_dir}/kernel
-O > /mnt
/fitImage
29 echo "Erasing rootfs..."
30 dd if=/dev
/zero of
=/dev
/mmcblk0p2 bs
=1M
> /dev
/null
2>&1
31 echo "Writing rootfs..."
32 tar xf
$tar_file ${board_dir}/root
-O |
dd of
=/dev
/mmcblk0p2 bs
=512k
> /dev
/null
2>&1
36 platform_do_upgrade_traverse_slotubi
() {
37 part
="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')"
38 echo "Active boot slot: ${part}"
41 if [ ! -z "${part}" ]; then
42 if [ "${part}" = "ubia" ]; then
49 echo "Updating UBI part ${CI_UBIPART}"
50 fw_setenv
"openwrt_active_sys" "${new_active_sys}"
55 platform_copy_config_sdboot
() {
56 local diskdev partdev parttype
=ext4
58 export_bootdevice
&& export_partdevice diskdev
0 ||
{
59 echo "Unable to determine upgrade device"
63 if export_partdevice partdev
1; then
64 mount
-t $parttype -o rw
,noatime
"/dev/$partdev" /mnt
2>&1
65 echo "Saving config backup..."
66 cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
70 platform_copy_config
() {
71 local board
=$
(board_name
)
74 fsl
,ls1012a-frwy-sdboot | \
75 fsl
,ls1021a-iot-sdboot | \
76 fsl
,ls1021a-twr-sdboot | \
77 fsl
,ls1028a-rdb-sdboot | \
78 fsl
,ls1043a-rdb-sdboot | \
79 fsl
,ls1046a-frwy-sdboot | \
80 fsl
,ls1046a-rdb-sdboot | \
81 fsl
,ls1088a-rdb-sdboot | \
82 fsl
,lx2160a-rdb-sdboot
)
83 platform_copy_config_sdboot
87 platform_check_image
() {
88 local board
=$
(board_name
)
92 nand_do_platform_check
"ten64-mtd" $1
96 fsl
,ls1012a-frwy-sdboot | \
98 fsl
,ls1021a-iot-sdboot | \
100 fsl
,ls1021a-twr-sdboot | \
102 fsl
,ls1028a-rdb-sdboot | \
104 fsl
,ls1043a-rdb-sdboot | \
106 fsl
,ls1046a-frwy-sdboot | \
108 fsl
,ls1046a-rdb-sdboot | \
110 fsl
,ls1088a-rdb-sdboot | \
113 fsl
,lx2160a-rdb-sdboot
)
117 echo "Sysupgrade is not currently supported on $board"
123 platform_do_upgrade
() {
124 local board
=$
(board_name
)
126 # Force the creation of fw_printenv.lock
128 touch /var
/lock
/fw_printenv.lock
132 platform_do_upgrade_traverse_slotubi
"${1}"
145 default_do_upgrade
"$1"
147 fsl
,ls1012a-frwy-sdboot | \
148 fsl
,ls1021a-iot-sdboot | \
149 fsl
,ls1021a-twr-sdboot | \
150 fsl
,ls1028a-rdb-sdboot | \
151 fsl
,ls1043a-rdb-sdboot | \
152 fsl
,ls1046a-frwy-sdboot | \
153 fsl
,ls1046a-rdb-sdboot | \
154 fsl
,ls1088a-rdb-sdboot | \
155 fsl
,lx2160a-rdb-sdboot
)
156 platform_do_upgrade_sdboot
"$1"
160 echo "Sysupgrade is not currently supported on $board"