Exemplo n.º 1
0
func (b *Builder) addSysinitBpkg() (*BuildPackage, error) {
	lpkg := pkg.NewLocalPackage(b.targetPkg.Repo().(*repo.Repo),
		GeneratedBaseDir(b.targetPkg.Name()))
	lpkg.SetName(pkg.ShortName(b.targetPkg) + "-sysinit-" + b.buildName)
	lpkg.SetType(pkg.PACKAGE_TYPE_GENERATED)

	return b.addPackage(lpkg)
}
Exemplo n.º 2
0
func (mi *MfgImage) dstBootBinPath() string {
	if mi.boot == nil {
		return ""
	}

	return fmt.Sprintf("%s/%s.elf.bin",
		MfgBootDir(mi.basePkg.Name()),
		pkg.ShortName(mi.boot.App()))
}
Exemplo n.º 3
0
func (t *TargetBuilder) generateSysinit(
	cfgResolution resolve.CfgResolution) error {

	loaderPkgs, appPkgs, err := t.resolvePkgs(cfgResolution)
	if err != nil {
		return err
	}

	srcDir := GeneratedSrcDir(t.target.Name())

	if loaderPkgs != nil {
		sysinit.EnsureWritten(loaderPkgs, srcDir,
			pkg.ShortName(t.target.Package()), true)
	}

	sysinit.EnsureWritten(appPkgs, srcDir,
		pkg.ShortName(t.target.Package()), false)

	return nil
}
Exemplo n.º 4
0
func (mi *MfgImage) dstImgPath(slotIdx int) string {
	var pack *pkg.LocalPackage
	var imgIdx int

	if len(mi.images) >= 1 {
		switch slotIdx {
		case 0:
			if mi.images[0].LoaderName != "" {
				pack = mi.images[0].Loader()
			} else {
				pack = mi.images[0].App()
			}
			imgIdx = 0

		case 1:
			if mi.images[0].LoaderName != "" {
				pack = mi.images[0].App()
				imgIdx = 0
			} else {
				if len(mi.images) >= 2 {
					pack = mi.images[1].App()
				}
				imgIdx = 1
			}

		default:
			panic(fmt.Sprintf("invalid image index: %d", imgIdx))
		}
	}

	if pack == nil {
		return ""
	}

	return fmt.Sprintf("%s/%s.img",
		MfgImageBinDir(mi.basePkg.Name(), imgIdx), pkg.ShortName(pack))
}
Exemplo n.º 5
0
func (t *TargetBuilder) generateFlashMap() error {
	return t.bspPkg.FlashMap.EnsureWritten(
		GeneratedSrcDir(t.target.Name()),
		GeneratedIncludeDir(t.target.Name()),
		pkg.ShortName(t.target.Package()))
}