redboot-fis.sh 842 B

12345678910111213141516171819202122232425262728293031
  1. platform_check_image_redboot_fis() {
  2. if [ "$(get_magic_word "$1")" != "7379" ]; then
  3. v "Unknown image format, aborting!"
  4. return 1
  5. else
  6. return 0
  7. fi
  8. }
  9. platform_do_upgrade_redboot_fis() {
  10. local append
  11. local sysup_file="$1"
  12. local kern_part="$2"
  13. if [ "$(get_magic_word "$sysup_file")" = "7379" ]; then
  14. local board_dir=$(tar tf $sysup_file | grep -m 1 '^sysupgrade-.*/$')
  15. [ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP"
  16. if grep -q "mtd1.*loader" /proc/mtd; then
  17. tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \
  18. mtd -r $append write - loader:firmware
  19. else
  20. local kern_length=$(tar xf $sysup_file ${board_dir}kernel -O | wc -c)
  21. tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \
  22. mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs
  23. fi
  24. fi
  25. }