All of lore.kernel.org
 help / color / mirror / Atom feed
* Very specific initramfs image problem
@ 2013-07-31 21:37 Paul Komkoff
       [not found] ` <20130731213716.GA5723-QlFyWrZdf16VhmCTJn09oNHuzzzSOjJt@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Komkoff @ 2013-07-31 21:37 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

Good morning.

I'm trying to achieve a very specific thing and I'm wondering if you can point
me in the right direction.

I have a system that sets up dual-boot workstations and makes grub the
bootloader. Now, I need to provide 2 network boot targets: one that will set
grub default to windows, another one to fedora. For that, I have a script that
updates grubenv; now, I need to package it into initramfs.

Before dracut/systemd what I did is just took mkinitrd result, unpacked, added
my script to it, and modified init to run it and then reboot. With dracut I was
hoping to try to reuse it as much as possible, as to run grub2-editenv I need
/boot mounted - means device detection and that's something I have to use
dracut/udev for.

I have the following ideas so far:
- just stick my code somehow into mount triggers, and when root is mounted
  mount /boot, run, and then reboot -f
- stick my code into pre-pivot (mount /boot and edit env etc), then instead of
  initrd-switch-root.target do reboot.target

I was wondering if there are better and/or cleaner ways for doing that (I'd
probably start implementing a module for the second one in the meantime).

Thanks!
--
This message represents the official view of the voices in my head.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Very specific initramfs image problem
       [not found] ` <20130731213716.GA5723-QlFyWrZdf16VhmCTJn09oNHuzzzSOjJt@public.gmane.org>
@ 2013-08-01  7:23   ` Harald Hoyer
  0 siblings, 0 replies; 2+ messages in thread
From: Harald Hoyer @ 2013-08-01  7:23 UTC (permalink / raw)
  To: Paul Komkoff; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 07/31/2013 11:37 PM, Paul Komkoff wrote:
> Good morning.
> 
> I'm trying to achieve a very specific thing and I'm wondering if you can point
> me in the right direction.
> 
> I have a system that sets up dual-boot workstations and makes grub the
> bootloader. Now, I need to provide 2 network boot targets: one that will set
> grub default to windows, another one to fedora. For that, I have a script that
> updates grubenv; now, I need to package it into initramfs.
> 
> Before dracut/systemd what I did is just took mkinitrd result, unpacked, added
> my script to it, and modified init to run it and then reboot. With dracut I was
> hoping to try to reuse it as much as possible, as to run grub2-editenv I need
> /boot mounted - means device detection and that's something I have to use
> dracut/udev for.
> 
> I have the following ideas so far:
> - just stick my code somehow into mount triggers, and when root is mounted
>   mount /boot, run, and then reboot -f

don't forget to umount before "reboot -f"

> - stick my code into pre-pivot (mount /boot and edit env etc), then instead of
>   initrd-switch-root.target do reboot.target
> 
> I was wondering if there are better and/or cleaner ways for doing that (I'd
> probably start implementing a module for the second one in the meantime).
> 
> Thanks!

Both solutions will work.

For Fedora >= 19, it's even simpler. Just add the option "x-initrd.mount" to the
/boot /etc/fstab entry. The
/usr/lib/systemd/system-generators/systemd-fstab-generator takes care of
generating a mount unit, after root is mounted. systemd mounts it as part of
initrd-fs.target.

See man dracut.bootup(7).

You can put your custom service in initrd.target.wants with:

After:  initrd-fs.target
Before: initrd-cleanup.service

/boot is mounted at that point of time.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-01  7:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-31 21:37 Very specific initramfs image problem Paul Komkoff
     [not found] ` <20130731213716.GA5723-QlFyWrZdf16VhmCTJn09oNHuzzzSOjJt@public.gmane.org>
2013-08-01  7:23   ` Harald Hoyer

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.