Linux from scratch:latest

I began to think about software and, as is not uncommon, had a bad idea. LinuxFromScratch is a fine project & all but there's an expectation I am probably doing this on hardware. Because that is a sane & safe & sensible approach to building a Linux system from barest of bones.

I had a worse idea. What if LFS but as a multiple image Containerfile? This is the least viable of sketches of the idea but perhaps one can see where I'm going w/ this. Use something small (here, Alpine) to build the LFS build environment. Next, I'd use that build environment to build LFS & then eventually use THAT LFS environment to self-test.

Extremely hard-coded Containerfile:

MAINTAINER Binder@vislae.town

FROM alpine:latest as building
RUN mkdir -p /LFS/sources /LFS/tools
RUN apk --no-cache add bash bison coreutils diffutils findutils gawk gcc g++
RUN apk --no-cache add make patch perl python3 texinfo xz
RUN apk --no-cache add grep gzip

ADD LFS/sources/* /LFS/sources/

ENV LFS /LFS
RUN cd "${LFS}/sources/binutils-2.40" && mkdir build && cd build \
    && ../configure --prefix "${LFS}/tools/" --with-sysroot "${LFS}" --build x86_64 --host x86_64 --disable-nls --enable-gprofng-no --disable-werror --target=aarch64-builder-elf
RUN cd "${LFS}/sources/binutils-2.40/build" && make
RUN cd "${LFS}/sources/binutils-2.40/build" && make install

Then that new idea required that I add Makefile targets:

exec:
    podman run -it localhost/latest:latest bash

image:
    time podman build -t latest .

where I've made some targets to wrap frequent invocations of container management. Special thanks go to this blog about buildahInBuildah for affirming that I was going in an interesting direction.

links

social