Hello Diego,

Yes, a single fakeroot session preserves metadata. A shell detail: fakeroot
cannot call a function defined only
in the calling shell. Since the manual already exports DEV_DIR and SYSROOT,
you can pass the commands directly to sh:

fakeroot sh -e <<'EOF'
cd "$DEV_DIR/src/hurd/build"
make install DESTDIR="$SYSROOT"

cd "$SYSROOT"
# Complete the runsystem, directory and grub.cfg steps here.

mke2fs -t ext2 -o hurd -d "$SYSROOT" -E offset=1048576 "$DEV_DIR/hurd.img"
255M
EOF

This assumes the hurd.img file has already been created and partitioned. -e
also stops the script before
 mke2fs copies an incomplete system root if the installation fails.

Best regards,
Alperen Erkan

On Mon, Nov 23, 2026 at 5:37 PM Diego Nieto Cid <[email protected]> wrote:

> Hello,
>
> On Mon, Nov 23, 2026 at 04:58:53PM +0300, Alperen Erkan wrote:
> > Hello,
> >
> > I reviewed the proposed cross-toolchain guide and found several issues in
> > the bootstrap and image creation instructions.
> > This was a static review. I have not built the toolchain or booted the
> > resulting image.
>
> Thanks.
>
> >
> > 1. Loop device selection during GRUB installation
> >
> > losetup -Pf hurd.img selects the first available loop device. The
> > subsequent commands assume that /dev/loop0 was selected.
> > If /dev/loop0 already belongs to another image, grub-install may
> overwrite
> > that image’s boot sector.
> >
> > Please capture the assigned device when attaching the image:
> >
> > loopdev=$(sudo losetup --find --show --partscan hurd.img)
> >
> > The mount command can then use "${loopdev}p1", and both grub-install
> > and losetup
> > -d can use "$loopdev".
>
> I know, that's why there's a note there:
>
>     (NOTE check the loop device assigned to your image)
>
> Anyway, I'll incorporate the loopdev variable.
>
> >
> > 2. Binutils archive extraction
> >
> > The download command uses BINUTILS_VERSION, while the extraction command
> > uses BINUTILS_VESION. With the environment defined in the guide,
> > tar therefore looks for binutils-.tar.gz. The extraction command should
> > read tar xf "binutils-${BINUTILS_VERSION}.tar.gz".
>
> Yep, there was a typo :'(
>
> >
> > 3. Working directory for the glibc checkout
> >
> > The glibc section begins with cd $DEV_DIR/src/glibc immediately before
> git
> > clone. On a clean build, that directory does not yet exist. The first
> > command
> >  should be cd "$DEV_DIR/src" so that the clone creates the directory
> > expected by the following cd glibc.
>
> Hmm, thanks for the extra eye. I was too anxious for testing once more
> before sending :P
>
> >
> > 4. Preservation of fakeroot metadata
> >
> > fakeroot make install DESTDIR=$SYSROOT and fakeroot mke2fs ... run in
> > separate sessions. The second session has no record of device types or
> > ownership
> > changes emulated during installation. Running the Hurd installation, the
> > intervening sysroot changes, and mke2fs -d in the same fakeroot session
> > would preserve that
> >  metadata when populating the image.
> >
>
> Would something like this work?
>
>     should_run_under_fakeroot() {
>         cd $DEV_DIR/src/hurd/build
>         make install DESTDIR=$SYSROOT
>
>         cd "$DEV_DIR"
>         mke2fs -t ext2 -o hurd -d "$SYSROOT" -E offset=1048576
> "$DEV_DIR/hurd.img" 255M
>     }
>     fakeroot should_run_under_fakeroot
>
>
> > 5. GCC stage 1 configure option
> >
> > --disable-libatocim should read --disable-libatomic.
>
> Sorry for the typo again :'(
>
> >
> > For reproducibility, could you also include the GNU Mach, MIG, Hurd, and
> > glibc commit IDs used for the successful build? The guide specifies exact
> > Binutils and GCC
> > releases, while the four Git checkouts follow their respective default
> > branches.
>
> Sounds like a good idea. I'll add some extra variables for
> commit hashes.
>
> >
> > Best regards,
> > Alperen ERKAN
>
> Thanks.
>

Reply via email to