2 REQUIRE_IMAGE_METADATA
=0
4 platform_check_image
() {
5 [ "$#" -gt 1 ] && return 1
7 case "$(board_name)" in
18 case "$(get_magic_word "$1")" in
24 echo "Invalid image type. Please use only .bin files"
30 cfe_jffs2_upgrade_tar
() {
32 local kernel_mtd
="$(find_mtd_index $CI_KERNPART)"
34 if [ -z "$kernel_mtd" ]; then
35 echo "$CI_KERNPART partition not found"
39 local board_dir
=$
(tar tf
$tar_file |
grep -m 1 '^sysupgrade-.*/$')
40 board_dir
=${board_dir%/}
42 local kernel_length
=$
(tar xf
$tar_file ${board_dir}/kernel
-O |
wc -c 2> /dev
/null
)
43 local rootfs_length
=$
(tar xf
$tar_file ${board_dir}/root
-O |
wc -c 2> /dev
/null
)
45 if [ "$kernel_length" = 0 ]; then
46 echo "kernel cannot be empty"
50 flash_erase
-j /dev
/mtd
${kernel_mtd} 0 0
51 tar xf
$tar_file ${board_dir}/kernel
-O | nandwrite
/dev
/mtd
${kernel_mtd} -
53 local rootfs_type
="$(identify_tar "$tar_file" ${board_dir}/root)"
55 nand_upgrade_prepare_ubi
"$rootfs_length" "$rootfs_type" "0" "0"
57 local ubidev
="$( nand_find_ubi "$CI_UBIPART" )"
59 local root_ubivol
="$(nand_find_volume $ubidev $CI_ROOTPART)"
60 tar xf
$tar_file ${board_dir}/root
-O | \
61 ubiupdatevol
/dev
/$root_ubivol -s $rootfs_length -
63 nand_do_upgrade_success
66 platform_do_upgrade
() {
67 case "$(board_name)" in
73 REQUIRE_IMAGE_METADATA
=1
74 cfe_jffs2_upgrade_tar
"$1"
77 default_do_upgrade
"$1"