pastebin - collaborative debugging tool
eckelmann.kpaste.net RSS


quantron: do not format nand0.var if it is already UBIFS
Posted by Anonymous on Mon 13th May 2019 16:02
raw | new post

  1. diff --git a/ptxdist/configs/ecu01/barebox-defaultenv-2/bin/usb_update_rootfs b/ptxdist/configs/ecu01/barebox-defaultenv-2/bin/usb_update_rootfs
  2. index 58cf64b..00736bb 100755
  3. --- a/ptxdist/configs/ecu01/barebox-defaultenv-2/bin/usb_update_rootfs
  4. +++ b/ptxdist/configs/ecu01/barebox-defaultenv-2/bin/usb_update_rootfs
  5. @@ -12,12 +12,43 @@ if [ -e ${image} ]; then
  6.         splash -x 23 -y 159 /env/assets/panel_update.png
  7.      fi
  8.  
  9. +    #
  10. +    # Test whether /var/nand0.var contains a valid, mountable
  11. +    # UBI filesystem.
  12. +    #
  13. +    # If the filesystem cannot be mounted we format the nand0.var
  14. +    # partition below (this code is messy, but there seems to be no
  15. +    # other way in barebox)
  16. +    #
  17. +    do_format_ubi_var=1
  18. +    ubiattach -O 2048 /dev/nand0.var
  19. +    if [ $? -eq 0 ] ; then
  20. +        if [ -c /dev/nand0.var.ubi.dyn ] ; then
  21. +           echo "# Note: var.dyn contains data."
  22. +           do_format_ubi_var=0
  23. +       fi
  24. +        ubidetach /dev/nand0.var
  25. +    fi
  26. +
  27.      umount /dev/nand0.root.ubi.root
  28.      ubidetach /dev/nand0.root
  29. +
  30. +    formatting_successful=1
  31.      ubiformat -O 2048 -y /dev/nand0.root -f ${image}
  32. -    ubiformat -O 2048 -y /dev/nand0.var
  33. +    if [ $? -ne 0 ] ; then
  34. +        formatting_successful=0
  35. +    fi
  36. +  
  37. +    if [ $do_format_ubi_var -eq 1 ] ; then
  38. +        ubiformat -O 2048 -y /dev/nand0.var
  39. +        if [ $? -ne 0 ] ; then
  40. +            formatting_successful=0
  41. +        fi
  42. +    else
  43. +        echo "## ubi.var contains data, skipping format of /dev/nand0.var."
  44. +    fi
  45.  
  46. -    if [ $? -eq 0 ] ; then
  47. +    if [ $formatting_successful -eq 1 ] ; then
  48.          echo "usb_update_rootfs: OK"
  49.         exit 0
  50.      else
  51. diff --git a/ptxdist/local_src/backup-etc/lib/systemd/system/backup-etc.service b/ptxdist/local_src/backup-etc/lib/systemd/system/backup-etc.service
  52. index 78a6128..a7d8644 100755
  53. --- a/ptxdist/local_src/backup-etc/lib/systemd/system/backup-etc.service
  54. +++ b/ptxdist/local_src/backup-etc/lib/systemd/system/backup-etc.service
  55. @@ -1,6 +1,8 @@
  56.  [Unit]
  57.  Description=Backup service for configuration in /etc
  58. -Requires=local-fs.target
  59. +# /etc/backup-etc.conf requires /var/dyn
  60. +Requires=local-fs.target var-dyn.mount var-stat.mount
  61. +After=local-fs.target var-dyn.mount var-stat.mount
  62.  
  63.  [Service]
  64.  Restart=always
  65. diff --git a/ptxdist/local_src/ecu01-basicsys/sbin/check_ubi_partitions b/ptxdist/local_src/ecu01-basicsys/sbin/check_ubi_partitions
  66. index 9bebc40..38b02a5 100755
  67. --- a/ptxdist/local_src/ecu01-basicsys/sbin/check_ubi_partitions
  68. +++ b/ptxdist/local_src/ecu01-basicsys/sbin/check_ubi_partitions
  69. @@ -1,11 +1,33 @@
  70.  #!/bin/bash
  71.  
  72. -
  73. +command exec >/dev/console 2>&1
  74.  
  75.  if [ ! -c /dev/ubi1_0 ]; then
  76. -    ubimkvol /dev/ubi1 -N dyn -s 15000000    
  77. +       echo
  78. +       echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
  79. +       echo '@@@@ ----> Formatting /dev/ubi1 dyn <---- @@'
  80. +       echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
  81. +       echo
  82. +       ubimkvol /dev/ubi1 -N dyn -s 15000000
  83. +else
  84. +       echo
  85. +       echo '============================================'
  86. +       echo '= ---> No need to format /dev/ubi1 dyn <-- ='
  87. +       echo '============================================'
  88. +       echo
  89.  fi
  90.  
  91.  if [ ! -c /dev/ubi1_1 ]; then
  92. -    ubimkvol /dev/ubi1 -N stat -s 15000000
  93. +       echo
  94. +       echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
  95. +       echo '@@@@ ----> Formatting /dev/ubi1 stat <----@@'
  96. +       echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
  97. +       echo
  98. +       ubimkvol /dev/ubi1 -N stat -s 15000000
  99. +else
  100. +       echo
  101. +       echo '============================================'
  102. +       echo '=---> No need to format /dev/ubi1 stat <-- ='
  103. +       echo '============================================'
  104. +       echo
  105.  fi
  106. diff --git a/ptxdist/projectroot/lib/systemd/system/codesys3-rt.service b/ptxdist/projectroot/lib/systemd/system/codesys3-rt.service
  107. index 57b3e16..fe11e87 100644
  108. --- a/ptxdist/projectroot/lib/systemd/system/codesys3-rt.service
  109. +++ b/ptxdist/projectroot/lib/systemd/system/codesys3-rt.service
  110. @@ -4,10 +4,10 @@ Description=CoDeSys 3 runtime
  111.  # other stuff like logins&co are ready
  112.  # - we cannot use application.target here since it causes a dependicy loop
  113.  # - getty.target is required so we wait until all logins are active,
  114. -# including those using the serial lines, before we start cdesyscontrol,
  115. +# including those using the serial lines, before we start codesyscontrol,
  116.  # which itself might mess with the serial lines
  117. -After=basic.target local-fs.target multi-user.target getty.target
  118. -Requires=systemd-modules-load.service ubi-check-partitions.service
  119. +After=basic.target local-fs.target multi-user.target getty.target var-dyn.mount var-stat.mount
  120. +Requires=systemd-modules-load.service ubi-check-partitions.service var-dyn.mount var-stat.mount
  121.  Conflicts=testing.target emvtest.target maintenance.target
  122.  
  123.  [Service]

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at