0116-mvebu-fix-sysupgrade.patch 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Thu, 1 Jun 2017 18:39:12 +0200
  3. Subject: mvebu: fix sysupgrade
  4. mvebu was modifying RAMFS_COPY_BIN and RAMFS_COPY_DATA from a
  5. sysupgrade_pre_upgrade hook. As the ramfs is created from stage2, this
  6. did not have an effect anymore after the staged sysupgrade changes.
  7. As it doesn't really hurt to copy fw_printenv and fw_setenv
  8. unconditionally, simply add them in /lib/upgrade/platform.sh, so stage2
  9. will see them.
  10. Config copying is moved to a function called by platform_copy_config, where
  11. it belongs.
  12. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
  13. Fixes: FS#821
  14. Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade"
  15. diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
  16. index cc8047d988e39ca9ba27d2588744aad469d1d978..bdbb8926643287f48a4ae62c5d1d4b4a29130859 100755
  17. --- a/package/base-files/files/lib/upgrade/stage2
  18. +++ b/package/base-files/files/lib/upgrade/stage2
  19. @@ -48,7 +48,7 @@ switch_to_ramfs() {
  20. /bin/sleep /bin/zcat /usr/bin/bzcat /usr/bin/printf /usr/bin/wc \
  21. /bin/cut /usr/bin/printf /bin/sync /bin/mkdir /bin/rmdir \
  22. /bin/rm /usr/bin/basename /bin/kill /bin/chmod /usr/bin/find \
  23. - /bin/mknod
  24. + /bin/mknod /bin/touch
  25. install_bin /sbin/mtd
  26. install_bin /sbin/mount_root
  27. diff --git a/target/linux/mvebu/base-files/lib/upgrade/linksys.sh b/target/linux/mvebu/base-files/lib/upgrade/linksys.sh
  28. index fc403332bd38fc521a056ab85783abd90629a1cf..63d1cd14a4deed407b217a518ae25a752f62969e 100644
  29. --- a/target/linux/mvebu/base-files/lib/upgrade/linksys.sh
  30. +++ b/target/linux/mvebu/base-files/lib/upgrade/linksys.sh
  31. @@ -73,14 +73,7 @@ platform_do_upgrade_linksys() {
  32. }
  33. }
  34. -linksys_preupgrade() {
  35. - export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/sbin/fw_printenv /usr/sbin/fw_setenv"
  36. - export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /bin/mkdir /bin/touch"
  37. - export RAMFS_COPY_DATA="${RAMFS_COPY_DATA} /etc/fw_env.config /var/lock/fw_printenv.lock"
  38. -
  39. - [ -f /tmp/sysupgrade.tgz ] && {
  40. - cp /tmp/sysupgrade.tgz /tmp/syscfg/sysupgrade.tgz
  41. - }
  42. +platform_copy_config_linksys() {
  43. + cp -f /tmp/sysupgrade.tgz /tmp/syscfg/sysupgrade.tgz
  44. + sync
  45. }
  46. -
  47. -append sysupgrade_pre_upgrade linksys_preupgrade
  48. diff --git a/target/linux/mvebu/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/base-files/lib/upgrade/platform.sh
  49. index 46b84435977b83d002ae766fe37c6459a55177ff..7465f7be7649f778ada62cf90aa94b16c11c7e34 100755
  50. --- a/target/linux/mvebu/base-files/lib/upgrade/platform.sh
  51. +++ b/target/linux/mvebu/base-files/lib/upgrade/platform.sh
  52. @@ -4,7 +4,8 @@
  53. . /lib/mvebu.sh
  54. -RAMFS_COPY_DATA=/lib/mvebu.sh
  55. +RAMFS_COPY_BIN='/usr/sbin/fw_printenv /usr/sbin/fw_setenv'
  56. +RAMFS_COPY_DATA='/lib/mvebu.sh /etc/fw_env.config /var/lock/fw_printenv.lock'
  57. platform_check_image() {
  58. local board=$(mvebu_board_name)
  59. @@ -39,6 +40,16 @@ platform_do_upgrade() {
  60. esac
  61. }
  62. +platform_copy_config() {
  63. + local board=$(mvebu_board_name)
  64. +
  65. + case "$board" in
  66. + armada-385-linksys-caiman|armada-385-linksys-cobra|armada-385-linksys-rango|armada-385-linksys-shelby|armada-xp-linksys-mamba)
  67. + platform_copy_config_linksys
  68. + ;;
  69. + esac
  70. +}
  71. +
  72. disable_watchdog() {
  73. killall watchdog
  74. ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {