Skip to content

Commit bd76f64

Browse files
committed
Update: Copy initrd
1 parent fa33943 commit bd76f64

2 files changed

Lines changed: 21 additions & 9 deletions

File tree

alteriso5/cmd/build/work/airootfs/chroot.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ func (e *Chroot) Init() error {
5656
return nil
5757
}
5858

59-
func (e *Chroot) FindKernels() ([]string, error) {
60-
kernels := []string{}
59+
type kernel struct {
60+
Linux string
61+
Initrd string
62+
}
63+
64+
func (e *Chroot) FindKernels() ([]kernel, error) {
65+
kernels := []kernel{}
6166

6267
//bootDir := path.Join(e.Dir, "boot")
6368

@@ -78,10 +83,14 @@ func (e *Chroot) FindKernels() ([]string, error) {
7883
continue
7984
}
8085

81-
kernel := env["ALL_kver"]
86+
ker := env["ALL_kver"]
87+
initrd := env["default_image"]
8288

83-
if kernel != "" {
84-
kernels = append(kernels, kernel)
89+
if ker != "" && initrd != "" {
90+
kernels = append(kernels, kernel{
91+
Linux: ker,
92+
Initrd: initrd,
93+
})
8594
}
8695

8796
}

alteriso5/cmd/build/work/task-bootmodes.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,16 @@ var makeSysLinux = NewBuildTask("makeSysLinux", func(w Work) error {
4949
return err
5050
}
5151

52-
for _, kernel := range kernels {
52+
for _, k := range kernels {
5353
cpFiles = append(cpFiles, utils.CopyTask{
54-
Source: kernel,
55-
Dest: path.Join(isoSyslinuxDir, path.Base(kernel)),
54+
Source: k.Linux,
55+
Dest: path.Join(isoSyslinuxDir, path.Base(k.Linux)),
56+
Perm: 0644,
57+
}, utils.CopyTask{
58+
Source: k.Initrd,
59+
Dest: path.Join(isoSyslinuxDir, path.Base(k.Initrd)),
5660
Perm: 0644,
5761
})
58-
5962
}
6063

6164
if err := utils.CopyAll(cpFiles...); err != nil {

0 commit comments

Comments
 (0)