func ProduceAll()

in newt/imgprod/imgprod.go [322:401]


func ProduceAll(t *builder.TargetBuilder, ver image.ImageVersion,
	sigKeys []sec.PrivSignKey, encKeyFilename string, encKeyIndex int,
	hdrPad int, imagePad int, sectionString string, useLegacyTLV bool) error {

	elfPath := t.AppBuilder.AppElfPath()

	cmdName := "arm-none-eabi-objdump"
	cmdOut, err := exec.Command(cmdName, elfPath, "-hw").Output()
	if err != nil {
		return err
	}

	var sections []image.Section
	section_list := strings.Split(sectionString, ",")
	lines := strings.Split(string(cmdOut), "\n")
	var imgBase int
	for _, line := range lines {
		fields := strings.Fields(strings.Replace(line, "\t", " ", -1))
		if len(fields) >= 8 {
			_, err := strconv.ParseUint(fields[0], 16, 64)
			if err != nil {
				continue
			}
			if fields[1] == ".imghdr" {
				base, err := strconv.ParseInt(fields[3], 16, 32)
				if err != nil {
					continue
				}
				imgBase = int(base)
			}

			for _, section := range section_list {
				if fields[1] == section {
					offset, _ := strconv.ParseInt(fields[3], 16, 32)
					size, _ := strconv.ParseInt(fields[2], 16, 32)
					s := image.Section{Name: section,
						Size:   int(size),
						Offset: int(offset)}
					sections = append(sections, s)
				}
			}
		}
	}

	// update sections offset by subtracting off start of app image
	for s := range sections {
		sections[s].Offset = sections[s].Offset - imgBase
	}

	popts, err := OptsFromTgtBldr(t, ver, sigKeys, encKeyFilename, encKeyIndex,
		hdrPad, imagePad, sections, useLegacyTLV)
	if err != nil {
		return err
	}

	pset, err := ProduceImages(popts)
	if err != nil {
		return err
	}

	var loaderHash []byte
	if pset.Loader != nil {
		loaderHash = pset.Loader.Hash
	}

	mopts, err := manifest.OptsForImage(t, ver, pset.App.Hash, loaderHash)
	if err != nil {
		return err
	}

	if err := ProduceManifest(mopts); err != nil {
		return err
	}

	if err := verifyImgSizes(pset, mopts.TgtBldr.MaxImgSizes()); err != nil {
		return err
	}

	return nil
}