On Mon, 30 Jun 2025 14:15:59 -0600
Leo Sandoval <lsand...@redhat.com> wrote:

> On Mon, Jun 30, 2025 at 1:45 PM Glenn Washburn <developm...@efficientek.com>
> wrote:
> 
> > On Fri, 20 Jun 2025 18:03:41 -0600
> > Leo Sandoval via Grub-devel <grub-devel@gnu.org> wrote:
> >
> > > Containers bring the ability to have ready-to-use environments and in
> > > this case complete Fedora and Debian container files are described
> > > containing all required packages for building and testing grub2.
> > >
> > > Once users manually build it, they can run the desired container, jump
> > > into a setup ready for development. On the other hand, if users
> > > prefer to use bare metal instead of a containerized environment, it is
> > > still useful to have a file explicitly indicating the required packages.
> >
> > As noted there already is a list of packages in the INSTALL file. In
> > contrast to Daniel, I actually prefer code as documentation, and have
> > the INSTALL point to here. Or perhaps the container file can be
> > modified to extract the list of packages from the INSTALL file (which,
> > I imagine, would require a more machine readable format of the package
> > list).
> >
> 
> I will try following dkiper's suggestion but I am not 100% convience.
> 
> >
> > >
> > > Signed-off-by: Leo Sandoval <lsand...@redhat.com>
> > > ---
> > > Some facts observed while creating and testing these containes:
> > >
> > > NOTE: all the below results are based on
> > >
> > >     root@a613d2d32efa:/grub# git log --oneline
> > >     db506b3 (grafted, HEAD -> master, origin/master, origin/HEAD)
> > gnulib/regexec: Fix resource leak
> > >
> > > * compilation time
> > >
> > > Done on my mostly idle-laptop (20 i7-12800H cores) so this is not really
> > an isolated system, as any other benchmark,
> > > do not trust too much on these numbers
> > >
> > > Debian:
> > >     root@a613d2d32efa:/grub# time make &>/dev/null
> > >
> > >     real      1m15.486s
> > >     user      0m51.869s
> > >     sys               0m23.338s
> > >
> > > Fedora:
> > >     [root@4eabb29f0ef2 grub]# time make &>/dev/null
> > >
> > >     real      1m18.679s
> > >     user      0m51.352s
> > >     sys               0m27.417s
> > >
> > >
> > > * image sizes:
> > >
> > >     $ podman images | grep '\-grub'
> > >     localhost/debian-grub                      latest      e789c1f8da26
> > About a minute ago  2.34 GB
> > >     localhost/fedora-grub                      latest      b2dd8ef96b85
> > 15 minutes ago      2.04 GB
> > >
> > > so debian is a 'bit' heavier than fedora.
> > >
> > > * compilation issue
> > >
> > > Due to a more recent gcc version on Fedora compared to Debian,
> > compilation failed on the Fedora container
> > > with the following error (already reported but not yet at upstream)
> > >
> > >     lib/gnulib/base64.c:65:3: error: initializer-string for array of
> > ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute
> > (65 chars into 64 available) [-Werror=unterminated-string-initialization]
> > >        65 |
> >  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
> > >     |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >
> > > whereas not observed in Debian. To fix the above, one can install b4 and
> > patch the repo
> > >
> > >     [root@4eabb29f0ef2 grub]# b4 shazam
> > https://lore.kernel.org/grub-devel/20250618015826.270234-2-adham...@gmail.com/
> > >     Grabbing thread from
> > lore.kernel.org/all/20250618015826.270234-2-adham...@gmail.com/t.mbox.gz
> > >     Checking for newer revisions
> > >     Grabbing search results from lore.kernel.org
> > >     Analyzing 6 messages in the thread
> > >     Analyzing 3 code-review messages
> > >     Checking attestation on all messages, may take a moment...
> > >     ---
> > >       ✗ [PATCH v2 1/2] gnulib: Add patch to allow GRUB w/GCC-15 compile
> > >         + Reviewed-by: Sudhakar Kuppusamy <sudha...@linux.ibm.com> (✗
> > DKIM/ibm.com)
> > >       ✗ [PATCH v2 2/2] util/grub-protect: Correct uninit 'err' Variable
> > >         + Reviewed-by: Sudhakar Kuppusamy <sudha...@linux.ibm.com> (✗
> > DKIM/ibm.com)
> > >       ---
> > >       ✗ BADSIG: DKIM/gmail.com
> > >     ---
> > >     Total patches: 2
> > >     ---
> > >     Applying: gnulib: Add patch to allow GRUB w/GCC-15 compile
> > >     Applying: util/grub-protect: Correct uninit 'err' Variable
> > >
> > >
> > > * make check results
> > >
> > > Debian:
> > >
> >  
> > ============================================================================
> > >     Testsuite summary for GRUB 2.13
> > >
> >  
> > ============================================================================
> > >     # TOTAL: 88
> > >     # PASS:  64
> > >     # SKIP:  3
> > >     # XFAIL: 0
> > >     # FAIL:  2
> > >     # XPASS: 0
> > >     # ERROR: 19
> >
> > This indicates that you're not properly running the tests. There should
> > be no errors, IIRC. Look at the
> 
> 
> That's what I expected also but that is not the case when running inside
> these containers.

I'm not sure I understand you. What is "not the case"? Please provide
a list of the 19 tests which cause an ERROR. I realize this is not
technically related to the building of the container and thus this
patch. However, I'd like to figure out why there are tests erroring and
what needs to be done to get them working. I suspect its the filesystem
tests which require root. If so, does that mean podman doesn't do UID
mapping, or is that something you need to enable in the container file?

> 
> 
> >
> >
> > >
> > > Fedora:
> > >
> >  
> > ============================================================================
> > >     Testsuite summary for GRUB 2.13
> > >
> >  
> > ============================================================================
> > >     # TOTAL: 88
> > >     # PASS:  63
> > >     # SKIP:  3
> > >     # XFAIL: 0
> > >     # FAIL:  3
> > >     # XPASS: 0
> > >     # ERROR: 19
> > >
> > > In general, the same results in both distros.
> > > ---
> > >  container/Containerfile.debian | 56
> > +++++++++++++++++++++++++++++++++++++++++
> > >  container/Containerfile.fedora | 57
> > ++++++++++++++++++++++++++++++++++++++++++
> > >  container/README               | 22 ++++++++++++++++
> > >  3 files changed, 135 insertions(+)
> > >  create mode 100644 container/Containerfile.debian
> > >  create mode 100644 container/Containerfile.fedora
> > >  create mode 100644 container/README
> > >
> > > diff --git a/container/Containerfile.debian
> > b/container/Containerfile.debian
> > > new file mode 100644
> > > index 0000000000..8906b2921e
> > > --- /dev/null
> > > +++ b/container/Containerfile.debian
> > > @@ -0,0 +1,56 @@
> > > +FROM debian
> > > +
> > > +# Install required packages for configuration & compilation & check
> > > +RUN apt update -y  && \
> > > +    apt install -y \
> > > +        attr \
> > > +        autoconf \
> > > +        automake \
> > > +        autopoint \
> > > +        bison \
> > > +        btrfs-progs \
> > > +        cpio \
> > > +        cryptsetup \
> > > +        dosfstools \
> > > +        e2fsprogs \
> > > +        erofs-utils \
> > > +        exfatprogs \
> > > +        f2fs-tools \
> > > +        flex \
> > > +        gawk \
> > > +        genromfs \
> > > +        gettext \
> > > +        git \
> > > +        hfsplus \
> > > +        jfsutils \
> > > +        libtool \
> > > +        lzop \
> > > +        make \
> > > +        mtools \
> > > +        nilfs-tools \
> > > +        ntfs-3g \
> > > +        ovmf \
> > > +        ovmf-ia32 \
> > > +        parted \
> > > +        patch \
> > > +        pkg-config \
> > > +        python3 \
> > > +        qemu-efi-aarch64 \
> > > +        qemu-efi-arm \
> > > +        qemu-system \
> > > +        squashfs-tools \
> > > +        swtpm-tools \
> > > +        tpm2-tools \
> > > +        udftools \
> > > +        unifont \
> > > +        wamerican \
> > > +        which \
> > > +        xfonts-unifont \
> > > +        xfsprogs \
> > > +        xorriso \
> > > +        zfs-fuse
> > > +
> > > +# clone tip of grub repository
> > > +RUN git clone --depth 1 https://https.git.savannah.gnu.org/git/grub.git
> > /grub
> > > +
> > > +WORKDIR /grub
> > > diff --git a/container/Containerfile.fedora
> > b/container/Containerfile.fedora
> > > new file mode 100644
> > > index 0000000000..e5b33bfd71
> > > --- /dev/null
> > > +++ b/container/Containerfile.fedora
> > > @@ -0,0 +1,57 @@
> > > +FROM registry.fedoraproject.org/fedora
> > > +
> > > +# Install required packages for configuration & compilation & check
> > > +RUN dnf update -y && \
> > > +    dnf install -y \
> > > +        attr \
> > > +        autoconf \
> > > +        automake \
> > > +        autopoint \
> > > +        bison \
> > > +        btrfs-progs \
> > > +        cpio \
> > > +        cryptsetup \
> > > +        dosfstools \
> > > +        e2fsprogs \
> > > +        edk2-ovmf \
> > > +        edk2-ovmf-ia32 \
> > > +        erofs-utils \
> > > +        exfatprogs \
> > > +        f2fs-tools \
> > > +        flex \
> > > +        gawk \
> > > +        genromfs \
> > > +        gettext \
> > > +        git \
> > > +        hfsplus-tools \
> > > +        jfsutils \
> > > +        libtool \
> > > +        lzop \
> > > +        make \
> > > +        mtools \
> > > +        nilfs-utils \
> > > +        ntfsprogs \
> > > +        parted \
> > > +        patch \
> > > +        pkg-config \
> > > +        python3 \
> > > +        qemu-system-arm \
> > > +        qemu-system-aarch64 \
> > > +        qemu-system-riscv \
> > > +        qemu-system-x86 \
> > > +        squashfs-tools \
> > > +        swtpm-tools \
> > > +        tpm2-tools \
> > > +        udftools \
> > > +        unifont \
> > > +        unifont-fonts \
> > > +        which \
> > > +        words \
> > > +        xfsprogs \
> > > +        xorriso \
> > > +        zfs-fuse
> > > +
> > > +# clone tip of grub repository
> > > +RUN git clone --depth 1 https://https.git.savannah.gnu.org/git/grub.git
> > /grub
> > > +
> > > +WORKDIR /grub
> > > diff --git a/container/README b/container/README
> > > new file mode 100644
> > > index 0000000000..be5e988b9d
> > > --- /dev/null
> > > +++ b/container/README
> > > @@ -0,0 +1,22 @@
> > > +install `podman` on your favorite distro then build it with
> > > +
> > > +$ podman build -t fedora-grub -f Containerfile.fedora .
> > > +
> > > +or in case you prefer Debian
> > > +
> > > +$ podman build -t debian-grub -f Containerfile.debian .
> > > +
> > > +once built, you can run/launch any of the above
> > > +
> > > +$ podman run -it fedora-grub
> > > +
> > > +or
> > > +
> > > +$ podman run -it debian-grub
> > > +
> > > +and execute the standard build/test commands inside it, e.g
> > > +
> >
> > An issue I suspect unrelated to the errors is that you've not included
> > step #2 nor #9 of the section "Building the GRUB" in the INSTALL file.
> >
> 
> for step #2, grub code is based on a shallow clone so  the ./bootstrap
> applies in this case.

Not sure which INSTALL version you're reading, but the one I'm looking
at has ./bootstrap as #3. #2 is "If you want translations type
`./linguas.sh'" It would be useful to add this because its commonly
forgotten.

Glenn

> 
> for step #9, this is related to documentation,  and I can include on the
> commit description
> 
> 
> > Also it should be noted that this does not test non-native
> > architectures.
> >
> 
> good point.
> 
> 
> >
> > > +# ./bootstrap
> > > +# ./configure
> > > +# ./make
> > > +# ./make check
> >
> > Would this series of commands leave residual files that can be seen
> > upon a second invocation of the container? I have some build/test
> > scripts that would probably be good for this script to leverage.
> >
> 
> yes, build artifacts, I believe most of the stuff described on the
> .gitignore
> 
> The image just contains the set of required packages and a shallow clone of
> grub, so any command executed inside the container that results on new
> files will be lost after exiting the environment, as any standard container.
> 
> 
> > Glenn
> >
> > > \ No newline at end of file
> > >
> > >
> > > _______________________________________________
> > > Grub-devel mailing list
> > > Grub-devel@gnu.org
> > > https://lists.gnu.org/mailman/listinfo/grub-devel
> >
> >

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to