From: Joshua Branson via Bug reports for GNU Guix <bug-guix@gnu.org>
To: janneke@gnu.org
Cc: guix-devel@gnu.org, 63738@debbugs.gnu.org
Subject: bug#63738: [PATCH glibc] Stop checking if MiG supports retcode.
Date: Fri, 26 May 2023 10:21:04 -0400 [thread overview]
Message-ID: <87353jb2cv.fsf@dismail.de> (raw)
In-Reply-To: <CAKwpGPyXf0LaUH3Mgwqq1duG0O6xUcEuzYRAfQiJmsqgicS+oQ@mail.gmail.com> ("Flávio Cruz"'s message of "Fri, 26 May 2023 08:00:00 -0400")
Hey guix people! The Hurd developers having a 64 bit Hurd that can run
/bin/sh. The below are some tips for how to set up such a thing if you
were so inclined. The Debian people are providing 64-bit hurd
applications here for now:
https://people.debian.org/~sthibault/tmp/hurd-amd64
Flávio Cruz <flaviocruz@gmail.com> writes:
> Hi Sergey
>
> On Fri, May 19, 2023 at 4:02 AM Sergey Bugaev <bugaevc@gmail.com> wrote:
>
> Hi,
>
> On Fri, May 19, 2023 at 9:43 AM Flávio Cruz <flaviocruz@gmail.com>
> wrote:
> > I have made changes so that it does daily builds and I'm able to boot
> small programs. However, I haven't had the time to boot programs built
> against Glibc. How do you package and boot the static binaries using a
> ramdisk? I've been reading the other threads about the Guix/rumpkernel
> so I might be able to piece something together and try it this weekend.
>
> You just put the entirety of the root filesystem (containing /usr,
> /bin, /lib, /hurd, and so on) as an ext2 image into a *file* that you
> place onto the actual drive (a CD disk in my case), and then you ask
> GRUB to load the file from the drive into memory, tell gnumach to make
> a ramdisk device out of it (you'll need to apply [0]), and tell ext2fs
> to use that device. Here's the relevant piece of my grub config
> script:
>
> [0]:
> https://salsa.debian.org/hurd-team/gnumach/-/blob/master/debian/patches/50_initrd.patch
>
>
> multiboot /boot/gnumach console=com0
> module /boot/initrd.ext2 initrd.ext2 '$(ramdisk-create)'
> module /sbin/ext2fs.static ext2fs
> --multiboot-command-line='${kernel-command-line}' --readonly
> --host-priv-port='${host-port}' --device-master-port='${device-port}'
> --exec-server-task='${exec-task}' --kernel-task='${kernel-task}' -T
> device rd0 '$(fs-task=task-create)' '$(prompt-task-resume)'
> module /lib/ld.so.1 ld.so.1 /hurd/exec
> --device-master-port='${device-port}' '$(exec-task=task-create)'
> boot
>
> (I should probably change it to not hardcode 'rd0', but whatever).
> Note that /boot/gnumach, /boot/initrd.ext2, /sbin/ext2fs.static, and
> /lib/ld.so.1 are all paths inside the CD image (those are going to be
> loaded by GRUB), and /boot/initrd.ext2 is the ext2 filesystem image
> containing the actual Hurd root. /hurd/exec however is already a path
> inside the fs image -- this is where ld.so (not grub) is going to load
> the exec server from. The only static binary here is ext2fs.static,
> the rest are all dynamically linked.
>
> Then in /libexec/console-run (inside the filesystem image), I have
> written the following:
>
> #! /bin/sh
>
> settrans -ac /dev/mach-console /hurd/streamio console
> exec <>/dev/mach-console >&0 2>&0
> echo Hello from /bin/sh!
> exec /bin/sh -i
>
> (If you're going to do the same, don't forget to create the
> /dev/mach-console node beforehand, since the fs is read-only.) I also
> had to patch streamio a little to do the \r -> \n conversion like
> glibc already does in devstream:
>
> diff --git a/trans/streamio.c b/trans/streamio.c
> index 272a002c..0af1aea3 100644
> --- a/trans/streamio.c
> +++ b/trans/streamio.c
> @@ -500,6 +500,9 @@ trivfs_S_io_read (struct trivfs_protid *cred,
> cred->po->openmodes & O_NONBLOCK);
> pthread_mutex_unlock (&global_lock);
> *data_len = data_size;
> + for (size_t i = 0; i < data_size; i++)
> + if ((*data)[i] == '\r')
> + (*data)[i] = '\n';
> return err;
> }
>
> (maybe I should also add echoing of input characters in the same way,
> which is also what glibc's devstream does -- otherwise currently I
> don't see what I'm typing on the console).
>
> Make sure to use the very latest glibc (Samuel has already pushed all
> of my patches upstream!) + the BRK_START hack.
>
> Thanks for the instructions. I was able to make it work and pushed my
> changes to Github.
>
> For people that might want to try out the new port using
> https://github.com/flavioc/cross-hurd,
> the following will download the packages and build a disk image with the ram
> disk:
>
> $ export CPU=x86_64
> $ bash download.sh && bash bootstrap.sh && bash compile.sh && bash
> create-initrd.sh
>
> Then, to run qemu:
>
> $ bash start-qemu-debug.sh
>
> Sergey
>
--
Joshua Branson
Sent from the Hurd
parent reply other threads:[~2023-05-26 14:22 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <CAKwpGPyXf0LaUH3Mgwqq1duG0O6xUcEuzYRAfQiJmsqgicS+oQ@mail.gmail.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87353jb2cv.fsf@dismail.de \
--to=bug-guix@gnu.org \
--cc=63738@debbugs.gnu.org \
--cc=guix-devel@gnu.org \
--cc=janneke@gnu.org \
--cc=jbranso@dismail.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.