platform.sh 930 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. PART_NAME=firmware
  2. REQUIRE_IMAGE_METADATA=1
  3. RAMFS_COPY_BIN='fw_printenv fw_setenv'
  4. RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
  5. # The TP-Link bootloader gets its flash layout from "bootargs".
  6. # Use this to our advantage, and:
  7. # 1. Disable the second rootfs (usrimg2)
  8. # 2. Extend the first rootfs (usrimg1) to include more space
  9. # 3. Increase the baudrate to the expected 115200
  10. tplink_sg2xxx_fix_mtdparts() {
  11. local args
  12. args="bootargs mtdparts=spi_flash:896K(boot),128K(env),6144K(sys)"
  13. args="$args,20480K(usrimg1@main),0K(usrimg2)"
  14. args="$args,4096K(usrappfs),1024K(para)\n"
  15. args="$args baudrate 115200"
  16. echo -e "$args" | fw_setenv --script -
  17. }
  18. platform_check_image() {
  19. return 0
  20. }
  21. platform_do_upgrade() {
  22. local board=$(board_name)
  23. case "$board" in
  24. tplink,sg2008p-v1|\
  25. tplink,sg2210p-v3)
  26. tplink_sg2xxx_fix_mtdparts
  27. default_do_upgrade "$1"
  28. ;;
  29. *)
  30. default_do_upgrade "$1"
  31. ;;
  32. esac
  33. }