fixed remount of uboot partition
This commit is contained in:
parent
1367005eee
commit
710ff5b186
@ -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)
|
||||||
|
@ -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"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user