-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Utilize standalone rimage tool #2086
Utilize standalone rimage tool #2086
Conversation
Why is this needed? |
@plbossart We want to decouple rimage from SOF as it is not audio-specific stuff, it's just image composing tool for DSP's FW. It's weird f.e. for Zephyr to pull whole SOF repo just for rimage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it should be decoupled from FW, but we shouldn't just like that cut it out and expect user to have it installed. It's step backward and will cause many troubles.
We had it like this before that user had to build rimage manually and was expect by buildsystem, it's PITA - for user and for developers that see the same questions and unrelated problem caused by this being reported. It has to be built as part of build process automatically, so first we need to have rimage uploaded to different repo and then remove it from here and update build system to automatically pull repo with rimage and build it (like we have it with cmocka).
Understood. I will work on getting rimage repo as a submodule. |
Are you really sure git submodules are the answer? see e.g. https://github.blog/2016-02-01-working-with-submodules/ If we go with multiple repositories then it's just easier to use "repo". |
Updated to use git submodule. |
@plbossart submodules do have a downside in that users need to remeber and manually update each submodule when updating the main repo. A script would eliminate any forgetfullnes though (which qemu do run for their 3 submodules as part of the build process so maybe this is the best method). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dcpleung could rimage be updated via a script and could this script be invoked at the cmake stage where we set toolchain etc. I'm trying to find a way that wont impact CI and means users can test local rimage updates.
mkdir build_byt && cd build_byt
cmake -DTOOLCHAIN=xtensa-byt-elf -DROOT_DIR=`pwd`/../../xtensa-root/xtensa-byt-elf ..
```.
It is possible to add a cmake custom command/target to run git submodule update or the script. However, I am not sure the impact since I haven't used submodule much. |
Indeed, we need to take the user out of the equation. It's got to be scripted/automated.
not really, and we already have one manifest btw https://github.com/thesofproject/sof-manifests |
You basically can do it similar to what we do in test/cmocka, just for download command of ExternalProject instead of git clone use submodule init/update. |
@lgirdwood We will use scripts to do the build. |
@xiulipan @dcpleung @lgirdwood @plbossart You need no changes in CI, everything can be done in cmake files if done properly |
@jajanusz I was hoping you would chime in here. :) Ideally we want to synchronise any external submodules prior to a build but also need to be able to disable this and force a local rimage verion (for say anyone hacking and testing rimage). How would we do this in cmake ? To give an example, qemu does submodule updates as part of "configure" which is a python script in qemu.
configure is only needed to be run when changing the qemu configuration or if you need to update it's submodules. It also allows for pulling certain commits/tags of submodules. I guess we could have this as part of a make rule or as part of the logic for generating the makefiles ? |
@dcpleung @lgirdwood You need mix of: sof/test/cmocka/CMakeLists.txt Lines 14 to 28 in decd206
& sof/src/arch/xtensa/CMakeLists.txt Lines 205 to 215 in decd206
in the place of current rimage_ep target, it should be easy, just fix paths and adujst arguments (I assume rimage in other repo is also cmake proj). If you want I can do it in beginning of december, cos I'm going for 2 weeks holiday tomorrow ;p |
@dcpleung @lgirdwood I guess it'd be something like this but I didn't check it. ExternalProject_Add(rimage_ep
DEPENDS check_version_h
GIT_REPOSITORY https://github.com/thesofproject/rimage # ??
PREFIX "${PROJECT_BINARY_DIR}/rimage_ep"
BINARY_DIR "${PROJECT_BINARY_DIR}/rimage_ep/build"
BUILD_ALWAYS 1
CMAKE_ARGS -DVERSION_H_PATH=${VERSION_H_PATH}
-DPEM_KEY_PREFIX=${PROJECT_SOURCE_DIR}/rimage/keys
INSTALL_COMMAND ""
) |
Ofc it's for pure git repo download variant, if you want to go with submodules then instead of |
I can add the |
Please do. |
So I guess there are now no blockers on CI side to merge, let merge as soon as conflict are resolved. |
Conflicts resolved and updated to latest commits from rimage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting on CI, but build fails on TGL due to overlap. @zrombel does CI need anything to use the standalone tool ?
CI is all good but it seems that there is a problem with building TGL with standalone rimage. I get same error when building locally where building with old rimage doesn't fail. I've asked @jajanusz to look into it. |
CI is failing cos rimage is incorrectly parsing ELF, you are missing elf.c changes related to LMA/VMA from this PR (rimage* commits) : #2516 |
@dcpleung can you update rimage commit reference ? |
This is in preparation to make rimage as a standalone tool outside of the SOF source tree. Signed-off-by: Daniel Leung <[email protected]>
Since rimage is now a standalone tool in a separate repo, remove the rimage directory in preparation to import it back as a submodule. Signed-off-by: Daniel Leung <[email protected]>
This adds rimage as a git submodule by running: git submodule add https://github.com/thesofproject/rimage.git rimage git submodule set-branch --branch master rimage This also modifies the build script to build the tool. Signed-off-by: Daniel Leung <[email protected]>
This adds the necessary bits to update git submodules when cmake is run, with the option to turn this behavior off if needed. This is in preparation to use fw.h and manifest.h from the rimage repo to prevent having two copies of each file in two different repos. Obviously, the files in the submodules must exist before building the firmware, so run git submodule update to checkout the files. Signed-off-by: Daniel Leung <[email protected]>
Since both fw.h and manifest.h are being used in the main SOF repo, and also the standalone rimage repo, to prevent them getting out of sync, use the ones coming from the rimage repo instead. Also, git submodule update is being executed when cmake is run so there is no need to update when building rimage. Signed-off-by: Daniel Leung <[email protected]>
Rebased and updated the rimage submodule SHA. |
@dcpleung thanks |
@dcpleung |
@zrombel Is there an exception for cmocka? ExternalProject_Add(cmocka_git
GIT_REPOSITORY https://github.com/thesofproject/cmocka |
Reworked in |
@marc-hb No, CI is using prebuilt cmoka on VM's.
|
While testing "tarbomb" fix #3132 I noticed the conversion of rimage to a submodule broke tarball releases. Interesting no one noticed - does anyone still use tarballs? |
@marc-hb probably not too many folks, but it does need fixed. Can you take a look and send a PR. Thanks |
I did some research and found a couple ways to fix this but no simple and easy way. Long story short some sort of script that iterates on the submodule(s) is required. There is already a couple of "git-archive-all" scripts here and there already but nothing "standard" and certainly nothing built in git; so this would be a new/extra dependency and not necessarily a well maintained one. The other packaging option I considered is CMake's CPack. It's standard in CMake and should do the job, however it's wildcard-based and not version control based and requires a pristine checkout. Mmmm.... BTW I got confirmation on Slack from @mbolivar himself (thx) that In conclusion I think doing nothing and waiting for someone to ask is probably a good option because:
We could even drop the symbolic link thanks to some new |
@marc-hb ack - I've no objection to dropping tarball support. |
Thanks! To be shorter and hopefully clearer: as long as you manually re-add the |
First submodule "usability" issue, I'm surprised it took that long: #3200 |
well, I broke it, but it's not like I didn't warn folks that git submodules were the worst idea since ClearCase: #2086 (comment) |
Never replace a directory with a submodule of the same name because this creates a "flag day" that breaks git checkout, git bisect and upsets everyone including @plbossart. Demonstration:
This would not happen if this rimage submodule had been created with a different name; for instance It's too late now but IMHO good to know with submodules in general which is why I'm posting this comment. In related news I'm proposing to drop submodules in SOF and use West instead, thx for discussing the proposal at https://github.com/orgs/thesofproject/teams/sof-developers/discussions/46 ... which is not public, so transferred to issue #3517 instead. |
Suggestion to more rimage back to sof.git: |
This modifies the build script to utilize an externally built
rimage
tool, and also removes therimage
tool from source tree.Requires thesofproject/rimage#1 and thesofproject/rimage#3