Skip to content

conf/imx_hab4: clean up scripts and extra SPL templates#55

Merged
ricardosalveti merged 1 commit intofoundriesio:masterfrom
mike-scott:devel-imx-scripts
Jan 9, 2020
Merged

conf/imx_hab4: clean up scripts and extra SPL templates#55
ricardosalveti merged 1 commit intofoundriesio:masterfrom
mike-scott:devel-imx-scripts

Conversation

@mike-scott
Copy link
Copy Markdown
Contributor

@mike-scott mike-scott commented Dec 5, 2019

conf/imx_hab4: clean up scripts and extra SPL templates

  • rename sign-spl.sh -> sign-file.sh
  • new usage of sign-file.sh is:
    --cst <cst path/filename> (default: cst)
    --spl
    --m4app
    --csf-template (default: u-boot-spl-sign.csf-template)
    --key-dir (default: .)
    --fix-sdp-dcd (default: no)
  • remove mfgtools csf template
  • remove hard-coded block data from std template
  • support M4 signing logic
  • NOTES:

    • script will copy the original binary as *.mod
      if needed: modify it for: DCD handling, CSF address injection, etc.
      Make sure we don't touch original binary
    • template is turned into *.csf-config
      • translates @@KEY_ROOT@@ into --key-dir setting
      • uses "od" to get the DCD/HAB block information
        and appends this to the config
      • for DCD handling: uses the 0x20 header offset as the first block hex
        (0x2f010000) as mkimage currently has a bug.
    • cleans up copied files at the end

    Signed-off-by: Michael Scott [email protected]

@mike-scott mike-scott self-assigned this Dec 5, 2019
@mike-scott
Copy link
Copy Markdown
Contributor Author

Ugh, the script requires mkimage be installed. I might need to add a check to make sure it's in the path when it runs.

@mike-scott
Copy link
Copy Markdown
Contributor Author

CRAP posted this against master

Comment thread conf/imx_hab4/sign-spl.sh Outdated
@mike-scott mike-scott changed the title conf/imx_hab4: clean up scripts and extra sql templates conf/imx_hab4: clean up scripts and extra SPL templates Dec 5, 2019
Comment thread conf/imx_hab4/sign-spl.sh Outdated
@mike-scott mike-scott force-pushed the devel-imx-scripts branch 2 times, most recently from 75e42cd to e27fc1a Compare January 6, 2020 19:16
@ricardosalveti
Copy link
Copy Markdown
Member

Mind rebasing against master?

Comment thread conf/imx_hab4/sign-file.sh Outdated
echo " --cst: set cst binary path/filename [default: ${CST_BINARY}]"
echo " --csf-template: set CSF template file [default: ${CSF_TEMPLATE}]"
echo " --spl: SPL binary to sign [required]"
echo " --m4app: M4 binary to sign [required]"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is m4app required or optional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has to have either --spl or --m4app to specify binary

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change usage to say one or other required? Both with [required] is confusing.

if [ "${SIGN_M4APP}" == "1" ]; then
BINARY_LEN=$(od -An -t x4 -j 0x1024 -N 0x4 ${WORK_FILE}.mod | cut -d' ' -f2)
BINARY_LEN=$(printf "%08x" $(((0x${BINARY_LEN} / 0x1000 + 1) * 0x1000)))
objcopy -I binary -O binary --pad-to 0x${BINARY_LEN} --gap-fill=0x5A ${WORK_FILE}.mod ${WORK_FILE}.mod
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While objcopy and other tools are commonly available, it is probably a good idea to use 'set -e' as part of this script, in case one of the tools are not available at the host side.

Copy link
Copy Markdown
Contributor Author

@mike-scott mike-scott Jan 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch will add that.

@mike-scott
Copy link
Copy Markdown
Contributor Author

@ricardosalveti rebased

- rename sign-spl.sh -> sign-file.sh
- new usage of sign-file.sh is:
  --cst <cst path/filename> (default: cst)
  --spl <spl binary to sign>
  --m4app <M4 binary to sign>
  --csf-template <template file to use> (default: u-boot-spl-sign.csf-template)
  --key-dir <directory where keys are located> (default: .)
  --fix-sdp-dcd (default: no)
- remove mfgtools csf template
- remove hard-coded block data from std template
- support M4 signing logic

NOTES:
- script will copy the original binary as *.mod
  if needed: modify it for: DCD handling, CSF address injection, etc.
  Make sure we don't touch original binary
- template is turned into *.csf-config
  - translates @@KEY_ROOT@@ into --key-dir setting
  - uses "od" to get the DCD/HAB block information
    and appends this to the config
  - for DCD handling: uses the 0x20 header offset as the first block hex
    (0x2f010000) as mkimage currently has a bug.
- cleans up copied files at the end

Change-Id: Ie7d930040c746991388832fa7d749bf3632e4a0b
Signed-off-by: Michael Scott <[email protected]>
@ricardosalveti
Copy link
Copy Markdown
Member

ci-retest

Copy link
Copy Markdown
Member

@ricardosalveti ricardosalveti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better, let's get this in and improve if needed.

@ricardosalveti ricardosalveti merged commit f87f1a6 into foundriesio:master Jan 9, 2020
@mike-scott mike-scott deleted the devel-imx-scripts branch January 15, 2020 21:02
ricardosalveti added a commit to ricardosalveti/lmp-manifest that referenced this pull request Oct 14, 2022
Relevant changes:
- 7935897 Merge pull request foundriesio#55 from quaresmajose/bbfatal_log
- 3e7c55c image_types_ostree: use bbfatal_log when do_image_garagesign fails
- ee7322c Merge pull request foundriesio#53 from quaresmajose/errcode
- dd129dc image_types_ostree: show the errorcode on the push failed warning
- 0207f86 Merge pull request foundriesio#50 from mdfr74/kirkstone
- a2d9042 Fix typos created by 6159909

Signed-off-by: Ricardo Salveti <[email protected]>
ricardosalveti added a commit that referenced this pull request Oct 15, 2022
Relevant changes:
- 7935897 Merge pull request #55 from quaresmajose/bbfatal_log
- 3e7c55c image_types_ostree: use bbfatal_log when do_image_garagesign fails
- ee7322c Merge pull request #53 from quaresmajose/errcode
- dd129dc image_types_ostree: show the errorcode on the push failed warning
- 0207f86 Merge pull request #50 from mdfr74/kirkstone
- a2d9042 Fix typos created by 6159909

Signed-off-by: Ricardo Salveti <[email protected]>
quaresmajose pushed a commit that referenced this pull request Oct 21, 2022
Relevant changes:
- 7935897 Merge pull request #55 from quaresmajose/bbfatal_log
- 3e7c55c image_types_ostree: use bbfatal_log when do_image_garagesign fails
- ee7322c Merge pull request #53 from quaresmajose/errcode
- dd129dc image_types_ostree: show the errorcode on the push failed warning
- 0207f86 Merge pull request #50 from mdfr74/kirkstone
- a2d9042 Fix typos created by 6159909

Signed-off-by: Ricardo Salveti <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants