main: read /usr/share/deviceinfo/deviceinfo in addition to /etc/deviceinfo (MR 37)
Relates https://gitlab.com/postmarketOS/pmaports/-/issues/1836 The error checking for the detection of both files is not ideal, but there are no obvious better solutions. For now, we want to avoid requiring one by default, since it allows this change to be forward compatible so not all MRs related to /usr/share have to go in at once. I followed the same pattern as in boot-deploy!29 although there we check for "deviceinfo_arch" to make sure that at least one of those files is complete. The other alternative would be to add an Arch field to DeviceInfo struct, and use it to check that at least one of the files was complete, and ignore any errors if it exists. Since this is not ideal either, keep the double test, and let's take care of fixes once one of them is compulsory.
This commit is contained in:
committed by
Clayton Craft
parent
c87b926a53
commit
b1e44d8ec2
@@ -50,8 +50,12 @@ func main() {
|
|||||||
log.Default().SetFlags(log.Lmicroseconds)
|
log.Default().SetFlags(log.Lmicroseconds)
|
||||||
|
|
||||||
var devinfo deviceinfo.DeviceInfo
|
var devinfo deviceinfo.DeviceInfo
|
||||||
if err := devinfo.ReadDeviceinfo("/etc/deviceinfo"); err != nil {
|
deverr_usr := devinfo.ReadDeviceinfo("/usr/share/deviceinfo/deviceinfo")
|
||||||
log.Println("Error reading deviceinfo:", err)
|
deverr_etc := devinfo.ReadDeviceinfo("/etc/deviceinfo")
|
||||||
|
if deverr_etc != nil && deverr_usr != nil {
|
||||||
|
log.Println("Error reading deviceinfo")
|
||||||
|
log.Println("\t/usr/share/deviceinfo/deviceinfo:", deverr_usr)
|
||||||
|
log.Println("\t/etc/deviceinfo:", deverr_etc)
|
||||||
retCode = 1
|
retCode = 1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,8 @@ Design goals of this project are:
|
|||||||
The canonical deviceinfo "specification" is at
|
The canonical deviceinfo "specification" is at
|
||||||
https://wiki.postmarketos.org/wiki/Deviceinfo_reference
|
https://wiki.postmarketos.org/wiki/Deviceinfo_reference
|
||||||
|
|
||||||
mkinitfs reads deviceinfo values from */etc/deviceinfo*. The following variables
|
mkinitfs reads deviceinfo values from */usr/share/deviceinfo/deviceinfo* and
|
||||||
|
*/etc/deviceinfo*, in that order. The following variables
|
||||||
are *required* by mkinitfs:
|
are *required* by mkinitfs:
|
||||||
|
|
||||||
- deviceinfo_initfs_compression
|
- deviceinfo_initfs_compression
|
||||||
@@ -63,7 +64,7 @@ it are for constructing the initramfs archive.
|
|||||||
|
|
||||||
Configuration under */usr/share/mkinitfs* is intended to be managed by
|
Configuration under */usr/share/mkinitfs* is intended to be managed by
|
||||||
distributions, while configuration under */etc/mkinitfs* is for users to
|
distributions, while configuration under */etc/mkinitfs* is for users to
|
||||||
create/manage. mkinitfs reads configuration from */usr/share/mkinitfs* first, and then from */etc/mkinitfs*.
|
create/manage. mkinitfs reads configuration from */usr/share/mkinitfs* first, and then from */etc/mkinitfs*.
|
||||||
|
|
||||||
## /usr/share/mkinitfs/files, /etc/mkinitfs/files
|
## /usr/share/mkinitfs/files, /etc/mkinitfs/files
|
||||||
## /usr/share/mkinitfs/files-extra, /etc/mkinitfs/files-extra
|
## /usr/share/mkinitfs/files-extra, /etc/mkinitfs/files-extra
|
||||||
@@ -136,7 +137,7 @@ search for the app. The following commandline options are passed to it:
|
|||||||
Currently this is hardcoded to be "initramfs"
|
Currently this is hardcoded to be "initramfs"
|
||||||
|
|
||||||
*-k* <kernel filename>
|
*-k* <kernel filename>
|
||||||
|
|
||||||
*-d* <work directory>
|
*-d* <work directory>
|
||||||
|
|
||||||
Path to the directory containing the build artifacts from mkinitfs.
|
Path to the directory containing the build artifacts from mkinitfs.
|
||||||
|
Reference in New Issue
Block a user