2
go.mod
2
go.mod
@@ -4,9 +4,9 @@ go 1.16
|
||||
|
||||
require (
|
||||
git.sr.ht/~sircmpwn/getopt v0.0.0-20201218204720-9961a9c6298f
|
||||
github.com/BurntSushi/toml v0.4.0
|
||||
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e
|
||||
github.com/klauspost/compress v1.13.3 // indirect
|
||||
github.com/klauspost/pgzip v1.2.5
|
||||
github.com/pelletier/go-toml/v2 v2.0.0-beta.3
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
|
||||
)
|
||||
|
20
go.sum
20
go.sum
@@ -1,16 +1,5 @@
|
||||
git.sr.ht/~sircmpwn/getopt v0.0.0-20201218204720-9961a9c6298f h1:f5axCdaRzGDCihN3o1Lq0ydn0VlkhY+11G0JOyY5qss=
|
||||
git.sr.ht/~sircmpwn/getopt v0.0.0-20201218204720-9961a9c6298f/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw=
|
||||
github.com/BurntSushi/toml v0.3.2-0.20210614224209-34d990aa228d/go.mod h1:2QZjSXA5e+XyFeCAxxtL8Z4StYUsTquL8ODGPR3C3MA=
|
||||
github.com/BurntSushi/toml v0.3.2-0.20210621044154-20a94d639b8e/go.mod h1:t4zg8TkHfP16Vb3x4WKIw7zVYMit5QFtPEO8lOWxzTg=
|
||||
github.com/BurntSushi/toml v0.3.2-0.20210624061728-01bfc69d1057/go.mod h1:NMj2lD5LfMqcE0w8tnqOsH6944oaqpI1974lrIwerfE=
|
||||
github.com/BurntSushi/toml v0.3.2-0.20210704081116-ccff24ee4463/go.mod h1:EkRrMiQQmfxK6kIldz3QbPlhmVkrjW1RDJUnbDqGYvc=
|
||||
github.com/BurntSushi/toml v0.4.0 h1:qD/r9AL67srjW6O3fcSKZDsXqzBNX6ieSRywr2hRrdE=
|
||||
github.com/BurntSushi/toml v0.4.0/go.mod h1:wtejDu7Q0FhCWAo2aXkywSJyYFg01EDTKozLNCz2JBA=
|
||||
github.com/BurntSushi/toml-test v0.1.1-0.20210620192437-de01089bbf76/go.mod h1:P/PrhmZ37t5llHfDuiouWXtFgqOoQ12SAh9j6EjrBR4=
|
||||
github.com/BurntSushi/toml-test v0.1.1-0.20210624055653-1f6389604dc6/go.mod h1:UAIt+Eo8itMZAAgImXkPGDMYsT1SsJkVdB5TuONl86A=
|
||||
github.com/BurntSushi/toml-test v0.1.1-0.20210704062846-269931e74e3f/go.mod h1:fnFWrIwqgHsEjVsW3RYCJmDo86oq9eiJ9u6bnqhtm2g=
|
||||
github.com/BurntSushi/toml-test v0.1.1-0.20210723065233-facb9eccd4da h1:2QGUaQtV2u8V1USTI883wo+uxtZFAiZ4TCNupHJ98IU=
|
||||
github.com/BurntSushi/toml-test v0.1.1-0.20210723065233-facb9eccd4da/go.mod h1:ve9Q/RRu2vHi42LocPLNvagxuUJh993/95b18bw/Nws=
|
||||
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e h1:hHg27A0RSSp2Om9lubZpiMgVbvn39bsUmW9U5h0twqc=
|
||||
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e/go.mod h1:oDpT4efm8tSYHXV5tHSdRvBet/b/QzxZ+XyyPehvm3A=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
@@ -20,11 +9,16 @@ github.com/klauspost/compress v1.13.3 h1:BtAvtV1+h0YwSVwWoYXMREPpYu9VzTJ9QDI1TEg
|
||||
github.com/klauspost/compress v1.13.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
|
||||
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
||||
github.com/pelletier/go-toml/v2 v2.0.0-beta.3 h1:PNCTU4naEJ8mKal97P3A2qDU74QRQGlv4FXiL1XDqi4=
|
||||
github.com/pelletier/go-toml/v2 v2.0.0-beta.3/go.mod h1:aNseLYu/uKskg0zpr/kbr2z8yGuWtotWf/0BpGIAL2Y=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942 h1:t0lM6y/M5IiUZyvbBTcngso8SZEZICH7is9B6g/obVU=
|
||||
github.com/stretchr/testify v1.7.1-0.20210427113832-6241f9ab9942/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
zgo.at/zli v0.0.0-20210619044753-e7020a328e59/go.mod h1:HLAc12TjNGT+VRXr76JnsNE3pbooQtwKWhX+RlDjQ2Y=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
6
main.go
6
main.go
@@ -360,13 +360,13 @@ func getFdeFiles(files misc.StringSet, devinfo deviceinfo.DeviceInfo) error {
|
||||
}
|
||||
|
||||
// mesa hw accel
|
||||
if devinfo.Deviceinfo_mesa_driver != "" {
|
||||
if devinfo.MesaDriver != "" {
|
||||
mesaFiles := misc.StringSet{
|
||||
"/usr/lib/libEGL.so.1": false,
|
||||
"/usr/lib/libGLESv2.so.2": false,
|
||||
"/usr/lib/libgbm.so.1": false,
|
||||
"/usr/lib/libudev.so.1": false,
|
||||
"/usr/lib/xorg/modules/dri/" + devinfo.Deviceinfo_mesa_driver + "_dri.so": false,
|
||||
"/usr/lib/xorg/modules/dri/" + devinfo.MesaDriver + "_dri.so": false,
|
||||
}
|
||||
if err := getFiles(files, mesaFiles, true); err != nil {
|
||||
return err
|
||||
@@ -489,7 +489,7 @@ func getInitfsModules(files misc.StringSet, devinfo deviceinfo.DeviceInfo, kerne
|
||||
}
|
||||
|
||||
// deviceinfo modules
|
||||
for _, module := range strings.Fields(devinfo.Deviceinfo_modules_initfs) {
|
||||
for _, module := range strings.Fields(devinfo.ModulesInitfs) {
|
||||
if err := getModule(files, module, modDir); err != nil {
|
||||
log.Print("Unable to get modules from deviceinfo")
|
||||
return err
|
||||
|
@@ -5,37 +5,37 @@ package deviceinfo
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/BurntSushi/toml"
|
||||
toml "github.com/pelletier/go-toml/v2"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Note: fields must be exported (start with capital letter)
|
||||
// https://github.com/BurntSushi/toml/issues/121
|
||||
type DeviceInfo struct {
|
||||
Deviceinfo_append_dtb string
|
||||
Deviceinfo_arch string
|
||||
Deviceinfo_bootimg_append_seandroidenforce string
|
||||
Deviceinfo_bootimg_blobpack string
|
||||
Deviceinfo_bootimg_dtb_second string
|
||||
Deviceinfo_bootimg_mtk_mkimage string
|
||||
Deviceinfo_bootimg_pxa string
|
||||
Deviceinfo_bootimg_qcdt string
|
||||
Deviceinfo_dtb string
|
||||
Deviceinfo_flash_offset_base string
|
||||
Deviceinfo_flash_offset_kernel string
|
||||
Deviceinfo_flash_offset_ramdisk string
|
||||
Deviceinfo_flash_offset_second string
|
||||
Deviceinfo_flash_offset_tags string
|
||||
Deviceinfo_flash_pagesize string
|
||||
Deviceinfo_generate_bootimg string
|
||||
Deviceinfo_generate_legacy_uboot_initfs string
|
||||
Deviceinfo_mesa_driver string
|
||||
Deviceinfo_mkinitfs_postprocess string
|
||||
Deviceinfo_initfs_compression string
|
||||
Deviceinfo_kernel_cmdline string
|
||||
Deviceinfo_legacy_uboot_load_address string
|
||||
Deviceinfo_modules_initfs string
|
||||
Deviceinfo_flash_kernel_on_update string
|
||||
AppendDtb string `toml:"deviceinfo_append_dtb"`
|
||||
Arch string `toml:"deviceinfo_arch"`
|
||||
BootimgAppendSEAndroidEnforce string `toml:"deviceinfo_bootimg_append_seandroidenforce"`
|
||||
BootimgBlobpack string `toml:"deviceinfo_bootimg_blobpack"`
|
||||
BootimgDtbSecond string `toml:"deviceinfo_bootimg_dtb_second"`
|
||||
BootimgMtkMkimage string `toml:"deviceinfo_bootimg_mtk_mkimage"`
|
||||
BootimgPxa string `toml:"deviceinfo_bootimg_pxa"`
|
||||
BootimgQcdt string `toml:"deviceinfo_bootimg_qcdt"`
|
||||
Dtb string `toml:"deviceinfo_dtb"`
|
||||
FlashKernelOnUpdate string `toml:"deviceinfo_flash_kernel_on_update"`
|
||||
FlashOffsetBase string `toml:"deviceinfo_flash_offset_base"`
|
||||
FlashOffsetKernel string `toml:"deviceinfo_flash_offset_kernel"`
|
||||
FlashOffsetRamdisk string `toml:"deviceinfo_flash_offset_ramdisk"`
|
||||
FlashOffsetSecond string `toml:"deviceinfo_flash_offset_second"`
|
||||
FlashOffsetTags string `toml:"deviceinfo_flash_offset_tags"`
|
||||
FlashPagesize string `toml:"deviceinfo_flash_pagesize"`
|
||||
GenerateBootimg string `toml:"deviceinfo_generate_bootimg"`
|
||||
GenerateLegacyUbootInitfs string `toml:"deviceinfo_generate_legacy_uboot_initfs"`
|
||||
InitfsCompression string `toml:"deviceinfo_initfs_compression"`
|
||||
KernelCmdline string `toml:"deviceinfo_kernel_cmdline"`
|
||||
LegacyUbootLoadAddress string `toml:"deviceinfo_legacy_uboot_load_address"`
|
||||
MesaDriver string `toml:"deviceinfo_mesa_driver"`
|
||||
MkinitfsPostprocess string `toml:"deviceinfo_mkinitfs_postprocess"`
|
||||
ModulesInitfs string `toml:"deviceinfo_modules_initfs"`
|
||||
}
|
||||
|
||||
func ReadDeviceinfo() (DeviceInfo, error) {
|
||||
@@ -47,8 +47,16 @@ func ReadDeviceinfo() (DeviceInfo, error) {
|
||||
return deviceinfo, errors.New("Unable to find deviceinfo: " + file)
|
||||
}
|
||||
|
||||
if _, err := toml.DecodeFile(file, &deviceinfo); err != nil {
|
||||
fd, err := os.Open(file)
|
||||
if err != nil {
|
||||
return deviceinfo, err
|
||||
}
|
||||
defer fd.Close()
|
||||
// contents,_ := toml.LoadFile(file)
|
||||
decoder := toml.NewDecoder(fd)
|
||||
if err := decoder.Decode(&deviceinfo); err != nil {
|
||||
return deviceinfo, err
|
||||
}
|
||||
|
||||
return deviceinfo, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user