Skip to content

Instantly share code, notes, and snippets.

@jepio
Last active October 4, 2022 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jepio/7ee539b768f7a33953d137d0ff7c6abe to your computer and use it in GitHub Desktop.
Save jepio/7ee539b768f7a33953d137d0ff7c6abe to your computer and use it in GitHub Desktop.
Some old stuff, don't know if it's of any use.
FROM flatcar-developer-arm64:3346.0.0
RUN cd /etc/env.d/gcc && \
file=$(ls aarch64-cros-*) && \
cp ${file} ${file/cros/unknown} && \
sed -i -e 's/CTARGET=.*/CTARGET="aarch64-unknown-linux-gnu"/' /etc/env.d/gcc/aarch64-unknown-linux-gnu-*
RUN cd /usr/aarch64-cros-linux-gnu/gcc-bin/*/ && \
for i in aarch64-cros-*; do \
ln -s ${i} ${i/cros/unknown} ; \
done
RUN cd /usr/bin && \
for i in aarch64-cros-*; do \
ln -s ${i} ${i/cros/unknown} ; \
done
RUN sed -i -e 's/CHOST=.*/CHOST=aarch64-unknown-linux-gnu/' /etc/portage/make.conf && \
echo 'FEATURES="-network-sandbox -ipc-sandbox -pid-sandbox"' >> /etc/portage/make.conf
RUN ln -sf -T ../../var/lib/portage/coreos-overlay/profiles/coreos/arm64/sdk /etc/portage/make.profile
RUN ldconfig
RUN emerge-gitclone && sed -i -e 's|\(portage-stable:default/linux/arm64\)$|\1/17.0/hardened|' /var/lib/portage/coreos-overlay/profiles/coreos/arm64/parent
RUN emerge -j8 -vg autoconf help2man setuptools catalyst shadow
# libtool embeds paths to grep; the SDK has a split /usr layout, but the dev containers is merged /usr,
# which leads to errors later in the bootstrap process
# sed path is stored by catalyst
RUN rm /bin && mkdir /bin && mv /usr/bin/{bash,sh,grep,fgrep,egrep,sed} /bin/
RUN emerge -j8 -v libtool
RUN mkdir -p /var/gentoo/repos/ && cp -a /var/lib/portage/portage-stable /var/gentoo/repos/gentoo && cp -a /var/lib/portage/coreos-overlay /var/gentoo/repos
# calls systemctl during bashrc which doesn't work
RUN rm /etc/profile.d/flatcar-profile.sh
# to make sure catalyst can find grep and sed
RUN echo 'ROOTPATH="/sbin:/bin"' >>/etc/env.d/99flatcarbin && env-update
# SDK container dockerfile expects this to exist
RUN touch /etc/passwd /etc/group && pwconv
CMD ["/bin/bash"]
#!/bin/bash
FLATCAR_VERSION=3346.0.0
curl -L https://alpha.release.flatcar-linux.net/arm64-usr/${FLATCAR_VERSION}/flatcar_developer_container.bin.bz2 -o flatcar_developer_container.bin.bz2
lbunzip2 -k flatcar_developer_container.bin.bz2
mkdir -p ${FLATCAR_VERSION}
sudo mount -o ro,loop,offset=2097152 flatcar_developer_container.bin ${FLATCAR_VERSION}
trap "sudo umount ${FLATCAR_VERSION}" EXIT
sudo tar -cp --one-file-system -C ${FLATCAR_VERSION} . | docker import - flatcar-developer-arm64:${FLATCAR_VERSION}
rm -rf flatcar_developer_container.bin flatcar_developer_container.bin.bz2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment