Dockerfile updated with dependencies and fixes#47
Conversation
- Added systemd-container, parted, e2fsprogs, util-linux packages - git clone for the build scripts changed to copy from the host folder - Added symlinc for /artifacts since debos don't support relative path for artifacts folder
- Create EXT4 temporary EXT4 image in Docker container for sparse OS image operations (truncate, fallocate) - Increase image size from 4 GB to 5 GB
| RUN apt-get install -y systemd-container | ||
|
|
||
| RUN apt-get install -y parted | ||
|
|
||
| RUN apt-get install -y e2fsprogs util-linux | ||
|
|
There was a problem hiding this comment.
Can you please add these packages to the existing list instead? Each RUN command creates a separate layer in Docker, and each apt-get call recalculates dependencies, making the build slower
| BUILD_ID="$BUILD_ID" \ | ||
| ./partitions-script.sh | ||
| sudo losetup -d "$LOOPDEV" | ||
| FM_BACKEND="qemu" |
There was a problem hiding this comment.
This will be unbelievably slow. It's like 10x slower than native build. That was the reason I went for the loopdev-based solution.
I don't mind adding a Qemu option as a last resort, but not instead of the loopdev-one please.
Ideally we should just patch bmaptool to add the possibility to extract sparse subranges (preserving holes from the original file) - then we won't need either, the build will be much faster and won't require root.
| mkfs.ext4 -F "$STAGE_IMG" | ||
|
|
||
| mkdir -p "$STAGE_MNT" | ||
| LOOP=$(losetup -f --show "$STAGE_IMG") |
There was a problem hiding this comment.
This requires root, so it will break builds for all non-root usage (which is our primary use case with Buildbot). It should also be bypassed completely if the build is already running in an ext4 or XFS filesystem, both of which support fallocate --collapse-range
|
|
||
| mkdir -p "$STAGE_MNT" | ||
| LOOP=$(losetup -f --show "$STAGE_IMG") | ||
| mount "$LOOP" "$STAGE_MNT" |
There was a problem hiding this comment.
Also requires root. You can also directly call mount -o loop "$STAGE_IMG" "$STAGE_MNT" and avoid manual loop device creation
| RUN git clone --depth=1 https://github.com/flipperdevices/rk3576-linux-build . | ||
| COPY . /rk3576-linux-build | ||
|
|
||
| RUN ln -s /artifacts /rk3576-linux-build/artifacts |
There was a problem hiding this comment.
Can you please explain in more detail why this one is needed? I can't see why are we creating a subdirectory and then creating workarounds to help with the fact that all the stuff is suddenly inside a subdirectory :)
|
|
||
| cd "$IMG_OUT" | ||
| umount "$LOOP" | ||
| losetup -d "$LOOP" |
There was a problem hiding this comment.
This step won't be needed if you use mount -o loop instead of manually creating a loop device
There was a problem hiding this comment.
Please squash related commits - otherwise it's hard to review. The fix itself makes sense, as long as you address the feedback on the previous commit (especially making it work again for non-root users)
Changes in dockerfile: