fix: use correct prefix when installing SBC files

When creating an image under non-default mount prefix, it should be
used explicitly when copying SBC files.

See https://github.com/siderolabs/image-factory/issues/65

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
Andrey Smirnov 2023-12-15 19:03:08 +04:00
parent 0b94550c42
commit 760f793d55
No known key found for this signature in database
GPG Key ID: FE042E3D4085A811
11 changed files with 13 additions and 11 deletions

View File

@ -290,6 +290,7 @@ func (i *Installer) Install(ctx context.Context, mode Mode) (err error) {
if err = b.Install(runtime.BoardInstallOptions{
InstallDisk: i.options.Disk,
MountPrefix: i.options.MountPrefix,
UBootPath: i.options.BootAssets.UBootPath,
DTBPath: i.options.BootAssets.DTBPath,
RPiFirmwarePath: i.options.BootAssets.RPiFirmwarePath,

View File

@ -15,6 +15,7 @@ type PartitionOptions struct {
// BoardInstallOptions are the board specific options for installation of various boot assets.
type BoardInstallOptions struct {
InstallDisk string
MountPrefix string
DTBPath string
UBootPath string
RPiFirmwarePath string

View File

@ -73,7 +73,7 @@ func (b *BananaPiM64) Install(options runtime.BoardInstallOptions) (err error) {
}
src := filepath.Join(options.DTBPath, dtb)
dst := filepath.Join("/boot/EFI/dtb", dtb)
dst := filepath.Join(options.MountPrefix, "/boot/EFI/dtb", dtb)
err = os.MkdirAll(filepath.Dir(dst), 0o600)
if err != nil {

View File

@ -53,7 +53,7 @@ func (b JetsonNano) Install(options runtime.BoardInstallOptions) (err error) {
}
src := filepath.Join(options.DTBPath, dtb)
dst := filepath.Join("/boot/EFI/dtb", dtb)
dst := filepath.Join(options.MountPrefix, "/boot/EFI/dtb", dtb)
err = os.MkdirAll(filepath.Dir(dst), 0o600)
if err != nil {

View File

@ -70,7 +70,7 @@ func (l *LibretechAllH3CCH5) Install(options runtime.BoardInstallOptions) (err e
}
src := filepath.Join(options.DTBPath, dtb)
dst := filepath.Join("/boot/EFI/dtb", dtb)
dst := filepath.Join(options.MountPrefix, "/boot/EFI/dtb", dtb)
err = os.MkdirAll(filepath.Dir(dst), 0o600)
if err != nil {

View File

@ -64,7 +64,7 @@ func (n *NanoPiR4S) Install(options runtime.BoardInstallOptions) (err error) {
}
src := filepath.Join(options.DTBPath, dtb)
dst := filepath.Join("/boot/EFI/dtb", dtb)
dst := filepath.Join(options.MountPrefix, "/boot/EFI/dtb", dtb)
if err := os.MkdirAll(filepath.Dir(dst), 0o600); err != nil {
return err

View File

@ -71,7 +71,7 @@ func (b Pine64) Install(options runtime.BoardInstallOptions) (err error) {
}
src := filepath.Join(options.DTBPath, dtb)
dst := filepath.Join("/boot/EFI/dtb", dtb)
dst := filepath.Join(options.MountPrefix, "/boot/EFI/dtb", dtb)
err = os.MkdirAll(filepath.Dir(dst), 0o600)
if err != nil {

View File

@ -70,7 +70,7 @@ func (r *Rock64) Install(options runtime.BoardInstallOptions) (err error) {
}
src := filepath.Join(options.DTBPath, dtb)
dst := filepath.Join("/boot/EFI/dtb", dtb)
dst := filepath.Join(options.MountPrefix, "/boot/EFI/dtb", dtb)
err = os.MkdirAll(filepath.Dir(dst), 0o600)
if err != nil {

View File

@ -70,7 +70,7 @@ func (r *Rockpi4) Install(options runtime.BoardInstallOptions) (err error) {
}
src := filepath.Join(options.DTBPath, dtb)
dst := filepath.Join("/boot/EFI/dtb", dtb)
dst := filepath.Join(options.MountPrefix, "/boot/EFI/dtb", dtb)
err = os.MkdirAll(filepath.Dir(dst), 0o600)
if err != nil {

View File

@ -69,7 +69,7 @@ func (r *Rockpi4c) Install(options runtime.BoardInstallOptions) (err error) {
}
src := filepath.Join(options.DTBPath, dtb)
dst := filepath.Join("/boot/EFI/dtb", dtb)
dst := filepath.Join(options.MountPrefix, "/boot/EFI/dtb", dtb)
err = os.MkdirAll(filepath.Dir(dst), 0o600)
if err != nil {

View File

@ -32,17 +32,17 @@ func (r *RPiGeneric) Name() string {
// Install implements the runtime.Board.
func (r *RPiGeneric) Install(options runtime.BoardInstallOptions) (err error) {
err = copy.Dir(filepath.Join(options.RPiFirmwarePath, "boot"), "/boot/EFI")
err = copy.Dir(filepath.Join(options.RPiFirmwarePath, "boot"), filepath.Join(options.MountPrefix, "/boot/EFI"))
if err != nil {
return err
}
err = copy.File(filepath.Join(options.UBootPath, "rpi_generic/u-boot.bin"), "/boot/EFI/u-boot.bin")
err = copy.File(filepath.Join(options.UBootPath, "rpi_generic/u-boot.bin"), filepath.Join(options.MountPrefix, "/boot/EFI/u-boot.bin"))
if err != nil {
return err
}
return os.WriteFile("/boot/EFI/config.txt", configTxt, 0o600)
return os.WriteFile(filepath.Join(options.MountPrefix, "/boot/EFI/config.txt"), configTxt, 0o600)
}
// KernelArgs implements the runtime.Board.