mkinitrd unification across distributions
 help / color / mirror / Atom feed
From: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Paul Komkoff <i@stingr.net>
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Very specific initramfs image problem
Date: Thu, 01 Aug 2013 09:23:08 +0200	[thread overview]
Message-ID: <51FA0CDC.3040606@redhat.com> (raw)
In-Reply-To: <20130731213716.GA5723-QlFyWrZdf16VhmCTJn09oNHuzzzSOjJt@public.gmane.org>

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.


      parent reply	other threads:[~2013-08-01  7:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=51FA0CDC.3040606@redhat.com \
    --to=harald-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=i@stingr.net \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox