Open Nobody2303 opened 7 months ago
So I did a little Research and knowledge building about docker in it self on my own. I was able to alter the Dockerfile to get a plain image which i can run with sleep infinity and debug contents with docker exec.
What I found out is for some reason the RUN commands seemingly are not performed as a specific user so /opt/build.sh will not be executable.
Additionally I had to convert all CarriageReturn LineFeeds to LineFeeds only, most certainly due to the way how I cloned the git repo to my windows machine... should also considering re-cloning the whole repo with proper line feed alteration settings, like pull as is
By using the following lines I can make sure I see what is in the /opt folder during image build time and build.sh will actually execute
# Lets get each in a separate docker layer for better downloads
# GCC
RUN su root && export PATH=$PATH:/opt && ls -l /opt && build.sh GetGcc
but unfortunately this will start a complete build process not just installing GCC so the process is asking for CMakeLists.txt to be inside /sources folder inside the container during docker image build time, which makes no sense to me.
Could someone please elaborate how this is intended to work?
Anyhow currently image build will only be a success if I don't try to execute build.sh at all
So after some further research and tweaking I got the container to work properly.
I had to add the following line at the 3rd or 4th line
USER root
to explicitly run the commands as root otherwise they would not succeed.
The docker run command from the documentation also needed to be altered to my specific folder structure as well with --user root to actually run the build process properly.
Well at least to the point where nimble lib is build then the build exits with error 2 at 35% of total build process... also some font file it seems to be not created as well due to an error...
I already suspect this being potentially related to line end conversion issues as I'm working on a windows system.
So Finally I was able to build the stock Firmware from the Repository and have a relyable start point for further development.
Memory region Used Size Region Size %age Used
FLASH: 377492 B 474632 B 79.53%
SPARE_SPACE: 0 GB 12 KB 0.00%
RAM: 64368 B 64 KB 98.22%
post build steps for pinetime-mcuboot-app-1.13.0
text data bss dec hex filename
377492 940 63420 441852 6bdfc pinetime-mcuboot-app-1.13.0.out
post build (DFU) steps for pinetime-mcuboot-app-1.13.0
Zip created at pinetime-mcuboot-app-dfu-1.13.0.zip
[100%] Built target pinetime-mcuboot-app
+ BUILD_RESULT=0
+ return 0
+ BUILD_RESULT=0
The remaining issue was related to Line End conversion most certainly caused by the line end conversion local or global .gitconfic autocrlf set to true prior loading the repository the first time. So I completely reloaded the repo and it's submodules while ensuring autocrlf is at least set to input.
So in the end I just needed
should I commit the gained knowledge as documentation advice for review? @JF002 @NeroBurner @Riksu9000 @minacode
Yes, I would add that to the docs in a PR.
@Nobody2303 Thanks for documenting all your findings about building the docker image on Win 10! Do you have any idea if it would be possible to edit the docker file and scripts such that it would build seamlessly on Linux AND Windows?
If I understand correctly, the image is built and ran as user root
, which, to the point of view of a Linux user, does not seem right (this will create build artifacts in the user directory that are owned by root instead of the actual user.
@JF002 @FintasticMan Sry for the late reply. Christmas preparations are keeping me from pursuing this topic.
Currently I have no concrete Idea but I think it should be possible to select a fitting dockerfile and infinitime build command from within an OS detection mechanism...
Verification
Introduce the issue
I just set up Docker v4.25.0 I cloned the infinitime repo and also update the submodules.
Upon trying to build the docker image, I ran into the following issue, which I can't really resolve as it's the first time for me to work with docker.
If anyone could give me a hint what might not work I'd be very happy.
Preferred solution
No response
Version
v1.13.0