Skip to content

mvo5/uboot-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Read/write uboot environment

Small go package/app to read/write uboot env files that contain crc32 + 1 byte padding. Unlike fw_{set,print}env it does not needs a /etc/fw_env.config config file.

Example of the API:

package main

import (
	"fmt"
	"github.com/mvo5/uboot-go/uenv"
	"os"
)

func main() {
	env, _ := uenv.Open(os.Args[1])
	fmt.Print(env)
	env.Set("foo", "bar")
	fmt.Print(env)
}

Example of the cmdline app for existing files:

$ uboot-go uboot.env print
initrd_addr=0x88080000
uenvcmd=load mmc ${bootpart} ${loadaddr} snappy-system.txt; env import -t $loadaddr $filesize; run snappy_boot
bootpart=0:1

$ uboot-go uboot.env set key value
$ uboot-go uboot.env print
initrd_addr=0x88080000
uenvcmd=load mmc ${bootpart} ${loadaddr} snappy-system.txt; env import -t $loadaddr $filesize; run snappy_boot
bootpart=0:1
key=value

# echo "$(pwd)/uboot.env 0x000 0x20000" > /etc/fw_env.config
$ fw_printenv
initrd_addr=0x88080000
uenvcmd=load mmc ${bootpart} ${loadaddr} snappy-system.txt; env import -t $loadaddr $filesize; run snappy_boot
bootpart=0:1
key=value

Example of the cmdline app for creating new env files:

$ uboot-go uboot.env create 4096
$ uboot-go uboot.env set foo bar
$ uboot-go uboot.env print
foo=bar

About

Read uboot environment via go

Resources

License

Stars

Watchers

Forks

Packages

No packages published