4
0
Fork 0

fixed remount of uboot partition

This commit is contained in:
Benjamin Böhmke 2019-12-15 16:55:18 +01:00
parent 1367005eee
commit 710ff5b186
2 changed files with 6 additions and 6 deletions

View File

@ -13,9 +13,10 @@ import (
"os/exec" "os/exec"
) )
var mountCommand = "mount"
var ubootFile = "/uboot/uboot.dat" var ubootFile = "/uboot/uboot.dat"
var ubootRemountRW = "mount -o remount,rw /uboot" var ubootRemountRW = []string{"-o", "remount,rw", "/uboot"}
var ubootRemountRO = "mount -o remount,ro /uboot" var ubootRemountRO = []string{"-o", "remount,ro", "/uboot"}
var rootPartitionA = "/dev/mmcblk0p2" var rootPartitionA = "/dev/mmcblk0p2"
var rootPartitionB = "/dev/mmcblk0p3" var rootPartitionB = "/dev/mmcblk0p3"
@ -53,7 +54,7 @@ func saveUbootDat(data []byte) error {
crc32.ChecksumIEEE(data[:1020])) crc32.ChecksumIEEE(data[:1020]))
// remount boot partition - writable // remount boot partition - writable
cmd := exec.Command(ubootRemountRW) cmd := exec.Command(mountCommand, ubootRemountRW...)
err := cmd.Run() err := cmd.Run()
if err != nil { if err != nil {
return fmt.Errorf("failed to remount RW: %w", err) return fmt.Errorf("failed to remount RW: %w", err)
@ -66,7 +67,7 @@ func saveUbootDat(data []byte) error {
} }
// remount boot partition - readonly // remount boot partition - readonly
cmd = exec.Command(ubootRemountRO) cmd = exec.Command(mountCommand, ubootRemountRO...)
err = cmd.Run() err = cmd.Run()
if err != nil { if err != nil {
return fmt.Errorf("failed to remount RO: %w", err) return fmt.Errorf("failed to remount RO: %w", err)

View File

@ -15,8 +15,7 @@ import (
func init() { func init() {
ubootFile = "test_uboot" ubootFile = "test_uboot"
ubootRemountRW = "true" mountCommand = "true"
ubootRemountRO = "true"
rootPartitionA = "test_rootA" rootPartitionA = "test_rootA"
rootPartitionB = "test_rootB" rootPartitionB = "test_rootB"
} }