Skip to content

Conversation

lrvick
Copy link

@lrvick lrvick commented Jan 16, 2024

Support building live-bootstrap as a deterministic docker image.

./rootfs.py --docker

An image can be exported after build with:

docker save local/live-bootstrap -o live-bootstrap.tar

Expected hash as of this PR is:

c3b92d943f5ea55188049fb2c0187c2e10e258ee28216313cf43c2cb5801985c

with open(config_path, "w", encoding="utf_8") as config:
config.write(f"FORCE_TIMESTAMPS={args.force_timestamps}\n")
config.write(f"CHROOT={args.chroot or args.bwrap}\n")
config.write(f"CHROOT={args.chroot or args.bwrap or args.docker}\n")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not something that needs changing in this PR, but in the future, we might want to rename this variable to something more descriptive, like USERSPACE_ONLY (especially if/when I go through with adding the WSL bootstrap mode I'm planning).

@lrvick lrvick requested a review from stikonas January 25, 2024 00:03
@lrvick lrvick requested a review from Googulator January 30, 2024 13:05
Comment on lines +161 to +163
if args.docker:
args.external_sources = True

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

generator.prepare(target, using_kernel=False)
arch = stage0_arch_map.get(args.arch, args.arch)
init = os.path.join(os.sep, 'bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed')
print(generator.target_dir, init)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover debug print

# Add /etc/resolv.conf
echo 'nameserver 1.1.1.1' > /etc/resolv.conf
echo 'nameserver 1.1.1.1' > /etc/resolv.conf.head
if [ "${EXTERNAL_SOURCES}" = "False" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, is this the only way to do this? Wouldn't it work to have a ${DOCKER} to disable writing resolv.conf, and still retain the ability to run without predownloading everything on the host?


FROM scratch as build
ADD target/ /
RUN ["/bootstrap-seeds/POSIX/x86/kaem-optional-seed"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass "arch" from bootstrap() here, if possible, rather than hardcoding "x86".


FROM build as install
ENV PATH=/bin:/usr/sbin:/usr/bin
RUN set -eux; \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the inclusion of the "x" flag intentional here, or just leftover from debugging?

# SPDX-License-Identifier: GPL-3.0-or-later

FROM scratch as build
ADD target/ /
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass target directory from bootstrap() here, if possible, rather than hardcoding "target".

mount | grep '/proc' &> /dev/null || (mkdir -p /proc; mount -t proc proc /proc)
mount | grep '/sys' &> /dev/null || (mkdir -p /sys; mount -t sysfs sysfs /sys)
# Make /tmp a ramdisk (speeds up configure etc significantly)
mount | grep '/tmp' &> /dev/null || (mkdir -p /tmp; mount -t tmpfs tmpfs /tmp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: resolv.conf.head

if [ "${EXTERNAL_SOURCES}" = "False" ]; then
# Add /etc/resolv.conf
if [ "${CHROOT}" = False ]; then
rm /etc/mtab
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this conflict with later steps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants