dracut-055/

This commit is contained in:
emdee 2024-01-04 14:48:11 +00:00
parent 33a439173c
commit 974ea68865
620 changed files with 62991 additions and 0 deletions

View File

@ -0,0 +1,319 @@
Harald Hoyer <harald@redhat.com>
Victor Lowther <victor.lowther@gmail.com>
Jóhann B. Guðmundsson <johannbg@gmail.com>
Amadeusz Żołnowski <aidecoe@aidecoe.name>
Daniel Molkentin <daniel.molkentin@suse.com>
Hannes Reinecke <hare@suse.com>
Kairui Song <kasong@redhat.com>
Will Woods <wwoods@redhat.com>
Philippe Seewer <philippe.seewer@bfh.ch>
Warren Togami <wtogami@redhat.com>
Dave Young <dyoung@redhat.com>
Jeremy Katz <katzj@redhat.com>
Lukas Nykryn <lnykryn@redhat.com>
David Dillow <dave@thedillows.org>
Lubomir Rintel <lkundrak@v3.sk>
Michal Soltys <soltys@ziu.info>
Colin Guthrie <colin@mageia.org>
Amerigo Wang <amwang@redhat.com>
Thomas Renninger <trenn@suse.com>
Alexander Tsoy <alexander@tsoy.me>
Martin Wilck <mwilck@suse.de>
Frederick Grose <fgrose@sugarlabs.org>
WANG Chao <chaowang@redhat.com>
Yu Watanabe <watanabe.yu+github@gmail.com>
Andrey Borzenkov <arvidjaar@gmail.com>
Hans de Goede <hdegoede@redhat.com>
Jonathan Lebon <jonathan@jlebon.com>
Peter Jones <pjones@redhat.com>
Peter Robinson <pbrobinson@fedoraproject.org>
Andreas Thienemann <andreas@bawue.net>
Frantisek Sumsal <frantisek@sumsal.cz>
Fabian Vogt <fvogt@suse.com>
Nicolas Chauvet <kwizart@gmail.com>
Tomasz Paweł Gajc <tpgxyz@gmail.com>
Zoltán Böszörményi <zboszor@pr.hu>
Beniamino Galvani <bgalvani@redhat.com>
Colin Walters <walters@verbum.org>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
Xunlei Pang <xlpang@redhat.com>
Brian C. Lane <bcl@redhat.com>
Daniel Drake <drake@endlessm.com>
Renaud Métrich <rmetrich@redhat.com>
Angelo "pallotron" Failla <pallotron@fb.com>
Thomas Blume <thomas.blume@suse.com>
Ville Skyttä <ville.skytta@iki.fi>
Böszörményi Zoltán <zboszor@pr.hu>
Cristian Rodríguez <crrodriguez@opensuse.org>
Dan Horák <dhorak@redhat.com>
Javier Martinez Canillas <javierm@redhat.com>
Ondrej Mosnacek <omosnace@redhat.com>
Baoquan He <bhe@redhat.com>
Brendan Germain <brendan.germain@nasdaqomx.com>
David Tardon <dtardon@redhat.com>
Dusty Mabe <dusty@dustymabe.com>
Jonas Witschel <diabonas@gmx.de>
Leho Kraav <leho@kraav.com>
Marcos Mello <marcosfrm@gmail.com>
Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
Moritz Maxeiner <moritz@ucworks.org>
Nathan Rini <nate@ucar.edu>
Radek Vykydal <rvykydal@redhat.com>
Đoàn Trần Công Danh <congdanhqx@gmail.com>
Fabian Deutsch <fabiand@fedoraproject.org>
Kamil Rytarowski <n54@gmx.com>
Lidong Zhong <lidong.zhong@suse.com>
Marc Grimme <grimme@atix.de>
Mike Gilbert <floppym@gentoo.org>
NeilBrown <neilb@suse.de>
Peter Rajnoha <prajnoha@redhat.com>
Thorsten Behrens <tbehrens@suse.com>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
q66 <daniel@octaforge.org>
Adam Williamson <awilliam@redhat.com>
Chao Wang <chaowang@redhat.com>
Frederic Crozat <fcrozat@suse.com>
James Lee <jlee@thestaticvoid.com>
Jesse Keating <jkeating@redhat.com>
Milan Broz <mbroz@redhat.com>
Mimi Zohar <zohar@linux.vnet.ibm.com>
Norbert Lange <norbert.lange@andritz.com>
Roberto Sassu <roberto.sassu@polito.it>
Stefan Reimer <it@startux.de>
Takashi Iwai <tiwai@suse.de>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
Chapman Flack <g2@anastigmatix.net>
Chris Leech <cleech@redhat.com>
David Cantrell <dcantrell@redhat.com>
Dennis Gilmore <dennis@ausil.us>
Doan Tran Cong Danh <congdanhqx@gmail.com>
Gaël PORTAY <gael.portay@collabora.com>
Jan Synacek <jsynacek@redhat.com>
Jiri Konecny <jkonecny@redhat.com>
Jon Ander Hernandez <jonan.h@gmail.com>
Juan RP <xtraeme@gmail.com>
Lance Albertson <lance@osuosl.org>
Marian Ganisin <mganisin@redhat.com>
Matthias Gerstner <matthias.gerstner@suse.de>
Max Resch <resch.max@gmail.com>
Michael Ploujnikov <plouj@somanetworks.com>
Pratyush Anand <panand@redhat.com>
Silvio Fricke <silvio.fricke@gmail.com>
Steven Brudenell <steven.brudenell@gmail.com>
Stig Telfer <stelfer@cray.com>
Thomas Backlund <tmb@mageia.org>
Topi Miettinen <toiwoton@gmail.com>
Vasiliy Tolstov <v.tolstov@selfip.ru>
Wim Muskee <wimmuskee@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com>
Alex Harpin <development@landsofshadow.co.uk>
Alexey Shabalin <shaba@altlinux.org>
Ankit Kumar <ankit@linux.vnet.ibm.com>
Antony Messerli <amesserl@rackspace.com>
Chao Fan <cfan@redhat.com>
Daniel Cordero <dracut@0xdc.io>
Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Daniel Schaal <farbing@web.de>
Denis Silakov <dsilakov@virtuozzo.com>
Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Erwan Velu <erwan.velu@enovance.com>
Evgeny Vereshchagin <evvers@ya.ru>
Guido Trentalancia <guido@trentalancia.net>
Hari Bathini <hbathini@linux.vnet.ibm.com>
Ian Dall <ian@beware.dropbear.id.au>
Imran Haider <imran1008@gmail.com>
James Buren <ryuo@frugalware.org>
Jan Macku <jamacku@redhat.com>
Joey Boggs <jboggs@redhat.com>
Julian Wolf <juwolf@suse.com>
Koen Kooi <koen@dominion.thruhere.net>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Kyle McMartin <kmcmarti@redhat.com>
Luiz Angelo Daros de Luca <luizluca@gmail.com>
Lukas Wunner <lukas@wunner.de>
Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Marko Myllynen <myllynen@redhat.com>
Matthew Thode <mthode@mthode.org>
Michal Koutný <mkoutny@suse.com>
Mike Snitzer <snitzer@redhat.com>
Minfei Huang <mhuang@redhat.com>
Nikoli <nikoli@gmx.us>
Patrick Talbert <ptalbert@redhat.com>
Pedro Monreal <pmgdeb@gmail.com>
Petr Pavlu <petr.pavlu@suse.com>
Pingfan Liu <piliu@redhat.com>
Przemysław Rudy <prudy1@o2.pl>
Robert LeBlanc <robert@leblancnet.us>
Robert Scheck <robert@fedoraproject.org>
Stefan Berger <stefanb@linux.ibm.com>
Stefan Berger <stefanb@us.ibm.com>
Thomas Lange <lange@informatik.uni-koeln.de>
Till Maas <opensource@till.name>
Tony Asleson <tasleson@redhat.com>
Vivek Goyal <vgoyal@redhat.com>
Vladislav Bogdanov <bubble@hoster-ok.com>
Érico Rolim <erico.erc@gmail.com>
наб <nabijaczleweli@nabijaczleweli.xyz>
A. Wilcox <AWilcox@Wilcox-Tech.com>
Adam Alves <adamoa@gmail.com>
Alexander Kurtz <alexander@kurtz.be>
Alexander Miroshnichenko <alex@millerson.name>
Alexander Sosedkin <asosedkin@redhat.com>
Alexander Todorov <atodorov@redhat.com>
Alexey Kodanev <alexey.kodanev@oracle.com>
Andreas Schwab <schwab@suse.de>
Andreas Stieger <astieger@suse.com>
Andrew J. Hesford <ajh@sideband.org>
Andy Lutomirski <luto@mit.edu>
Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
Anssi Hannula <anssi@mageia.org>
Antz <antzz@protonmail.ch>
Arnaud Rebillout <arnaud.rebillout@collabora.com>
Artem Savkov <asavkov@redhat.com>
Attila Bruncsak <bruncsak@users.noreply.github.com>
B. Wilson <x@wilsonb.com>
Ben Howard <ben.howard@redhat.com>
Benjamin Marzinski <bmarzins@redhat.com>
Brandon Philips <brandon@ifup.co>
Bruno E. O. Meneguele <bmeneg@redhat.com>
Bryn M. Reeves <bmr@redhat.com>
Canek Peláez Valdés <caneko@gmail.com>
Carlo Caione <carlo@endlessm.com>
Chad Dupuis <chad.dupuis@cavium.com>
Christian Heinz <christian.ch.heinz@gmail.com>
Cong Wang <amwang@redhat.com>
Dan Fuhry <dfuhry@datto.com>
Dave Jones <davej@redhat.com>
David Disseldorp <ddiss@suse.de>
David Hildenbrand <david@redhat.com>
David Michael <david.michael@coreos.com>
Denis Volkov <denis@simpletexting.net>
Dennis Schridde <devurandom@gmx.net>
Derek Hageman <hageman@inthat.cloud>
Derek Higgins <derekh@redhat.com>
Donovan Tremura <neurognostic@protonmail.ch>
Duane Griffin <duaneg@dghda.com>
Elan Ruusamäe <glen@delfi.ee>
Enno Boland <g@s01.de>
Enzo Matsumiya <ematsumiya@suse.de>
Eugene S. Sobolev <sobolev@protei.ru>
Eugene Syromiatnikov <esyr@redhat.com>
Evgeni Golov <evgeni@golov.de>
Fabian Vogt <fvogt@suse.de>
Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
Florian Gamböck <mail@floga.de>
Frank Deng <frank.deng@oracle.com>
François Cami <fcami@fedoraproject.org>
Gerd von Egidy <gerd.von.egidy@intra2net.com>
Glen Gray <slaine@slaine.org>
GuoChuang <guo.chuang@zte.com.cn>
HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Hendrik Brueckner <brueckner@linux.ibm.com>
Hermann Gausterer <git-dracut-2012@mrq1.org>
Hiroaki Mizuguchi <hiroaki-m@iij.ad.jp>
Hongxu Jia <hongxu.jia@windriver.com>
Hui Wang <john.wanghui@huawei.com>
Ignaz Forster <iforster@suse.com>
Jacob Wen <jian.w.wen@oracle.com>
James Laska <jlaska@redhat.com>
Jan Stodola <jstodola@redhat.com>
Jaroslav Jindrak <dzejrou@gmail.com>
Jason Dana <jasondana@quarksecurity.com>
Jens Heise <46450477+heisej@users.noreply.github.com>
Jeremy Linton <lintonrjeremy@gmail.com>
Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com>
Johannes Thumshirn <jthumshirn@suse.com>
Jonas Jelten <jj@sft.lol>
Jonas Jonsson <jonas@websystem.se>
Jonas Witschel <diabonas@archlinux.org>
Kevin Yung <Kevin.Yung@myob.com>
Lars R. Damerow <lars@pixar.com>
Lars Wendler <polynomial-c@gentoo.org>
Lee Duncan <lduncan@suse.com>
Lennart Poettering <lennart@poettering.net>
Lennert Buytenhek <buytenh@wantstofly.org>
Lev Veyde <lveyde@redhat.com>
Lianbo Jiang <lijiang@redhat.com>
Lucas C. Villa Real <lucasvr@gmail.com>
Major Hayden <major@mhtx.net>
Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Marian Csontos <mcsontos@redhat.com>
Mark Fasheh <mfasheh@suse.de>
Matt <smoothsailing72@hotmail.com>
Matt Smith <shadowfax@gmx.com>
Mei Liu <liumbj@linux.vnet.ibm.com>
Michael Chapman <mike@very.puzzling.org>
Michael McCracken <michael.mccracken@gmail.com>
Michal Schmidt <mschmidt@redhat.com>
Michal Sekletar <msekleta@redhat.com>
Mike Gorse <mgorse@suse.com>
Moritz 'Morty' Strübe <morty@gmx.net>
Munehiro Matsuda <haro@kgt.co.jp>
Nicolas Porcel <nicolasporcel06@gmail.com>
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Olivier Blin <dev@blino.org>
Ondrej Dubaj <odubaj@redhat.com>
P J P <ppandit@redhat.com>
Paolo Bonzini <pbonzini@redhat.com>
Paul Robins <exp@users.noreply.github.com>
Pavel Zhukov <pzhukov@redhat.com>
Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
Pekka Wallendahl <wyrmiyu@gmail.com>
Peter Georg <peter.georg@physik.uni-regensburg.de>
Peter Levine <plevine457@gmail.com>
Petr Tesarik <ptesarik@suse.com>
Petr Vorel <pvorel@suse.cz>
Prarit Bhargava <prarit@redhat.com>
Praveen_Paladugu@Dell.com <Praveen_Paladugu@Dell.com>
Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk>
Robert Buchholz <rbu@goodpoint.de>
Ruben Kerkhof <ruben@rubenkerkhof.com>
Rumbaut Thomas <Thomas.Rumbaut@digipolis.gent>
Rusty Bird <rustybird@openmailbox.org>
Sebastian Mitterle <smitterl@redhat.com>
Sergei Iudin <tsipa740@gmail.com>
Sergey Fionov <fionov@gmail.com>
Shawn W Dunn <sfalken@opensuse.org>
Srinivasa T N <seenutn@linux.vnet.ibm.com>
Stijn Hoop <stijn@sandcat.nl>
Sullivan (CTR), Austin <austin.sullivan.ctr@progeny.net>
Thierry Vignaud <thierry.vignaud@gmail.com>
Thilo Bangert <thilo.bangert@gmx.net>
Thomas Abraham <tabraham@suse.com>
Tobias Geerinckx <tobias.geerinckx@gmail.com>
Tobias Klauser <tklauser@distanz.ch>
Tom Gundersen <teg@jklm.no>
Tomasz Torcz <tomek@pipebreaker.pl>
Tong Li <tonli@redhat.com>
Vadim Kuznetsov <vadimk@gentoo.org>
Vaughan Cao <vaughan.cao@oracle.com>
Vladius25 <vkorol2509@icloud.com>
Vratislav Podzimek <vpodzime@redhat.com>
Yang Liu <50459973+ly4096x@users.noreply.github.com>
Yanko Kaneti <yaneti@declera.com>
Zhiguo Deng <bjzgdeng@linux.vnet.ibm.com>
Ziyue Yang <ziyang@redhat.com>
foopub <45460217+foopub@users.noreply.github.com>
gaoyi <ymuemc@163.com>
honza801 <honza801@gmail.com>
jbash aka John Bashinski <jbash@velvet.com>
jloeser <jloeser@suse.de>
johannes <johannes.brechtmann@gmail.com>
jonathan-teh <30538043+jonathan-teh@users.noreply.github.com>
leo-lb <lle-bout@zaclys.net>
logan <logancaldwell23@gmail.com>
masem <matej.semian@gmail.com>
maximilian attems <max@stro.at>
mulhern <amulhern@redhat.com>
mwberry <mwberry@users.noreply.github.com>
nabijaczleweli <nabijaczleweli@gmail.com>
privb0x23 <privb0x23@users.noreply.github.com>
realtime-neil <neil@rtr.ai>
xtraeme <xtraeme@voidlinux.eu>
Дамјан Георгиевски <gdamjan@gmail.com>

View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -0,0 +1,328 @@
-include dracut-version.sh
DRACUT_MAIN_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CWD)/.. git describe --abbrev=0 --tags --always 2>/dev/null || :)
ifeq ($(DRACUT_MAIN_VERSION),)
DRACUT_MAIN_VERSION = $(DRACUT_VERSION)
endif
DRACUT_FULL_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CWD)/.. git describe --tags --always 2>/dev/null || :)
ifeq ($(DRACUT_FULL_VERSION),)
DRACUT_FULL_VERSION = $(DRACUT_VERSION)
endif
HAVE_SHELLCHECK ?= $(shell which shellcheck >/dev/null 2>&1 && echo yes)
HAVE_SHFMT ?= $(shell which shfmt >/dev/null 2>&1 && echo yes)
HAVE_RPMBUILD ?= $(shell which rpmbuild >/dev/null 2>&1 && echo yes)
-include Makefile.inc
KVERSION ?= $(shell uname -r)
prefix ?= /usr
libdir ?= ${prefix}/lib
datadir ?= ${prefix}/share
pkglibdir ?= ${libdir}/dracut
sysconfdir ?= ${prefix}/etc
bindir ?= ${prefix}/bin
mandir ?= ${prefix}/share/man
CFLAGS ?= -O2 -g -Wall -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
bashcompletiondir ?= ${datadir}/bash-completion/completions
pkgconfigdatadir ?= $(datadir)/pkgconfig
man1pages = man/lsinitrd.1
man5pages = man/dracut.conf.5
man7pages = man/dracut.cmdline.7 \
man/dracut.bootup.7 \
man/dracut.modules.7
man8pages = man/dracut.8 \
man/dracut-catimages.8 \
modules.d/98dracut-systemd/dracut-cmdline.service.8 \
modules.d/98dracut-systemd/dracut-initqueue.service.8 \
modules.d/98dracut-systemd/dracut-mount.service.8 \
modules.d/98dracut-systemd/dracut-shutdown.service.8 \
modules.d/98dracut-systemd/dracut-pre-mount.service.8 \
modules.d/98dracut-systemd/dracut-pre-pivot.service.8 \
modules.d/98dracut-systemd/dracut-pre-trigger.service.8 \
modules.d/98dracut-systemd/dracut-pre-udev.service.8
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
.PHONY: install clean archive rpm srpm testimage test all check AUTHORS CONTRIBUTORS doc dracut-version.sh
all: dracut-version.sh dracut.pc dracut-install src/skipcpio/skipcpio dracut-util
%.o : %.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(KMOD_CFLAGS) $< -o $@
DRACUT_INSTALL_OBJECTS = \
src/install/dracut-install.o \
src/install/hashmap.o\
src/install/log.o \
src/install/strv.o \
src/install/util.o
# deps generated with gcc -MM
src/install/dracut-install.o: src/install/dracut-install.c src/install/log.h src/install/macro.h \
src/install/hashmap.h src/install/util.h
src/install/hashmap.o: src/install/hashmap.c src/install/util.h src/install/macro.h src/install/log.h \
src/install/hashmap.h
src/install/log.o: src/install/log.c src/install/log.h src/install/macro.h src/install/util.h
src/install/util.o: src/install/util.c src/install/util.h src/install/macro.h src/install/log.h
src/install/strv.o: src/install/strv.c src/install/strv.h src/install/util.h src/install/macro.h src/install/log.h
src/install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(FTS_LIBS) $(KMOD_LIBS)
logtee: src/logtee/logtee.c
$(CC) $(LDFLAGS) -o $@ $<
dracut-install: src/install/dracut-install
ln -fs $< $@
SKIPCPIO_OBJECTS = src/skipcpio/skipcpio.o
skipcpio/skipcpio.o: src/skipcpio/skipcpio.c
skipcpio/skipcpio: $(SKIPCPIO_OBJECTS)
UTIL_OBJECTS = src/util/util.o
util/util.o: src/util/util.c
util/util: $(UTIL_OBJECTS)
dracut-util: src/util/util
cp -a $< $@
.PHONY: indent-c
indent-c:
astyle -n --quiet --options=.astylerc $(wildcard *.[ch] */*.[ch] src/*/*.[ch])
.PHONY: indent
indent: indent-c
ifeq ($(HAVE_SHFMT),yes)
shfmt -w -s .
endif
doc: $(manpages) dracut.html
ifneq ($(enable_documentation),no)
all: doc
endif
%: %.xml
@rm -f -- "$@"
xsltproc -o "$@" -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
%.xml: %.asc
@rm -f -- "$@"
asciidoc -a "version=$(DRACUT_FULL_VERSION)" -d manpage -b docbook -o "$@" $<
dracut.8: man/dracut.8.asc \
man/dracut.usage.asc
dracut.html: man/dracut.asc $(manpages) docs/dracut.css man/dracut.usage.asc
@rm -f -- dracut.xml
asciidoc -a "mainversion=$(DRACUT_MAIN_VERSION)" \
-a "version=$(DRACUT_FULL_VERSION)" \
-a numbered \
-d book -b docbook -o dracut.xml man/dracut.asc
@rm -f -- dracut.html
xsltproc -o dracut.html --xinclude -nonet \
--stringparam custom.css.source docs/dracut.css \
--stringparam generate.css.header 1 \
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
@rm -f -- dracut.xml
dracut.pc: Makefile.inc Makefile
@echo "Name: dracut" > dracut.pc
@echo "Description: dracut" >> dracut.pc
@echo "Version: $(DRACUT_FULL_VERSION)" >> dracut.pc
@echo "dracutdir=$(pkglibdir)" >> dracut.pc
@echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc
@echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc
install: all
mkdir -p $(DESTDIR)$(pkglibdir)
mkdir -p $(DESTDIR)$(bindir)
mkdir -p $(DESTDIR)$(sysconfdir)
mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
mkdir -p $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man7 $(DESTDIR)$(mandir)/man8
install -m 0755 dracut.sh $(DESTDIR)$(bindir)/dracut
install -m 0755 dracut-catimages.sh $(DESTDIR)$(bindir)/dracut-catimages
install -m 0755 lsinitrd.sh $(DESTDIR)$(bindir)/lsinitrd
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
mkdir -p $(DESTDIR)$(pkglibdir)/dracut.conf.d
install -m 0755 dracut-init.sh $(DESTDIR)$(pkglibdir)/dracut-init.sh
install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
install -m 0755 dracut-logger.sh $(DESTDIR)$(pkglibdir)/dracut-logger.sh
install -m 0755 dracut-initramfs-restore.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-restore
cp -arx modules.d $(DESTDIR)$(pkglibdir)
ifneq ($(enable_documentation),no)
for i in $(man1pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man1/$${i##*/}; done
for i in $(man5pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man5/$${i##*/}; done
for i in $(man7pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man7/$${i##*/}; done
for i in $(man8pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man8/$${i##*/}; done
ln -fs dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
endif
if [ -n "$(systemdsystemunitdir)" ]; then \
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants; \
ln -s ../dracut-shutdown.service \
$(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/dracut-shutdown.service; \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants; \
for i in \
dracut-cmdline.service \
dracut-initqueue.service \
dracut-mount.service \
dracut-pre-mount.service \
dracut-pre-pivot.service \
dracut-pre-trigger.service \
dracut-pre-udev.service \
; do \
[ -e $(DESTDIR)$(systemdsystemunitdir) ] && continue; \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/$$i $(DESTDIR)$(systemdsystemunitdir); \
ln -s ../$$i \
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$$i; \
done \
fi
if [ -f src/install/dracut-install ]; then \
install -m 0755 src/install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
fi
if [ -f src/skipcpio/skipcpio ]; then \
install -m 0755 src/skipcpio/skipcpio $(DESTDIR)$(pkglibdir)/skipcpio; \
fi
if [ -f dracut-util ]; then \
install -m 0755 dracut-util $(DESTDIR)$(pkglibdir)/dracut-util; \
fi
mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d
install -m 0755 install.d/50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
install -m 0755 install.d/51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install
mkdir -p $(DESTDIR)${bashcompletiondir}
install -m 0644 shell-completion/bash/dracut $(DESTDIR)${bashcompletiondir}/dracut
install -m 0644 shell-completion/bash/lsinitrd $(DESTDIR)${bashcompletiondir}/lsinitrd
mkdir -p $(DESTDIR)${pkgconfigdatadir}
install -m 0644 dracut.pc $(DESTDIR)${pkgconfigdatadir}/dracut.pc
dracut-version.sh:
@rm -f dracut-version.sh
@printf "#!/bin/sh\n# shellcheck disable=SC2034\nDRACUT_VERSION=%s\n" "$(DRACUT_FULL_VERSION)" > dracut-version.sh
clean:
$(RM) *~
$(RM) */*~
$(RM) */*/*~
$(RM) $(manpages:%=%.xml) dracut.xml
$(RM) test-*.img
$(RM) dracut-*.rpm dracut-*.tar.bz2 dracut-*.tar.xz
$(RM) dracut-version.sh
$(RM) dracut-install src/install/dracut-install $(DRACUT_INSTALL_OBJECTS)
$(RM) skipcpio/skipcpio $(SKIPCPIO_OBJECTS)
$(RM) dracut-util util/util $(UTIL_OBJECTS)
$(RM) $(manpages) dracut.html
$(RM) dracut.pc
$(MAKE) -C test clean
dist: dracut-$(DRACUT_MAIN_VERSION).tar.xz
dracut-$(DRACUT_MAIN_VERSION).tar.xz: doc syncheck
@echo "DRACUT_VERSION=$(DRACUT_MAIN_VERSION)" > dracut-version.sh
git archive --format=tar $(DRACUT_MAIN_VERSION) --prefix=dracut-$(DRACUT_MAIN_VERSION)/ > dracut-$(DRACUT_MAIN_VERSION).tar
mkdir -p dracut-$(DRACUT_MAIN_VERSION)
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(DRACUT_MAIN_VERSION)/$${i%/*}"; cp "$$i" "dracut-$(DRACUT_MAIN_VERSION)/$$i"; done
tar --owner=root --group=root -rf dracut-$(DRACUT_MAIN_VERSION).tar $$(find dracut-$(DRACUT_MAIN_VERSION) -type f)
rm -fr -- dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut-$(DRACUT_MAIN_VERSION)
xz -9 dracut-$(DRACUT_MAIN_VERSION).tar
rm -f -- dracut-$(DRACUT_MAIN_VERSION).tar
ifeq ($(HAVE_RPMBUILD),yes)
rpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
rpmbuild=$$(mktemp -d -p /var/tmp rpmbuild-dracut.XXXXXX); src=$$(pwd); \
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
LC_MESSAGES=C $$src/tools/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < pkgbuild/dracut.spec > $$rpmbuild/dracut.spec; \
(cd "$$rpmbuild"; \
wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
( mv "$$rpmbuild"/{,$$(uname -m)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
srpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
LC_MESSAGES=C $$src/tools/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < pkgbuild/dracut.spec > $$rpmbuild/dracut.spec; \
(cd "$$rpmbuild"; \
[ -f $$src/lgpl-2.1.txt ] && cp $$src/lgpl-2.1.txt . || wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
--define "_rpmdir $$PWD" -bs dracut.spec; ) && \
( mv "$$rpmbuild"/*.src.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
else
.PHONY: rpm srpm
rpm: syncheck
srpm: syncheck
endif
syncheck:
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
[ "$${i##*/}" = "module-setup.sh" ] && continue; \
read line < "$$i"; [ "$${line#*bash*}" != "$$line" ] && continue; \
[ $$V ] && echo "posix syntax check: $$i"; bash --posix -n "$$i" ; ret=$$(($$ret+$$?)); \
[ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi; \
[ $$V ] && echo "checking for echo -n: $$i"; if grep -Fq 'echo -n ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains echo -n"; fi \
done;exit $$ret
@ret=0;for i in *.sh modules.d/*/*.sh modules.d/*/module-setup.sh; do \
[ $$V ] && echo "bash syntax check: $$i"; bash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
ifeq ($(HAVE_SHELLCHECK),yes)
ifeq ($(HAVE_SHFMT),yes)
shellcheck $$(shfmt -f .)
else
find . -name '*.sh' -print0 | xargs -0 shellcheck
endif
endif
check: all syncheck rpm
@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
@$(MAKE) -C test check
testimage: all
./dracut.sh -N -l -a debug -f test-$(KVERSION).img $(KVERSION)
@echo wrote test-$(KVERSION).img
debugtestimage: all
./dracut.sh --debug -l -a debug -f test-$(KVERSION).img $(KVERSION)
@echo wrote test-$(KVERSION).img
testimages: all
./dracut.sh -l -a debug --kernel-only -f test-kernel-$(KVERSION).img $(KVERSION)
@echo wrote test-$(KVERSION).img
./dracut.sh -l -a debug --no-kernel -f test-dracut.img $(KVERSION)
@echo wrote test-dracut.img
debughostimage: all
./dracut.sh --debug -H -l -f test-$(KVERSION).img $(KVERSION)
@echo wrote test-$(KVERSION).img
hostimage: all
./dracut.sh -H -l -f test-$(KVERSION).img $(KVERSION)
@echo wrote test-$(KVERSION).img
efi: all
./dracut.sh --uefi -H -l -f linux-$(KVERSION).efi $(KVERSION)
@echo wrote linux-$(KVERSION).efi
AUTHORS:
git shortlog --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo $$rest;done > AUTHORS
CONTRIBUTORS:
@git shortlog $(DRACUT_MAIN_VERSION).. --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo "- $$rest";done
dracut.html.sign: dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html
gpg-sign-all dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html
upload: dracut.html.sign
kup put dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut-$(DRACUT_MAIN_VERSION).tar.sign /pub/linux/utils/boot/dracut/
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/

View File

@ -0,0 +1,11 @@
prefix ?= /usr/local
libdir ?= /usr/local/lib
datadir ?= /usr/local/share
sysconfdir ?= /usr/local/etc
sbindir ?= /usr/local/sbin
mandir ?= /usr/local/share/man
enable_documentation ?= yes
bindir ?= /usr/local/bin
KMOD_CFLAGS ?=
KMOD_LIBS ?= -lkmod
FTS_LIBS ?= -lc

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
dracut
====
dracut is an event driven initramfs infrastructure.
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](.github/CODE_OF_CONDUCT.md)
[![Fedora-32](https://github.com/dracutdevs/dracut/workflows/Fedora-32/badge.svg?branch=master)](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-32)
[![Fedora-33](https://github.com/dracutdevs/dracut/workflows/Fedora-33/badge.svg?branch=master)](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-33)
[![Fedora-latest](https://github.com/dracutdevs/dracut/workflows/Fedora-latest/badge.svg?branch=master)](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-latest)
dracut (the tool) is used to create an initramfs image by copying tools
and files from an installed system and combining it with the
dracut framework, usually found in /usr/lib/dracut/modules.d.
Unlike other implementations, dracut hard-codes as little
as possible into the initramfs. The initramfs has
(basically) one purpose in life -- getting the rootfs mounted so that
we can transition to the real rootfs. This is all driven off of
device availability. Therefore, instead of scripts hard-coded to do
various things, we depend on udev to create device nodes for us and
then when we have the rootfs's device node, we mount and carry on.
This helps to keep the time required in the initramfs as little as
possible so that things like a 5 second boot aren't made impossible as
a result of the very existence of an initramfs.
Most of the initramfs generation functionality in dracut is provided by a bunch
of generator modules that are sourced by the main dracut script to install
specific functionality into the initramfs. They live in the modules.d
subdirectory, and use functionality provided by dracut-functions to do their
work.
Currently dracut lives on github.com and kernel.org.
The tarballs can be found here:
http://www.kernel.org/pub/linux/utils/boot/dracut/
ftp://ftp.kernel.org/pub/linux/utils/boot/dracut/
Git:
https://github.com/dracutdevs/dracut.git
http://git.kernel.org/?p=boot/dracut/dracut.git
Project Documentation:
http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
Project Wiki:
http://dracut.wiki.kernel.org
See the github issue tracker for things which still need to be done and HACKING.md
for some instructions on how to get started. There is also a mailing list
that is being used for the discussion -- initramfs@vger.kernel.org.
It is a typical vger list, send mail to majordomo@vger.kernel.org with body
of 'subscribe initramfs email@host.com'
Licensed under the GPLv2

View File

@ -0,0 +1,131 @@
#!/bin/bash
# We don't support srcdir != builddir
echo \#buildapi-variable-no-builddir > /dev/null
prefix=/usr
enable_documentation=yes
CC="${CC:-cc}"
PKG_CONFIG="${PKG_CONFIG:-pkg-config}"
# Little helper function for reading args from the commandline.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
read_arg() {
# $1 = arg name
# $2 = arg value
# $3 = arg parameter
local rematch='^[^=]*=(.*)$'
if [[ $2 =~ $rematch ]]; then
read -r "$1" <<< "${BASH_REMATCH[1]}"
else
read -r "$1" <<< "$3"
# There is no way to shift our callers args, so
# return 1 to indicate they should do it instead.
return 1
fi
return 0
}
while (($# > 0)); do
case "${1%%=*}" in
--prefix) read_arg prefix "$@" || shift ;;
--libdir) read_arg libdir "$@" || shift ;;
--datadir) read_arg datadir "$@" || shift ;;
--sysconfdir) read_arg sysconfdir "$@" || shift ;;
--sbindir) read_arg sbindir "$@" || shift ;;
--mandir) read_arg mandir "$@" || shift ;;
--disable-documentation) enable_documentation=no ;;
--program-prefix) read_arg programprefix "$@" || shift ;;
--exec-prefix) read_arg execprefix "$@" || shift ;;
--bindir) read_arg bindir "$@" || shift ;;
--includedir) read_arg includedir "$@" || shift ;;
--libexecdir) read_arg libexecdir "$@" || shift ;;
--localstatedir) read_arg localstatedir "$@" || shift ;;
--sharedstatedir) read_arg sharedstatedir "$@" || shift ;;
--infodir) read_arg infodir "$@" || shift ;;
--systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift ;;
--bashcompletiondir) read_arg bashcompletiondir "$@" || shift ;;
*) echo "Ignoring unknown option '$1'" ;;
esac
shift
done
if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
echo "dracut needs pkg-config and libkmod >= 23." >&2
exit 1
fi
cat << EOF > conftest.c
#include <fts.h>
int main() {
return 0;
}
EOF
# shellcheck disable=SC2086
${CC} $CFLAGS $LDFLAGS conftest.c > /dev/null 2>&1
ret=$?
rm -f conftest.c a.out
# musl doesn't have fts.h included
if test $ret -ne 0; then
echo "dracut needs fts development files." >&2
exit 1
fi
cat << EOF > conftest.c
#include <fts.h>
int main(void) {
fts_open(0, 0, 0);
return 0;
}
EOF
found=no
for lib in "-lc" "-lfts"; do
# shellcheck disable=SC2086
${CC} $CFLAGS $LDFLAGS conftest.c -Wl,$lib > /dev/null 2>&1
ret=$?
if test $ret -eq 0; then
FTS_LIBS="$lib"
found=yes
break
fi
done
rm -f conftest.c a.out
if test $found = no; then
echo "dracut couldn't find usable fts library" >&2
exit 1
fi
cat > Makefile.inc.$$ << EOF
prefix ?= ${prefix}
libdir ?= ${libdir:-${prefix}/lib}
datadir ?= ${datadir:-${prefix}/share}
sysconfdir ?= ${sysconfdir:-${prefix}/etc}
sbindir ?= ${sbindir:-${prefix}/sbin}
mandir ?= ${mandir:-${prefix}/share/man}
enable_documentation ?= ${enable_documentation:-yes}
bindir ?= ${bindir:-${prefix}/bin}
KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
FTS_LIBS ?= ${FTS_LIBS}
EOF
{
[[ $programprefix ]] && echo "programprefix ?= ${programprefix}"
[[ $execprefix ]] && echo "execprefix ?= ${execprefix}"
[[ $includedir ]] && echo "includedir ?= ${includedir}"
[[ $libexecdir ]] && echo "libexecdir ?= ${libexecdir}"
[[ $localstatedir ]] && echo "localstatedir ?= ${localstatedir}"
[[ $sharedstatedir ]] && echo "sharedstatedir ?= ${sharedstatedir}"
[[ $infodir ]] && echo "infodir ?= ${infodir}"
[[ $systemdsystemunitdir ]] && echo "systemdsystemunitdir ?= ${systemdsystemunitdir}"
[[ $bashcompletiondir ]] && echo "bashcompletiondir ?= ${bashcompletiondir}"
} >> Makefile.inc.$$
mv Makefile.inc.$$ Makefile.inc

View File

@ -0,0 +1,213 @@
# BASH Notes
## basename
Don't use `basename`, use:
```shell
file=${path##*/}
```
## dirname
Don't use `dirname`, use:
```shell
dir=${path%/*}
```
## shopt
If you set `shopt` in a function, reset to its default state with `trap`:
```shell
func() {
trap "$(shopt -p nullglob globstar)" RETURN
shopt -q -s nullglob globstar
}
```
## find, grep, print0, -0, -z
Don't use `find` in `for` loops, because filenames can contain spaces.
Try to use `globstar` and `nullglob` or null byte terminated strings.
Instead of:
```shell
func() {
for file in $(find /usr/lib* -type f -name 'lib*.a' -print0 ); do
echo $file
done
}
```
use:
```shell
func() {
trap "$(shopt -p nullglob globstar)" RETURN
shopt -q -s nullglob globstar
for file in /usr/lib*/**/lib*.a; do
[[ -f $file ]] || continue
echo "$file"
done
}
```
Or collect the filenames in an array, if you need them more than once:
```shell
func() {
trap "$(shopt -p nullglob globstar)" RETURN
shopt -q -s nullglob globstar
filenames=( /usr/lib*/**/lib*.a )
for file in "${filenames[@]}"; do
[[ -f $file ]] || continue
echo "$file"
done
}
```
Or, if you really want to use `find`, use `-print0` and an array:
```shell
func() {
mapfile -t -d '' filenames < <(find /usr/lib* -type f -name 'lib*.a' -print0)
for file in "${filenames[@]}"; do
echo "$file"
done
}
```
Note: `-d ''` is the same as `-d $'\0'` and sets the null byte as the delimiter.
or:
```shell
func() {
find /usr/lib* -type f -name 'lib*.a' -print0 | while read -r -d '' file; do
echo "$file"
done
}
```
or
```shell
func() {
while read -r -d '' file; do
echo "$file"
done < <(find /usr/lib* -type f -name 'lib*.a' -print0)
}
```
Use the tool options for null terminated strings, like `-print0`, `-0`, `-z`, etc.
## prefix or suffix array elements
Instead of:
```shell
func() {
other-cmd $(for k in "$@"; do echo "prefix-$k"; done)
}
```
do
```shell
func() {
other-cmd "${@/#/prefix-}"
}
```
or suffix:
```shell
func() {
other-cmd "${@/%/-suffix}"
}
```
## Join array elements with a separator char
Here we have an associate array `_drivers`, where we want to print the keys separated by ',':
```shell
if [[ ${!_drivers[*]} ]]; then
echo "rd.driver.pre=$(IFS=, ;echo "${!_drivers[*]}")" > "${initdir}"/etc/cmdline.d/00-watchdog.conf
fi
```
## Optional parameters to commands
If you want to call a command `cmd` with an option, if a variable is set, rather than doing:
```shell
func() {
local param="$1"
if [[ $param ]]; then
param="--this-special-option $param"
fi
cmd $param
}
```
do it like this:
```shell
func() {
local param="$1"
cmd ${param:+--this-special-option "$param"}
}
# cmd --this-special-option 'abc'
func 'abc'
# cmd
func ''
# cmd
func
```
If you want to specify the option even with an empty string do this:
```shell
func() {
local -a special_params
if [[ ${1+_} ]]; then
# only declare `param` if $1 is set (even as null string)
local param="$1"
fi
# check if `param` is set (even as null string)
if [[ ${param+_} ]]; then
special_params=( --this-special-option "${param}" )
fi
cmd ${param+"${special_params[@]}"}
}
# cmd --this-special-option 'abc'
func 'abc'
# cmd --this-special-option ''
func ''
# cmd
func
```
Or more simple, if you only have to set an option:
```shell
func() {
if [[ ${1+_} ]]; then
# only declare `param` if $1 is set (even as null string)
local param="$1"
fi
cmd ${param+--this-special-option}
}
# cmd --this-special-option
func 'abc'
# cmd --this-special-option
func ''
# cmd
func
```

View File

@ -0,0 +1,56 @@
# Dracut Code of Conduct
This code of conduct outlines our expectations for participants within the Dracut community, as well as steps for reporting unacceptable behavior.
We are committed to providing a welcoming and inspiring community for all and expect our code of conduct to be honored.
Anyone who violates this code of conduct may be banned from the community.
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainer responsible for enforcement Harald Hoyer <harald@redhat.com>.
All complaints will be reviewed and investigated promptly and fairly and will result in a response that is deemed necessary and appropriate to the circumstances.
Project maintainers are obligated to respect the privacy and security of the reporter of any incident.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq.
Translations are available at https://www.contributor-covenant.org/translations.

View File

@ -0,0 +1,278 @@
# Dracut Developer Guidelines
## git
Currently dracut lives on github.com and kernel.org.
* https://github.com/dracutdevs/dracut.git
* https://git.kernel.org/pub/scm/boot/dracut/dracut.git
Pull requests should be filed preferably on github nowadays.
### Code Format
It is recommended, that you install a plugin for your editor, which reads in `.editorconfig`.
Additionally `emacs` and `vim` config files are provided for convenience.
To reformat C files use `astyle`:
```console
$ astyle --options=.astylerc <FILE>
```
For convenience there is also a Makefile `indent-c` target `make indent-c`.
To reformat shell files use `shfmt`:
```console
$ shfmt_version=3.2.4
$ wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O shfmt
$ chmod u+x shfmt
$ ./shfmt -w -s .
```
or
```console
$ GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt
$ $GOPATH/bin/shfmt -w -s .
```
or if `shfmt` is already in your `PATH`, use `make indent`.
Some IDEs already have support for shfmt.
For convenience the `make indent` Makefile target also calls shfmt, if it is in `$PATH`.
### Commit Messages
Commit messages should answer these questions:
* What?: a short summary of what you changed in the subject line.
* Why?: what the intended outcome of the change is (arguably the most important piece of information that should go into a message).
* How?: if multiple approaches for achieving your goal were available, you also want to explain why you chose the used implementation strategy.
Note that you should not explain how your change achieves your goal in your commit message.
That should be obvious from the code itself.
If you cannot achieve that clarity with the used programming language, use comments within the code instead.
The commit message is primarily the place for documenting the why.
Commit message titles should follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
Format is `<type>[optional scope]: <description>`, where `type` is one of:
* fix: A bug fix
* feat: A new feature
* perf: A code change that improves performance
* refactor: A code change that neither fixes a bug nor adds a feature
* style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* test: Adding missing tests or correcting existing tests
* docs: Documentation only changes
* revert: Reverts a previous commit
* chore: Other changes that don't modify src or test files
* build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
* ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
`scope` should be the module name (without numbers) or:
* cli: for the dracut command line interface
* rt: for the dracut initramfs runtime logic
* functions: for general purpose dracut functions
Commit messages are checked with [Commisery](https://github.com/tomtom-international/commisery).
## Writing modules
Some general rules for writing modules:
* Use one of the inst family of functions to actually install files
on to the initramfs. They handle mangling the pathnames and (for binaries,
scripts, and kernel modules) installing dependencies as appropriate so
you do not have to.
* Scripts that end up on the initramfs should be POSIX compliant. dracut
will try to use /bin/dash as /bin/sh for the initramfs if it is available,
so you should install it on your system -- dash aims for strict POSIX
compliance to the extent possible.
* Hooks MUST be POSIX compliant -- they are sourced by the init script,
and having a bashism break your user's ability to boot really sucks.
* Generator modules should have a two digit numeric prefix -- they run in
ascending sort order. Anything in the 90-99 range is stuff that dracut
relies on, so try not to break those hooks.
* Hooks must have a .sh extension.
* Generator modules are described in more detail later on.
* We have some breakpoints for debugging your hooks. If you pass 'rdbreak'
as a kernel parameter, the initramfs will drop to a shell just before
switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
will break just before hooks in that hookpoint run.
Also, there is an attempt to keep things as distribution-agnostic as
possible. Every distribution has their own tool here and it's not
something which is really interesting to have separate across them.
So contributions to help decrease the distro-dependencies are welcome.
Most of the functionality that dracut implements are actually implemented
by dracut modules. dracut modules live in modules.d, and have the following
structure:
```
dracut_install_dir/modules.d/
00modname/
module-setup.sh
check
<other files as needed by the hook>
```
`00modname`: The name of the module prefixed by a two-digit numeric sort code.
The numeric code must be present and in the range of 00 - 99.
Modules with lower numbers are installed first. This is important
because the dracut install functions (which install files onto
the initrd) refuse to overwrite already installed files. This makes
it easy for an earlier module to override the functionality of a
later module, so that you can have a distro or system specific
module override or modify the functionality of a generic module
without having to patch the more generic module.
`module-setup.sh`:
dracut sources this script to install the functionality that a
module implements onto the initrd. For the most part, this amounts
to copying files from the host system onto the initrd in a controlled
manner.
`install()`:
This function of module-setup.sh is called to install all
non-kernel files. dracut supplies several install functions that are
specialized for different file types. Browse through dracut-functions
fore more details. dracut also provides a $moddir variable if you
need to install a file from the module directory, such as an initrd
hook, a udev rule, or a specialized executable.
`installkernel()`:
This function of module-setup.sh is called to install all
kernel related files.
`check()`:
dracut calls this function to check and see if a module can be installed
on the initrd.
When called without options, check should check to make sure that
any files it needs to install into the initrd from the host system
are present. It should exit with a 0 if they are, and a 1 if they are
not.
When called with $hostonly set, it should perform the same check
that it would without it set, and it should also check to see if the
functionality the module implements is being used on the host system.
For example, if this module handles installing support for LUKS
encrypted volumes, it should return 0 if all the tools to handle
encrpted volumes are available and the host system has the root
partition on an encrypted volume, 1 otherwise.
`depends()`:
This function should output a list of dracut modules
that it relies upon. An example would be the nfs and iscsi modules,
which rely on the network module to detect and configure network
interfaces.
Any other files in the module will not be touched by dracut directly.
You are encouraged to provide a README that describes what the module is for.
### Hooks
init has the following hook points to inject scripts:
`/lib/dracut/hooks/cmdline/*.sh`
scripts for command line parsing
`/lib/dracut/hooks/pre-udev/*.sh`
scripts to run before udev is started
`/lib/dracut/hooks/pre-trigger/*.sh`
scripts to run before the main udev trigger is pulled
`/lib/dracut/hooks/initqueue/*.sh`
runs in parallel to the udev trigger
Udev events can add scripts here with /sbin/initqueue.
If /sbin/initqueue is called with the "--onetime" option, the script
will be removed after it was run.
If /lib/dracut/hooks/initqueue/work is created and udev >= 143 then
this loop can process the jobs in parallel to the udevtrigger.
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
Scripts can remove themselves from the initqueue by "rm $job".
`/lib/dracut/hooks/pre-mount/*.sh`
scripts to run before the root filesystem is mounted
Network filesystems like NFS that do not use device files are an
exception. Root can be mounted already at this point.
`/lib/dracut/hooks/mount/*.sh`
scripts to mount the root filesystem
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
`/lib/dracut/hooks/pre-pivot/*.sh`
scripts to run before latter initramfs cleanups
`/lib/dracut/hooks/cleanup/*.sh`
scripts to run before the real init is executed and the initramfs
disappears
All processes started before should be killed here.
## Testsuite
### Rootless in a container with podman
```console
$ cd <DRACUT_SOURCE>
$ podman pull [CONTAINER]
$ podman run --rm -it \
--cap-add=SYS_PTRACE --user 0 \
-v /dev:/dev -v ./:/dracut:z \
[CONTAINER] \
bash -l
# cd /dracut
# ./configure
# make -j $(getconf _NPROCESSORS_ONLN)
# cd test
# make V=1 SKIP="16 60 61" clean check
```
with `[CONTAINER]` being one of the
[github `dracutdevs` containers](https://github.com/orgs/dracutdevs/packages),
e.g. `ghcr.io/dracutdevs/fedora:latest`.
### On bare metal
For the testsuite to pass, you will have to install at least the software packages
mentioned in the `test/container` Dockerfiles.
```
$ sudo make clean check
```
in verbose mode:
```
$ sudo make V=1 clean check
```
only specific test:
```
$ sudo make TESTS="01 20 40" clean check
```
only runs the 01, 20 and 40 tests.
debug a specific test case:
```
$ cd TEST-01-BASIC
$ sudo make clean setup run
```
... change some kernel parameters in `test.sh` ...
```
$ sudo make run
```
to run the test without doing the setup.

View File

@ -0,0 +1,48 @@
Dracut supports running against a sysroot directory that is different
from the actual root (/) directory of the running system. It is most
useful for creating/bootstrapping a new system that may or may not be
using the same CPU architecture as the host system, i.e. building a
whole Linux system with a cross-compiler framework like Yocto.
The user-visible frontend change is the introduction of a new option
called "-r" or "--sysroot". It expects a directory that contains the
complete Linux system that has all the files (kernel drivers, firmware,
executables, libraries and others) necessary to construct the initramfs.
E.g: dracut --sysroot /path/to/sysroot initramfs.img kernelversion
To support this, a new global variable was introduced inside dracut.
This variable is called "dracutsysrootdir" and all the files installed
into the initramfs image is searched relative to the sysroot directory.
This variable can also be set externally to dracut without using option
-r/--sysroot.
There are other details that are necessary to tweak to be able to
run on cross-compiled (a.k.a. foreign) binaries.
dracut uses these crucial utilities during its operation:
ldd
===
It lists dynamic library dependencies for executables or libraries
ldconfig
========
It creates /etc/ld.so.cache, i.e. the cached information about libraries
known to the system.
These utilities the way they exist on the host system only work on
the host system.
To support cross-compiled binaries, a different ldd variant is needed that
works on those binaries. One such ldd script is found at
https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f
ldconfig in GLIBC as is does support a sysroot with its -r option.
Extra environment variables needed to run dracut on the sysroot are
documented in the dracut(8) man page.
For the Plymouth boot splash to be added to the initramfs image,
this gitlab PR is needed for Plymouth:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/72

View File

@ -0,0 +1,13 @@
To build a generic initramfs, you have to install the following software packages:
* device-mapper
* cryptsetup-luks
* rpcbind nfs-utils
* lvm2
* iscsi-initiator-utils
* nbd
* mdadm
* net-tools iproute
Generic initramfs'es are huge (usually over 10 megs in size uncompressed), but
should be able to automatically boot any bootable configuration with appropriate
boot flags (root device, network configuration information, etc.)

View File

@ -0,0 +1,3 @@
"dracut --kernel-only" is to build an initrd with only kernel modules and firmware files.
"dracut --kernel-only" only executes "installkernel" in the modules subdirectories.

View File

@ -0,0 +1,70 @@
# Conducting A Successful Release
This documents contains the necessary steps to conduct a successful release.
1. Add all items to `NEWS.md`
Get a first template with [`clog`](https://github.com/clog-tool/clog-cli)
```console
$ clog -F -r https://github.com/dracutdevs/dracut
```
2. Update the contributors list in NEWS.md
Produce the list with:
```console
$ make CONTRIBUTORS
```
Append the list to the section in `NEWS.md`
3. Update AUTHORS
```console
$ make AUTHORS
```
4. Check in AUTHORS and NEWS.md
```console
$ git ci -m "docs: update NEWS.md and AUTHORS" NEWS.md AUTHORS
```
5. Tag the release and push
```console
$ VERSION=052
$ git tag -s "$VERSION"
$ git push --tags
```
Add the section from `NEWS.md` to the git tag message.
6. Push git to kernel.org
With:
```console
$ git remote add kernelorg ssh://gitolite@ra.kernel.org/pub/scm/boot/dracut/dracut.git
```
Push to kernel.org git:
```console
$ git push --atomic kernelorg master "$VERSION"
```
7. Sign and upload tarballs to kernel.org
```console
$ make upload
```
This requires `kup` and a kernel.org account.
Wait until the tarballs are synced to http://www.kernel.org/pub/linux/utils/boot/dracut/ .
8. Create a new release on github (https://github.com/dracutdevs/dracut/releases/new)
- Add the section from `NEWS.md` to the release.
- Attach the tarballs and signature file from http://www.kernel.org/pub/linux/utils/boot/dracut/ to the github release.
9. Close the github milestone and open a new one (https://github.com/dracutdevs/dracut/milestones)
10. Ensure that announcement was sent and reached the linux-initramfs mailinglist (https://www.spinics.net/lists/linux-initramfs/)

View File

@ -0,0 +1,3 @@
Security is very important to us. If you discover any issue regarding security, we'd appreciate a non-public disclosure of
the information, so please disclose the information responsibly by sending an email to Harald Hoyer harald@redhat.com and not by creating a GitHub issue.
We will respond swiftly to fix verifiable security issues with the disclosure being coordinated with distributions and relevant security teams.

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -0,0 +1,150 @@
#!/bin/bash --norc
#
# Copyright 2009 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
dwarning() {
echo "Warning: $*" >&2
}
dinfo() {
[[ $beverbose ]] && echo "$@" >&2
}
derror() {
echo "Error: $*" >&2
}
usage() {
# 80x25 linebreak here ^
cat << EOF
Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
Creates initial ramdisk image by concatenating several images from the command
line and /boot/dracut/
-f, --force Overwrite existing initramfs file.
-i, --imagedir Directory with additional images to add
(default: /boot/dracut/)
-o, --overlaydir Overlay directory, which contains files that
will be used to create an additional image
--nooverlay Do not use the overlay directory
--noimagedir Do not use the additional image directory
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
EOF
}
imagedir=/boot/dracut/
overlay=/var/lib/dracut/overlay
while (($# > 0)); do
case $1 in
-f | --force) force=yes ;;
-i | --imagedir)
imagedir=$2
shift
;;
-o | --overlaydir)
overlay=$2
shift
;;
--nooverlay)
no_overlay=yes
shift
;;
--noimagedir)
no_imagedir=yes
shift
;;
-h | --help)
usage
exit 1
;;
--debug) export debug="yes" ;;
-v | --verbose) beverbose="yes" ;;
-*)
printf "\nUnknown option: %s\n\n" "$1" >&2
usage
exit 1
;;
*) break ;;
esac
shift
done
outfile=$1
shift
if [[ -z $outfile ]]; then
derror "No output file specified."
usage
exit 1
fi
baseimage=$1
shift
if [[ -z $baseimage ]]; then
derror "No base image specified."
usage
exit 1
fi
if [[ -f $outfile && ! $force ]]; then
derror "Will not override existing initramfs ($outfile) without --force"
exit 1
fi
if [[ ! $no_imagedir && ! -d $imagedir ]]; then
derror "Image directory $overlay is not a directory"
exit 1
fi
if [[ ! $no_overlay && ! -d $overlay ]]; then
derror "Overlay $overlay is not a directory"
exit 1
fi
if [[ ! $no_overlay ]]; then
ofile="$imagedir/90-overlay.img"
dinfo "Creating image $ofile from directory $overlay"
type pigz &> /dev/null && gzip=pigz || gzip=gzip
(
cd "$overlay" || return 1
find . | cpio --quiet -H newc -o | $gzip -9 > "$ofile"
)
fi
if [[ ! $no_imagedir ]]; then
for i in "$imagedir/"*.img; do
[[ -f $i ]] && images+=("$i")
done
fi
images+=("$@")
dinfo "Using base image $baseimage"
cat -- "$baseimage" > "$outfile"
for i in "${images[@]}"; do
dinfo "Appending $i"
cat -- "$i" >> "$outfile"
done
dinfo "Created $outfile"
exit 0

View File

@ -0,0 +1,928 @@
#!/bin/bash
#
# functions used by dracut and other tools.
#
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
export LC_MESSAGES=C
# is_func <command>
# Check whether $1 is a function.
is_func() {
[[ "$(type -t "$1")" == "function" ]]
}
# Generic substring function. If $2 is in $1, return 0.
strstr() { [[ $1 == *"$2"* ]]; }
# Generic glob matching function. If glob pattern $2 matches anywhere in $1, OK
strglobin() { [[ $1 == *$2* ]]; }
# Generic glob matching function. If glob pattern $2 matches all of $1, OK
# shellcheck disable=SC2053
strglob() { [[ $1 == $2 ]]; }
# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
str_starts() { [ "${1#"$2"*}" != "$1" ]; }
# returns OK if $1 contains literal string $2 at the end, and isn't empty
str_ends() { [ "${1%*"$2"}" != "$1" ]; }
# find a binary. If we were not passed the full path directly,
# search in the usual places to find the binary.
find_binary() {
local _delim
local _path
local l
local p
[[ -z ${1##/*} ]] || _delim="/"
if [[ $1 == *.so* ]]; then
# shellcheck disable=SC2154
for l in $libdirs; do
_path="${l}${_delim}${1}"
if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &> /dev/null; }; then
printf "%s\n" "${_path}"
return 0
fi
done
_path="${_delim}${1}"
if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &> /dev/null; }; then
printf "%s\n" "${_path}"
return 0
fi
fi
if [[ $1 == */* ]]; then
_path="${_delim}${1}"
if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]]; then
printf "%s\n" "${_path}"
return 0
fi
fi
for p in $DRACUT_PATH; do
_path="${p}${_delim}${1}"
if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]]; then
printf "%s\n" "${_path}"
return 0
fi
done
[[ -n $dracutsysrootdir ]] && return 1
type -P "${1##*/}"
}
ldconfig_paths() {
$DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2> /dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
}
# Version comparision function. Assumes Linux style version scheme.
# $1 = version a
# $2 = comparision op (gt, ge, eq, le, lt, ne)
# $3 = version b
vercmp() {
local _n1
read -r -a _n1 <<< "${1//./ }"
local _op=$2
local _n2
read -r -a _n2 <<< "${3//./ }"
local _i _res
for ((_i = 0; ; _i++)); do
if [[ ! ${_n1[_i]}${_n2[_i]} ]]; then
_res=0
elif ((${_n1[_i]:-0} > ${_n2[_i]:-0})); then
_res=1
elif ((${_n1[_i]:-0} < ${_n2[_i]:-0})); then
_res=2
else
continue
fi
break
done
case $_op in
gt) ((_res == 1)) ;;
ge) ((_res != 2)) ;;
eq) ((_res == 0)) ;;
le) ((_res != 1)) ;;
lt) ((_res == 2)) ;;
ne) ((_res != 0)) ;;
esac
}
# Create all subdirectories for given path without creating the last element.
# $1 = path
mksubdirs() {
# shellcheck disable=SC2174
[[ -e ${1%/*} ]] || mkdir -m 0755 -p -- "${1%/*}"
}
# Function prints global variables in format name=value line by line.
# $@ = list of global variables' name
print_vars() {
local _var _value
for _var in "$@"; do
eval printf -v _value "%s" \""\$$_var"\"
[[ ${_value} ]] && printf '%s="%s"\n' "$_var" "$_value"
done
}
# normalize_path <path>
# Prints the normalized path, where it removes any duplicated
# and trailing slashes.
# Example:
# $ normalize_path ///test/test//
# /test/test
normalize_path() {
# shellcheck disable=SC2064
trap "$(shopt -p extglob)" RETURN
shopt -q -s extglob
local p=${1//+(\/)//}
printf "%s\n" "${p%/}"
}
# convert_abs_rel <from> <to>
# Prints the relative path, when creating a symlink to <to> from <from>.
# Example:
# $ convert_abs_rel /usr/bin/test /bin/test-2
# ../../bin/test-2
# $ ln -s $(convert_abs_rel /usr/bin/test /bin/test-2) /usr/bin/test
convert_abs_rel() {
local __current __absolute __abssize __cursize __newpath
local -i __i __level
set -- "$(normalize_path "$1")" "$(normalize_path "$2")"
# corner case #1 - self looping link
[[ $1 == "$2" ]] && {
printf "%s\n" "${1##*/}"
return
}
# corner case #2 - own dir link
[[ ${1%/*} == "$2" ]] && {
printf ".\n"
return
}
IFS=/ read -r -a __current <<< "$1"
IFS=/ read -r -a __absolute <<< "$2"
__abssize=${#__absolute[@]}
__cursize=${#__current[@]}
while [[ ${__absolute[__level]} == "${__current[__level]}" ]]; do
((__level++))
if ((__level > __abssize || __level > __cursize)); then
break
fi
done
for ((__i = __level; __i < __cursize - 1; __i++)); do
if ((__i > __level)); then
__newpath=$__newpath"/"
fi
__newpath=$__newpath".."
done
for ((__i = __level; __i < __abssize; __i++)); do
if [[ -n $__newpath ]]; then
__newpath=$__newpath"/"
fi
__newpath=$__newpath${__absolute[__i]}
done
printf -- "%s\n" "$__newpath"
}
# get_fs_env <device>
# Get and the ID_FS_TYPE variable from udev for a device.
# Example:
# $ get_fs_env /dev/sda2
# ext4
get_fs_env() {
[[ $1 ]] || return
unset ID_FS_TYPE
ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
| while read -r line || [ -n "$line" ]; do
if [[ $line == "TYPE="* ]]; then
printf "%s" "${line#TYPE=}"
exit 0
fi
done)
if [[ $ID_FS_TYPE ]]; then
printf "%s" "$ID_FS_TYPE"
return 0
fi
return 1
}
# get_maj_min <device>
# Prints the major and minor of a device node.
# Example:
# $ get_maj_min /dev/sda2
# 8:2
get_maj_min() {
local _majmin
local _out
if [[ $get_maj_min_cache_file ]]; then
_out="$(grep -m1 -oP "^$1 \K\S+$" "$get_maj_min_cache_file")"
fi
if ! [[ "$_out" ]]; then
_majmin="$(stat -L -c '%t:%T' "$1" 2> /dev/null)"
_out="$(printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))")"
if [[ $get_maj_min_cache_file ]]; then
echo "$1 $_out" >> "$get_maj_min_cache_file"
fi
fi
echo -n "$_out"
}
# get_devpath_block <device>
# get the DEVPATH in /sys of a block device
get_devpath_block() {
local _majmin _i
_majmin=$(get_maj_min "$1")
for _i in /sys/block/*/dev /sys/block/*/*/dev; do
[[ -e $_i ]] || continue
if [[ $_majmin == "$(< "$_i")" ]]; then
printf "%s" "${_i%/dev}"
return 0
fi
done
return 1
}
# get a persistent path from a device
get_persistent_dev() {
local i _tmp _dev _pol
_dev=$(get_maj_min "$1")
[ -z "$_dev" ] && return
if [[ -n $persistent_policy ]]; then
_pol="/dev/disk/${persistent_policy}/*"
else
_pol=
fi
for i in \
$_pol \
/dev/mapper/* \
/dev/disk/by-uuid/* \
/dev/disk/by-label/* \
/dev/disk/by-partuuid/* \
/dev/disk/by-partlabel/* \
/dev/disk/by-id/* \
/dev/disk/by-path/*; do
[[ -e $i ]] || continue
[[ $i == /dev/mapper/control ]] && continue
[[ $i == /dev/mapper/mpath* ]] && continue
_tmp=$(get_maj_min "$i")
if [ "$_tmp" = "$_dev" ]; then
printf -- "%s" "$i"
return
fi
done
printf -- "%s" "$1"
}
expand_persistent_dev() {
local _dev=$1
case "$_dev" in
LABEL=*)
_dev="/dev/disk/by-label/${_dev#LABEL=}"
;;
UUID=*)
_dev="${_dev#UUID=}"
_dev="${_dev,,}"
_dev="/dev/disk/by-uuid/${_dev}"
;;
PARTUUID=*)
_dev="${_dev#PARTUUID=}"
_dev="${_dev,,}"
_dev="/dev/disk/by-partuuid/${_dev}"
;;
PARTLABEL=*)
_dev="/dev/disk/by-partlabel/${_dev#PARTLABEL=}"
;;
esac
printf "%s" "$_dev"
}
shorten_persistent_dev() {
local _dev="$1"
case "$_dev" in
/dev/disk/by-uuid/*)
printf "%s" "UUID=${_dev##*/}"
;;
/dev/disk/by-label/*)
printf "%s" "LABEL=${_dev##*/}"
;;
/dev/disk/by-partuuid/*)
printf "%s" "PARTUUID=${_dev##*/}"
;;
/dev/disk/by-partlabel/*)
printf "%s" "PARTLABEL=${_dev##*/}"
;;
*)
printf "%s" "$_dev"
;;
esac
}
# find_block_device <mountpoint>
# Prints the major and minor number of the block device
# for a given mountpoint.
# Unless $use_fstab is set to "yes" the functions
# uses /proc/self/mountinfo as the primary source of the
# information and only falls back to /etc/fstab, if the mountpoint
# is not found there.
# Example:
# $ find_block_device /usr
# 8:4
find_block_device() {
local _dev _majmin _find_mpt
_find_mpt="$1"
if [[ $use_fstab != yes ]]; then
[[ -d $_find_mpt/. ]]
findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | {
while read -r _majmin _dev || [ -n "$_dev" ]; do
if [[ -b $_dev ]]; then
if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
_majmin=$(get_maj_min "$_dev")
fi
if [[ $_majmin ]]; then
printf "%s\n" "$_majmin"
else
printf "%s\n" "$_dev"
fi
return 0
fi
if [[ $_dev == *:* ]]; then
printf "%s\n" "$_dev"
return 0
fi
done
return 1
} && return 0
fi
# fall back to /etc/fstab
findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | {
while read -r _majmin _dev || [ -n "$_dev" ]; do
if ! [[ $_dev ]]; then
_dev="$_majmin"
unset _majmin
fi
if [[ -b $_dev ]]; then
[[ $_majmin ]] || _majmin=$(get_maj_min "$_dev")
if [[ $_majmin ]]; then
printf "%s\n" "$_majmin"
else
printf "%s\n" "$_dev"
fi
return 0
fi
if [[ $_dev == *:* ]]; then
printf "%s\n" "$_dev"
return 0
fi
done
return 1
} && return 0
return 1
}
# find_mp_fstype <mountpoint>
# Echo the filesystem type for a given mountpoint.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# No newline is appended!
# Example:
# $ find_mp_fstype /;echo
# ext4
find_mp_fstype() {
local _fs
if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'FSTYPE' --target "$1" | {
while read -r _fs || [ -n "$_fs" ]; do
[[ $_fs ]] || continue
[[ $_fs == "autofs" ]] && continue
printf "%s" "$_fs"
return 0
done
return 1
} && return 0
fi
findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | {
while read -r _fs || [ -n "$_fs" ]; do
[[ $_fs ]] || continue
[[ $_fs == "autofs" ]] && continue
printf "%s" "$_fs"
return 0
done
return 1
} && return 0
return 1
}
# find_dev_fstype <device>
# Echo the filesystem type for a given device.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# No newline is appended!
# Example:
# $ find_dev_fstype /dev/sda2;echo
# ext4
find_dev_fstype() {
local _find_dev _fs
_find_dev="$1"
if ! [[ $_find_dev == /dev* ]]; then
[[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
fi
if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | {
while read -r _fs || [ -n "$_fs" ]; do
[[ $_fs ]] || continue
[[ $_fs == "autofs" ]] && continue
printf "%s" "$_fs"
return 0
done
return 1
} && return 0
fi
findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | {
while read -r _fs || [ -n "$_fs" ]; do
[[ $_fs ]] || continue
[[ $_fs == "autofs" ]] && continue
printf "%s" "$_fs"
return 0
done
return 1
} && return 0
return 1
}
# find_mp_fsopts <mountpoint>
# Echo the filesystem options for a given mountpoint.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# No newline is appended!
# Example:
# $ find_mp_fsopts /;echo
# rw,relatime,discard,data=ordered
find_mp_fsopts() {
if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'OPTIONS' --target "$1" 2> /dev/null && return 0
fi
findmnt --fstab -e -v -n -o 'OPTIONS' --target "$1"
}
# find_dev_fsopts <device>
# Echo the filesystem options for a given device.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# if `use_fstab == yes`, then only `/etc/fstab` is used.
#
# Example:
# $ find_dev_fsopts /dev/sda2
# rw,relatime,discard,data=ordered
find_dev_fsopts() {
local _find_dev
_find_dev="$1"
if ! [[ $_find_dev == /dev* ]]; then
[[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
fi
if [[ $use_fstab != yes ]]; then
findmnt -e -v -n -o 'OPTIONS' --source "$_find_dev" 2> /dev/null && return 0
fi
findmnt --fstab -e -v -n -o 'OPTIONS' --source "$_find_dev"
}
# finds the major:minor of the block device backing the root filesystem.
find_root_block_device() { find_block_device /; }
# for_each_host_dev_fs <func>
# Execute "<func> <dev> <filesystem>" for every "<dev> <fs>" pair found
# in ${host_fs_types[@]}
for_each_host_dev_fs() {
local _func="$1"
local _dev
local _ret=1
[[ "${#host_fs_types[@]}" ]] || return 2
for _dev in "${!host_fs_types[@]}"; do
$_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
done
return $_ret
}
host_fs_all() {
printf "%s\n" "${host_fs_types[@]}"
}
# Walk all the slave relationships for a given block device.
# Stop when our helper function returns success
# $1 = function to call on every found block device
# $2 = block device in major:minor format
check_block_and_slaves() {
local _x
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
if ! lvm_internal_dev "$2"; then "$1" "$2" && return; fi
check_vol_slaves "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
check_block_and_slaves "$1" "$(< "/sys/dev/block/$2/../dev")" && return 0
fi
for _x in /sys/dev/block/"$2"/slaves/*; do
[[ -f $_x/dev ]] || continue
[[ $_x/subsystem -ef /sys/class/block ]] || continue
check_block_and_slaves "$1" "$(< "$_x/dev")" && return 0
done
return 1
}
check_block_and_slaves_all() {
local _x _ret=1
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
if ! lvm_internal_dev "$2" && "$1" "$2"; then
_ret=0
fi
check_vol_slaves_all "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
check_block_and_slaves_all "$1" "$(< "/sys/dev/block/$2/../dev")" && _ret=0
fi
for _x in /sys/dev/block/"$2"/slaves/*; do
[[ -f $_x/dev ]] || continue
[[ $_x/subsystem -ef /sys/class/block ]] || continue
check_block_and_slaves_all "$1" "$(< "$_x/dev")" && _ret=0
done
return $_ret
}
# for_each_host_dev_and_slaves <func>
# Execute "<func> <dev>" for every "<dev>" found
# in ${host_devs[@]} and their slaves
for_each_host_dev_and_slaves_all() {
local _func="$1"
local _dev
local _ret=1
[[ "${host_devs[*]}" ]] || return 2
for _dev in "${host_devs[@]}"; do
[[ -b $_dev ]] || continue
if check_block_and_slaves_all "$_func" "$(get_maj_min "$_dev")"; then
_ret=0
fi
done
return $_ret
}
for_each_host_dev_and_slaves() {
local _func="$1"
local _dev
[[ "${host_devs[*]}" ]] || return 2
for _dev in "${host_devs[@]}"; do
[[ -b $_dev ]] || continue
check_block_and_slaves "$_func" "$(get_maj_min "$_dev")" && return 0
done
return 1
}
# ugly workaround for the lvm design
# There is no volume group device,
# so, there are no slave devices for volume groups.
# Logical volumes only have the slave devices they really live on,
# but you cannot create the logical volume without the volume group.
# And the volume group might be bigger than the devices the LV needs.
check_vol_slaves() {
local _vg _pv _dm _majmin
_majmin="$2"
_dm=/sys/dev/block/$_majmin/dm
[[ -f $_dm/uuid && $(< "$_dm"/uuid) =~ LVM-* ]] || return 1
_vg=$(dmsetup splitname --noheadings -o vg_name "$(< "$_dm/name")")
# strip space
_vg="${_vg//[[:space:]]/}"
if [[ $_vg ]]; then
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2> /dev/null); do
check_block_and_slaves "$1" "$(get_maj_min "$_pv")" && return 0
done
fi
return 1
}
check_vol_slaves_all() {
local _vg _pv _majmin
_majmin="$2"
_dm="/sys/dev/block/$_majmin/dm"
[[ -f $_dm/uuid && $(< "$_dm"/uuid) =~ LVM-* ]] || return 1
_vg=$(dmsetup splitname --noheadings -o vg_name "$(< "$_dm/name")")
# strip space
_vg="${_vg//[[:space:]]/}"
if [[ $_vg ]]; then
# when filter/global_filter is set, lvm may be failed
if ! lvm lvs --noheadings -o vg_name "$_vg" 2> /dev/null 1> /dev/null; then
return 1
fi
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2> /dev/null); do
check_block_and_slaves_all "$1" "$(get_maj_min "$_pv")"
done
return 0
fi
return 1
}
# fs_get_option <filesystem options> <search for option>
# search for a specific option in a bunch of filesystem options
# and return the value
fs_get_option() {
local _fsopts=$1
local _option=$2
local OLDIFS="$IFS"
IFS=,
# shellcheck disable=SC2086
set -- $_fsopts
IFS="$OLDIFS"
while [ $# -gt 0 ]; do
case $1 in
$_option=*)
echo "${1#${_option}=}"
break
;;
esac
shift
done
}
check_kernel_config() {
local _config_opt="$1"
local _config_file
[[ -f $dracutsysrootdir/boot/config-$kernel ]] \
&& _config_file="/boot/config-$kernel"
[[ -f $dracutsysrootdir/lib/modules/$kernel/config ]] \
&& _config_file="/lib/modules/$kernel/config"
# no kernel config file, so return true
[[ $_config_file ]] || return 0
grep -q -F "${_config_opt}=" "$dracutsysrootdir$_config_file" && return 0
return 1
}
# 0 if the kernel module is either built-in or available
# 1 if the kernel module is not enabled
check_kernel_module() {
modprobe -S "$kernel" --dry-run "$1" &> /dev/null || return 1
}
# get_cpu_vendor
# Only two values are returned: AMD or Intel
get_cpu_vendor() {
if grep -qE AMD /proc/cpuinfo; then
printf "AMD"
fi
if grep -qE Intel /proc/cpuinfo; then
printf "Intel"
fi
}
# get_host_ucode
# Get the hosts' ucode file based on the /proc/cpuinfo
get_ucode_file() {
local family
local model
local stepping
family=$(grep -E "cpu family" /proc/cpuinfo | head -1 | sed "s/.*:\ //")
model=$(grep -E "model" /proc/cpuinfo | grep -v name | head -1 | sed "s/.*:\ //")
stepping=$(grep -E "stepping" /proc/cpuinfo | head -1 | sed "s/.*:\ //")
if [[ "$(get_cpu_vendor)" == "AMD" ]]; then
if [[ $family -ge 21 ]]; then
printf "microcode_amd_fam%xh.bin" "$family"
else
printf "microcode_amd.bin"
fi
fi
if [[ "$(get_cpu_vendor)" == "Intel" ]]; then
# The /proc/cpuinfo are in decimal.
printf "%02x-%02x-%02x" "${family}" "${model}" "${stepping}"
fi
}
# Not every device in /dev/mapper should be examined.
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
lvm_internal_dev() {
local dev_dm_dir=/sys/dev/block/$1/dm
[[ ! -f $dev_dm_dir/uuid || $(< "$dev_dm_dir"/uuid) != LVM-* ]] && return 1 # Not an LVM device
local DM_VG_NAME DM_LV_NAME DM_LV_LAYER
eval "$(dmsetup splitname --nameprefixes --noheadings --rows "$(< "$dev_dm_dir"/name)" 2> /dev/null)"
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 0 # Better skip this!
[[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]]
}
btrfs_devs() {
local _mp="$1"
btrfs device usage "$_mp" \
| while read -r _dev _; do
str_starts "$_dev" "/" || continue
_dev=${_dev%,}
printf -- "%s\n" "$_dev"
done
}
iface_for_remote_addr() {
# shellcheck disable=SC2046
set -- $(ip -o route get to "$1")
echo "$3"
}
local_addr_for_remote_addr() {
# shellcheck disable=SC2046
set -- $(ip -o route get to "$1")
echo "$5"
}
peer_for_addr() {
local addr=$1
local qtd
# quote periods in IPv4 address
qtd=${addr//./\\.}
ip -o addr show \
| sed -n 's%^.* '"$qtd"' peer \([0-9a-f.:]\{1,\}\(/[0-9]*\)\?\).*$%\1%p'
}
netmask_for_addr() {
local addr=$1
local qtd
# quote periods in IPv4 address
qtd=${addr//./\\.}
ip -o addr show | sed -n 's,^.* '"$qtd"'/\([0-9]*\) .*$,\1,p'
}
gateway_for_iface() {
local ifname=$1 addr=$2
case $addr in
*.*) proto=4 ;;
*:*) proto=6 ;;
*) return ;;
esac
ip -o -$proto route show \
| sed -n "s/^default via \([0-9a-z.:]\{1,\}\) dev $ifname .*\$/\1/p"
}
# This works only for ifcfg-style network configuration!
bootproto_for_iface() {
local ifname=$1
local dir
# follow ifcfg settings for boot protocol
for dir in network-scripts network; do
[ -f "/etc/sysconfig/$dir/ifcfg-$ifname" ] && {
sed -n "s/BOOTPROTO=[\"']\?\([[:alnum:]]\{1,\}\)[\"']\?.*\$/\1/p" \
"/etc/sysconfig/$dir/ifcfg-$ifname"
return
}
done
}
is_unbracketed_ipv6_address() {
strglob "$1" '*:*' && ! strglob "$1" '\[*:*\]'
}
# Create an ip= string to set up networking such that the given
# remote address can be reached
ip_params_for_remote_addr() {
local remote_addr=$1
local ifname local_addr peer netmask gateway ifmac
[[ $remote_addr ]] || return 1
ifname=$(iface_for_remote_addr "$remote_addr")
[[ $ifname ]] || {
berror "failed to determine interface to connect to $remote_addr"
return 1
}
# ifname clause to bind the interface name to a MAC address
if [ -d "/sys/class/net/$ifname/bonding" ]; then
dinfo "Found bonded interface '${ifname}'. Make sure to provide an appropriate 'bond=' cmdline."
elif [ -e "/sys/class/net/$ifname/address" ]; then
ifmac=$(cat "/sys/class/net/$ifname/address")
[[ $ifmac ]] && printf 'ifname=%s:%s ' "${ifname}" "${ifmac}"
fi
bootproto=$(bootproto_for_iface "$ifname")
case $bootproto in
dhcp | dhcp6 | auto6) ;;
dhcp4)
bootproto=dhcp
;;
static* | "")
bootproto=
;;
*)
derror "bootproto \"$bootproto\" is unsupported by dracut, trying static configuration"
bootproto=
;;
esac
if [[ $bootproto ]]; then
printf 'ip=%s:%s ' "${ifname}" "${bootproto}"
else
local_addr=$(local_addr_for_remote_addr "$remote_addr")
[[ $local_addr ]] || {
berror "failed to determine local address to connect to $remote_addr"
return 1
}
peer=$(peer_for_addr "$local_addr")
# Set peer or netmask, but not both
[[ $peer ]] || netmask=$(netmask_for_addr "$local_addr")
gateway=$(gateway_for_iface "$ifname" "$local_addr")
# Quote IPv6 addresses with brackets
is_unbracketed_ipv6_address "$local_addr" && local_addr="[$local_addr]"
is_unbracketed_ipv6_address "$peer" && peer="[$peer]"
is_unbracketed_ipv6_address "$gateway" && gateway="[$gateway]"
printf 'ip=%s:%s:%s:%s::%s:none ' \
"${local_addr}" "${peer}" "${gateway}" "${netmask}" "${ifname}"
fi
}
# block_is_nbd <maj:min>
# Check whether $1 is an nbd device
block_is_nbd() {
[[ -b /dev/block/$1 && $1 == 43:* ]]
}
# block_is_iscsi <maj:min>
# Check whether $1 is an nbd device
block_is_iscsi() {
local _dir
local _dev=$1
[[ -L "/sys/dev/block/$_dev" ]] || return
_dir="$(readlink -f "/sys/dev/block/$_dev")" || return
until [[ -d "$_dir/sys" || -d "$_dir/iscsi_session" ]]; do
_dir="$_dir/.."
done
[[ -d "$_dir/iscsi_session" ]]
}
# block_is_fcoe <maj:min>
# Check whether $1 is an FCoE device
# Will not work for HBAs that hide the ethernet aspect
# completely and present a pure FC device
block_is_fcoe() {
local _dir
local _dev=$1
[[ -L "/sys/dev/block/$_dev" ]] || return
_dir="$(readlink -f "/sys/dev/block/$_dev")"
until [[ -d "$_dir/sys" ]]; do
_dir="$_dir/.."
if [[ -d "$_dir/subsystem" ]]; then
subsystem=$(basename "$(readlink "$_dir"/subsystem)")
[[ $subsystem == "fcoe" ]] && return 0
fi
done
return 1
}
# block_is_netdevice <maj:min>
# Check whether $1 is a net device
block_is_netdevice() {
block_is_nbd "$1" || block_is_iscsi "$1" || block_is_fcoe "$1"
}
# get the corresponding kernel modules of a /sys/class/*/* or/dev/* device
get_dev_module() {
udevadm info -a "$1" | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p'
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,66 @@
#!/bin/bash
set -e
# do some sanity checks first
[ -e /run/initramfs/bin/sh ] && exit 0
[ -e /run/initramfs/.need_shutdown ] || exit 0
KERNEL_VERSION="$(uname -r)"
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
SKIP="$dracutbasedir/skipcpio"
[[ -x $SKIP ]] || SKIP="cat"
[[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id
mount -o ro /boot &> /dev/null || true
if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
&& [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]]; then
IMG="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
&& [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then
IMG="/boot/initramfs-${KERNEL_VERSION}.img"
elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then
IMG="/lib/modules/${KERNEL_VERSION}/initrd"
else
echo "No initramfs image found to restore!"
exit 1
fi
cd /run/initramfs
if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet > /dev/null; then
rm -f -- .need_shutdown
elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet > /dev/null; then
rm -f -- .need_shutdown
elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet > /dev/null; then
rm -f -- .need_shutdown
elif $SKIP "$IMG" | zstd -d -c | cpio -id --no-absolute-filenames --quiet > /dev/null; then
rm -f -- .need_shutdown
else
# something failed, so we clean up
echo "Unpacking of $IMG to /run/initramfs failed" >&2
rm -f -- /run/initramfs/shutdown
exit 1
fi
if [[ -d squash ]]; then
if ! unsquashfs -no-xattrs -f -d . squash-root.img > /dev/null; then
echo "Squash module is enabled for this initramfs but failed to unpack squash-root.img" >&2
rm -f -- /run/initramfs/shutdown
exit 1
fi
fi
if [ -e /etc/selinux/config -a -x /usr/sbin/setfiles ]; then
. /etc/selinux/config
/usr/sbin/setfiles -v -r /run/initramfs /etc/selinux/"${SELINUXTYPE}"/contexts/files/file_contexts /run/initramfs > /dev/null
fi
exit 0

View File

@ -0,0 +1 @@
src/install/dracut-install

View File

@ -0,0 +1,455 @@
#!/bin/bash
#
# logging faciality module for dracut both at build- and boot-time
#
# Copyright 2010 Amadeusz Żołnowski <aidecoe@aidecoe.name>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
export __DRACUT_LOGGER__=1
## @brief Logging facility module for dracut both at build- and boot-time.
#
# @section intro Introduction
#
# The logger takes a bit from Log4j philosophy. There are defined 6 logging
# levels:
# - TRACE (6)
# The TRACE Level designates finer-grained informational events than the
# DEBUG.
# - DEBUG (5)
# The DEBUG Level designates fine-grained informational events that are most
# useful to debug an application.
# - INFO (4)
# The INFO level designates informational messages that highlight the
# progress of the application at coarse-grained level.
# - WARN (3)
# The WARN level designates potentially harmful situations.
# - ERROR (2)
# The ERROR level designates error events that might still allow the
# application to continue running.
# - FATAL (1)
# The FATAL level designates very severe error events that will presumably
# lead the application to abort.
# Descriptions are borrowed from Log4j documentation:
# http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html
#
# @section usage Usage
#
# First of all you have to start with dlog_init() function which initializes
# required variables. Don't call any other logging function before that one!
# If you're ready with this, you can use following functions which corresponds
# clearly to levels listed in @ref intro Introduction. Here they are:
# - dtrace()
# - ddebug()
# - dinfo()
# - dwarn()
# - derror()
# - dfatal()
# They take all arguments given as a single message to be logged. See dlog()
# function for details how it works. Note that you shouldn't use dlog() by
# yourself. It's wrapped with above functions.
#
# @see dlog_init() dlog()
#
# @section conf Configuration
#
# Logging is controlled by following global variables:
# - @var stdloglvl - logging level to standard error (console output)
# - @var sysloglvl - logging level to syslog (by logger command)
# - @var fileloglvl - logging level to file
# - @var kmsgloglvl - logging level to /dev/kmsg (only for boot-time)
# - @var logfile - log file which is used when @var fileloglvl is higher
# than 0
# and two global variables: @var maxloglvl and @var syslogfacility which <b>must
# not</b> be overwritten. Both are set by dlog_init(). @var maxloglvl holds
# maximum logging level of those three and indicates that dlog_init() was run.
# @var syslogfacility is set either to 'user' (when building initramfs) or
# 'daemon' (when booting).
#
# Logging level set by the variable means that messages from this logging level
# and above (FATAL is the highest) will be shown. Logging levels may be set
# independently for each destination (stderr, syslog, file, kmsg).
#
# @see dlog_init()
## @brief Initializes dracut Logger.
#
# @retval 1 if something has gone wrong
# @retval 0 on success.
#
# @note This function need to be called before any other from this file.
#
# If any of the variables is not set, this function set it to default:
# - @var stdloglvl = 4 (info)
# - @var sysloglvl = 0 (no logging)
# - @var fileloglvl is set to 4 when @var logfile is set too, otherwise it's
# - @var kmsgloglvl = 0 (no logging)
# set to 0
#
# @warning Function sets global variables @var maxloglvl and @syslogfacility.
# See file doc comment for details.
dlog_init() {
local __oldumask
local ret=0
local errmsg
[ -z "$stdloglvl" ] && stdloglvl=4
[ -z "$sysloglvl" ] && sysloglvl=0
[ -z "$kmsgloglvl" ] && kmsgloglvl=0
# Skip initialization if it's already done.
[ -n "$maxloglvl" ] && return 0
if [ -z "$fileloglvl" ]; then
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
elif ((fileloglvl > 0)); then
if [[ $logfile ]]; then
__oldumask=$(umask)
umask 0377
! [ -e "$logfile" ] && : > "$logfile"
umask "$__oldumask"
if [[ -w $logfile ]] && [[ -f $logfile ]]; then
# Mark new run in the log file
echo >> "$logfile"
if command -v date > /dev/null; then
echo "=== $(date) ===" >> "$logfile"
else
echo "===============================================" >> "$logfile"
fi
echo >> "$logfile"
else
# We cannot log to file, so turn this facility off.
fileloglvl=0
ret=1
errmsg="'$logfile' is not a writable file"
fi
fi
fi
if ((UID != 0)); then
kmsgloglvl=0
sysloglvl=0
fi
if ((sysloglvl > 0)); then
if [[ -d /run/systemd/journal ]] \
&& type -P systemd-cat &> /dev/null \
&& systemctl --quiet is-active systemd-journald.socket &> /dev/null \
&& { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &> /dev/null; }; then
readonly _systemdcatfile="$DRACUT_TMPDIR/systemd-cat"
mkfifo "$_systemdcatfile"
readonly _dlogfd=15
systemd-cat -t 'dracut' --level-prefix=true < "$_systemdcatfile" &
exec 15> "$_systemdcatfile"
elif ! [[ -S /dev/log ]] && [[ -w /dev/log ]] || ! command -v logger > /dev/null; then
# We cannot log to syslog, so turn this facility off.
kmsgloglvl=$sysloglvl
sysloglvl=0
ret=1
errmsg="No '/dev/log' or 'logger' included for syslog logging"
fi
fi
if ((sysloglvl > 0)) || ((kmsgloglvl > 0)); then
if [ -n "$dracutbasedir" ]; then
readonly syslogfacility=user
else
readonly syslogfacility=daemon
fi
export syslogfacility
fi
local lvl
local maxloglvl_l=0
for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do
((lvl > maxloglvl_l)) && maxloglvl_l=$lvl
done
readonly maxloglvl=$maxloglvl_l
export maxloglvl
if ((stdloglvl < 6)) && ((kmsgloglvl < 6)) && ((fileloglvl < 6)) && ((sysloglvl < 6)); then
unset dtrace
dtrace() { :; }
fi
if ((stdloglvl < 5)) && ((kmsgloglvl < 5)) && ((fileloglvl < 5)) && ((sysloglvl < 5)); then
unset ddebug
ddebug() { :; }
fi
if ((stdloglvl < 4)) && ((kmsgloglvl < 4)) && ((fileloglvl < 4)) && ((sysloglvl < 4)); then
unset dinfo
dinfo() { :; }
fi
if ((stdloglvl < 3)) && ((kmsgloglvl < 3)) && ((fileloglvl < 3)) && ((sysloglvl < 3)); then
unset dwarn
dwarn() { :; }
unset dwarning
dwarning() { :; }
fi
if ((stdloglvl < 2)) && ((kmsgloglvl < 2)) && ((fileloglvl < 2)) && ((sysloglvl < 2)); then
unset derror
derror() { :; }
fi
if ((stdloglvl < 1)) && ((kmsgloglvl < 1)) && ((fileloglvl < 1)) && ((sysloglvl < 1)); then
unset dfatal
dfatal() { :; }
fi
[ -n "$errmsg" ] && derror "$errmsg"
return $ret
}
## @brief Converts numeric logging level to the first letter of level name.
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes first letter of level name.
_lvl2char() {
case "$1" in
1) echo F ;;
2) echo E ;;
3) echo W ;;
4) echo I ;;
5) echo D ;;
6) echo T ;;
*) return 1 ;;
esac
}
## @brief Converts numeric level to logger priority defined by POSIX.2.
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes logger priority.
_lvl2syspri() {
printf -- "%s" "$syslogfacility."
case "$1" in
1) echo crit ;;
2) echo error ;;
3) echo warning ;;
4) echo info ;;
5) echo debug ;;
6) echo debug ;;
*) return 1 ;;
esac
}
## @brief Converts dracut-logger numeric level to syslog log level
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes kernel console numeric log level
#
# Conversion is done as follows:
#
# <tt>
# none -> LOG_EMERG (0)
# none -> LOG_ALERT (1)
# FATAL(1) -> LOG_CRIT (2)
# ERROR(2) -> LOG_ERR (3)
# WARN(3) -> LOG_WARNING (4)
# none -> LOG_NOTICE (5)
# INFO(4) -> LOG_INFO (6)
# DEBUG(5) -> LOG_DEBUG (7)
# TRACE(6) /
# </tt>
#
# @see /usr/include/sys/syslog.h
_dlvl2syslvl() {
local lvl
case "$1" in
1) lvl=2 ;;
2) lvl=3 ;;
3) lvl=4 ;;
4) lvl=6 ;;
5) lvl=7 ;;
6) lvl=7 ;;
*) return 1 ;;
esac
[ "$syslogfacility" = user ] && echo $((8 + lvl)) || echo $((24 + lvl))
}
## @brief Prints to stderr and/or writes to file, to syslog and/or /dev/kmsg
# given message with given level (priority).
#
# @param lvl Numeric logging level.
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
#
# @note This function is not supposed to be called manually. Please use
# dtrace(), ddebug(), or others instead which wrap this one.
#
# This is core logging function which logs given message to standard error, file
# and/or syslog (with POSIX shell command <tt>logger</tt>) and/or to /dev/kmsg.
# The format is following:
#
# <tt>X: some message</tt>
#
# where @c X is the first letter of logging level. See module description for
# details on that.
#
# Message to syslog is sent with tag @c dracut. Priorities are mapped as
# following:
# - @c FATAL to @c crit
# - @c ERROR to @c error
# - @c WARN to @c warning
# - @c INFO to @c info
# - @c DEBUG and @c TRACE both to @c debug
_do_dlog() {
local lvlc
local lvl="$1"
shift
lvlc=$(_lvl2char "$lvl") || return 0
local msg="$*"
local lmsg="$lvlc: $*"
((lvl <= stdloglvl)) && printf -- 'dracut: %s\n' "$msg" >&2
if ((lvl <= sysloglvl)); then
if [[ "$_dlogfd" ]]; then
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl "$lvl") & 7))" "$msg" >&$_dlogfd
else
logger -t "dracut[$$]" -p "$(_lvl2syspri "$lvl")" -- "$msg"
fi
fi
if ((lvl <= fileloglvl)) && [[ -w $logfile ]] && [[ -f $logfile ]]; then
echo "$lmsg" >> "$logfile"
fi
((lvl <= kmsgloglvl)) \
&& echo "<$(_dlvl2syslvl "$lvl")>dracut[$$] $msg" > /dev/kmsg
}
## @brief Internal helper function for _do_dlog()
#
# @param lvl Numeric logging level.
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
#
# @note This function is not supposed to be called manually. Please use
# dtrace(), ddebug(), or others instead which wrap this one.
#
# This function calls _do_dlog() either with parameter msg, or if
# none is given, it will read standard input and will use every line as
# a message.
#
# This enables:
# dwarn "This is a warning"
# echo "This is a warning" | dwarn
dlog() {
[ -z "$maxloglvl" ] && return 0
(($1 <= maxloglvl)) || return 0
if (($# > 1)); then
_do_dlog "$@"
else
while read -r line || [ -n "$line" ]; do
_do_dlog "$1" "$line"
done
fi
}
## @brief Logs message at TRACE level (6)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dtrace() {
set +x
dlog 6 "$@"
if [ -n "$debug" ]; then
set -x
fi
}
## @brief Logs message at DEBUG level (5)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
ddebug() {
set +x
dlog 5 "$@"
if [ -n "$debug" ]; then
set -x
fi
}
## @brief Logs message at INFO level (4)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dinfo() {
set +x
dlog 4 "$@"
if [ -n "$debug" ]; then
set -x
fi
}
## @brief Logs message at WARN level (3)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dwarn() {
set +x
dlog 3 "$@"
if [ -n "$debug" ]; then
set -x
fi
}
## @brief It's an alias to dwarn() function.
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dwarning() {
set +x
dwarn "$@"
if [ -n "$debug" ]; then
set -x
fi
}
## @brief Logs message at ERROR level (2)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
derror() {
set +x
dlog 2 "$@"
if [ -n "$debug" ]; then
set -x
fi
}
## @brief Logs message at FATAL level (1)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dfatal() {
set +x
dlog 1 "$@"
if [ -n "$debug" ]; then
set -x
fi
}

View File

@ -0,0 +1,3 @@
#!/bin/sh
# shellcheck disable=SC2034
DRACUT_VERSION=055

View File

@ -0,0 +1,3 @@
# PUT YOUR CONFIG IN separate files
# in /etc/dracut.conf.d named "<name>.conf"
# SEE man dracut.conf(5) for options

View File

@ -0,0 +1,46 @@
# dracut config file customized for RedHat/Fedora.
# i18n
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
i18n_default_font="eurlatgr"
i18n_install_all="yes"
stdloglvl=3
sysloglvl=5
install_optional_items+=" vi /etc/virc ps grep cat rm "
prefix="/"
environment=/usr/lib/environment.d
environmentconfdir=/etc/environment.d
dbus=/usr/share/dbus-1
dbusinterfaces=/usr/share/dbus-1/interfaces
dbusservices=/usr/share/dbus-1/services
dbussession=/usr/share/dbus-1/session.d
dbussystem=/usr/share/dbus-1/system.d
dbussystemservices=/usr/share/dbus-1/system-services
dbusconfdir=/etc/dbus-1
dbusinterfacesconfdir=/etc/dbus-1/interfaces
dbusservicesconfdir=/etc/dbus-1/services
dbussessionconfdir=/etc/dbus-1/session.d
dbussystem=confdir/etc/dbus-1/system.d
dbussystemservicesconfdir=/etc/dbus-1/system-services
sysctld=/usr/lib/sysctl.d
sysctlconfdir=/etc/sysctl.d
systemdutildir=/usr/lib/systemd
systemdutilconfdir=/etc/systemd
systemdcatalog=/usr/lib/systemd/catalog
systemdntpunits=/usr/lib/systemd/ntp-units.d
systemdntpunitsconfdir=/etc/systemd/ntp-units.d
systemdportable=/usr/lib/systemd/portable
systemdportableconfdir=/etc/systemd/portable
systemdsystemunitdir=/usr/lib/systemd/system
systemdsystemconfdir=/etc/systemd/system
systemduser=/usr/lib/systemd/user
systemduserconfdir=/etc/systemd/user
sysusers=/usr/lib/sysusers.d
sysusersconfdir=/etc/sysusers.d
udevdir=/usr/lib/udev
hostonly="yes"
hostonly_cmdline="no"
early_microcode="yes"
reproducible="yes"

View File

@ -0,0 +1,3 @@
# turn on fips module
add_dracutmodules+=" fips "

View File

@ -0,0 +1,5 @@
# /etc/dracut.conf.d/gentoo-systemd.conf
# Paths of systemd dirs on Gentoo
systemdutildir=/usr/lib/systemd
systemdsystemunitdir=/usr/lib/systemd/system

View File

@ -0,0 +1,15 @@
# /etc/dracut.conf.d/gentoo.conf
# dracut config file customized for Gentoo Base System release 2
udevdir=/lib/udev
ro_mnt=yes
#
# Modules
#
# i18n
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
i18n_default_font="LatArCyrHeb-16"
omit_drivers+=" i2o_scsi "

View File

@ -0,0 +1,24 @@
# SUSE specific dracut settings
#
# SUSE by default always builds as small as possible initrd for performance
# and resource reasons.
# If you like to build a generic initrd which works on other platforms than
# on the one dracut/mkinitrd got called comment out below setting(s).
hostonly="yes"
hostonly_cmdline="yes"
compress="xz -0 --check=crc32 --memlimit-compress=50%"
i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
omit_drivers+=" i2o_scsi "
# Below adds additional tools to the initrd which are not urgently necessary to
# bring up the system, but help to debug problems.
# See /usr/lib/dracut/modules.d/95debug/module-setup.sh which additional tools
# are installed and add more if you need them. This specifically helps if you
# use:
# rd.break=[cmdline|pre-udev|pre-trigger|initqueue|pre-mount|
# mount|pre-pivot|cleanup]
# boot parameter or if you are forced to enter the dracut emergency shell.
# add_dracutmodules+=debug

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
Name: dracut
Description: dracut
Version: 055
dracutdir=/usr/local/lib/dracut
dracutmodulesdir=/usr/local/lib/dracut/modules.d
dracutconfdir=/usr/local/lib/dracut/dracut.conf.d

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,65 @@
#!/bin/bash
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"
# If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory.
# So, let's skip to create initrd.
if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
exit 0
fi
if [[ -d "$BOOT_DIR_ABS" ]]; then
INITRD="initrd"
else
BOOT_DIR_ABS="/boot"
INITRD="initramfs-${KERNEL_VERSION}.img"
fi
ret=0
case "$COMMAND" in
add)
INITRD_IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/initrd
if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
# we found an initrd at the same place as the kernel
# use this and don't generate a new one
cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$INITRD" \
&& chown root:root "$BOOT_DIR_ABS/$INITRD" \
&& chmod 0600 "$BOOT_DIR_ABS/$INITRD" \
&& exit 0
fi
if [[ -f /etc/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
else
declare -a BOOT_OPTIONS
read -r -d '' -a line < /proc/cmdline
for i in "${line[@]}"; do
[[ "${i#initrd=*}" != "$i" ]] && continue
BOOT_OPTIONS+=("$i")
done
fi
unset noimageifnotneeded
for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
# shellcheck disable=SC1001
if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
noimageifnotneeded="yes"
break
fi
done
dracut -f ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
ret=$?
;;
remove)
rm -f -- "$BOOT_DIR_ABS/$INITRD"
ret=$?
;;
esac
exit $ret

View File

@ -0,0 +1,133 @@
#!/bin/bash
export LANG=C
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="${3%/*}/0-rescue"
KERNEL_IMAGE="$4"
dropindirs_sort()
{
suffix=$1; shift
args=("$@")
files=$(
while (( $# > 0 )); do
for i in "${1}"/*"${suffix}"; do
[[ -f $i ]] && echo "${i##*/}"
done
shift
done | sort -Vu
)
for f in $files; do
for d in "${args[@]}"; do
if [[ -f "$d/$f" ]]; then
echo "$d/$f"
continue 2
fi
done
done
}
[[ -f /etc/os-release ]] && . /etc/os-release
if [[ ${KERNEL_INSTALL_MACHINE_ID+x} ]]; then
MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
elif [[ -f /etc/machine-id ]] ; then
read -r MACHINE_ID < /etc/machine-id
fi
if ! [[ $MACHINE_ID ]]; then
exit 0
fi
if [[ -f /etc/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
else
declare -a BOOT_OPTIONS
read -r -d '' -a line < /proc/cmdline
for i in "${line[@]}"; do
[[ "${i#initrd=*}" != "$i" ]] && continue
BOOT_OPTIONS+=("$i")
done
fi
if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then
BOOT_DIR="/${MACHINE_ID}/0-rescue"
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
LOADER_ENTRY="$BOOT_ROOT/loader/entries/${MACHINE_ID}-0-rescue.conf"
KERNEL="linux"
INITRD="initrd"
else
BLS_DIR="/boot/loader/entries"
BOOT_DIR_ABS="/boot"
LOADER_ENTRY="$BLS_DIR/${MACHINE_ID}-0-rescue.conf"
KERNEL="vmlinuz-0-rescue-${MACHINE_ID}"
INITRD="initramfs-0-rescue-${MACHINE_ID}.img"
fi
ret=0
case "$COMMAND" in
add)
[[ -f "$LOADER_ENTRY" ]] && [[ -f "$BOOT_DIR_ABS/$KERNEL" ]] \
&& [[ -f "$BOOT_DIR_ABS/$INITRD" ]] && exit 0
# source our config dir
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
if [[ -e $f ]]; then
# shellcheck disable=SC1090
. "$f"
fi
done
# shellcheck disable=SC2154
[[ $dracut_rescue_image != "yes" ]] && exit 0
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS/$KERNEL"; then
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/$KERNEL'!" >&2
fi
if [[ ! -f "$BOOT_DIR_ABS/$INITRD" ]]; then
dracut -f --no-hostonly -a "rescue" "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
((ret+=$?))
fi
if [[ "${BOOT_DIR_ABS}" != "/boot" ]]; then
{
echo "title $PRETTY_NAME - Rescue Image"
echo "version $KERNEL_VERSION"
echo "machine-id $MACHINE_ID"
echo "options ${BOOT_OPTIONS[*]} rd.auto=1"
echo "linux $BOOT_DIR/linux"
echo "initrd $BOOT_DIR/initrd"
} > "$LOADER_ENTRY"
else
if [[ -e "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" ]]; then
cp -aT "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" "$LOADER_ENTRY"
else
cp -aT "${KERNEL_IMAGE%/*}/bls.conf" "$LOADER_ENTRY"
fi
sed -i "s/${KERNEL_VERSION}/0-rescue-${MACHINE_ID}/" "$LOADER_ENTRY"
fi
((ret+=$?))
;;
remove)
exit 0
;;
*)
usage
ret=1;;
esac
exit $ret

View File

@ -0,0 +1,365 @@
#!/bin/bash
#
# Copyright 2005-2010 Harald Hoyer <harald@redhat.com>
# Copyright 2005-2010 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
usage() {
{
echo "Usage: ${0##*/} [options] [<initramfs file> [<filename> [<filename> [...] ]]]"
echo "Usage: ${0##*/} [options] -k <kernel version>"
echo
echo "-h, --help print a help message and exit."
echo "-s, --size sort the contents of the initramfs by size."
echo "-m, --mod list modules."
echo "-f, --file <filename> print the contents of <filename>."
echo "--unpack unpack the initramfs, instead of displaying the contents."
echo " If optional filenames are given, will only unpack specified files,"
echo " else the whole image will be unpacked. Won't unpack anything from early cpio part."
echo "--unpackearly unpack the early microcode part of the initramfs."
echo " Same as --unpack, but only unpack files from early cpio part."
echo "-v, --verbose unpack verbosely."
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
echo
} >&2
}
[[ $dracutbasedir ]] || dracutbasedir=/usr/local/lib/dracut
sorted=0
modules=0
unset verbose
declare -A filenames
unset POSIXLY_CORRECT
TEMP=$(getopt \
-o "vshmf:k:" \
--long kver: \
--long file: \
--long mod \
--long help \
--long size \
--long unpack \
--long unpackearly \
--long verbose \
-- "$@")
# shellcheck disable=SC2181
if (($? != 0)); then
usage
exit 1
fi
eval set -- "$TEMP"
while (($# > 0)); do
case $1 in
-k | --kver)
KERNEL_VERSION="$2"
shift
;;
-f | --file)
filenames[${2#/}]=1
shift
;;
-s | --size) sorted=1 ;;
-h | --help)
usage
exit 0
;;
-m | --mod) modules=1 ;;
-v | --verbose) verbose="--verbose" ;;
--unpack) unpack=1 ;;
--unpackearly) unpackearly=1 ;;
--)
shift
break
;;
*)
usage
exit 1
;;
esac
shift
done
[[ $KERNEL_VERSION ]] || KERNEL_VERSION="$(uname -r)"
if [[ $1 ]]; then
image="$1"
if ! [[ -f $image ]]; then
{
echo "$image does not exist"
echo
} >&2
usage
exit 1
fi
else
[[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id
if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
&& [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]]; then
image="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
&& [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
else
image="/boot/initramfs-${KERNEL_VERSION}.img"
fi
fi
shift
while (($# > 0)); do
filenames[${1#/}]=1
shift
done
if ! [[ -f $image ]]; then
{
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
echo
} >&2
usage
exit 1
fi
TMPDIR="$(mktemp -d -t lsinitrd.XXXXXX)"
# shellcheck disable=SC2064
trap "rm -rf '$TMPDIR'" EXIT
dracutlibdirs() {
for d in lib64/dracut lib/dracut usr/lib64/dracut usr/lib/dracut; do
echo "$d/$1"
done
}
extract_files() {
((${#filenames[@]} == 1)) && nofileinfo=1
for f in "${!filenames[@]}"; do
[[ $nofileinfo ]] || echo "initramfs:/$f"
[[ $nofileinfo ]] || echo "========================================================================"
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2> /dev/null
((ret += $?))
[[ $nofileinfo ]] || echo "========================================================================"
[[ $nofileinfo ]] || echo
done
}
list_modules() {
echo "dracut modules:"
# shellcheck disable=SC2046
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs modules.txt) 2> /dev/null
((ret += $?))
}
list_files() {
echo "========================================================================"
if [ "$sorted" -eq 1 ]; then
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
else
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --list | sort -k9
fi
((ret += $?))
echo "========================================================================"
}
list_squash_content() {
SQUASH_IMG="squash-root.img"
SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \
$SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null
if [[ -s $SQUASH_TMPFILE ]]; then
echo "Squashed content ($SQUASH_IMG):"
echo "========================================================================"
unsquashfs -ll "$SQUASH_TMPFILE" | tail -n +4
echo "========================================================================"
fi
}
unpack_files() {
if ((${#filenames[@]} > 0)); then
for f in "${!filenames[@]}"; do
$CAT "$image" 2> /dev/null | cpio -id --quiet $verbose $f
((ret += $?))
done
else
$CAT "$image" 2> /dev/null | cpio -id --quiet $verbose
((ret += $?))
fi
}
read -r -N 2 bin < "$image"
if [ "$bin" = "MZ" ]; then
command -v objcopy > /dev/null || {
echo "Need 'objcopy' to unpack an UEFI executable."
exit 1
}
objcopy \
--dump-section .linux="$TMPDIR/vmlinuz" \
--dump-section .initrd="$TMPDIR/initrd.img" \
--dump-section .cmdline="$TMPDIR/cmdline.txt" \
--dump-section .osrel="$TMPDIR/osrel.txt" \
"$image" /dev/null
uefi="$image"
image="$TMPDIR/initrd.img"
[ -f "$image" ] || exit 1
fi
if ((${#filenames[@]} <= 0)) && [[ -z $unpack ]] && [[ -z $unpackearly ]]; then
if [ -n "$uefi" ]; then
echo -n "initrd in UEFI: $uefi: "
du -h "$image" | while read -r a _ || [ -n "$a" ]; do echo "$a"; done
if [ -f "$TMPDIR/osrel.txt" ]; then
name=$(sed -En '/^PRETTY_NAME/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
id=$(sed -En '/^ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
build=$(sed -En '/^BUILD_ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
echo "OS Release: $name (${id}-${build})"
fi
if [ -f "$TMPDIR/vmlinuz" ]; then
version=$(strings -n 20 "$TMPDIR/vmlinuz" | sed -En '/[0-9]+\.[0-9]+\.[0-9]+/ { p; q 0 }')
echo "Kernel Version: $version"
fi
if [ -f "$TMPDIR/cmdline.txt" ]; then
echo "Command line:"
sed -En 's/\s+/\n/g; s/\x00/\n/; p' "$TMPDIR/cmdline.txt"
fi
else
echo -n "Image: $image: "
du -h "$image" | while read -r a _ || [ -n "$a" ]; do echo "$a"; done
fi
echo "========================================================================"
fi
read -r -N 6 bin < "$image"
case $bin in
$'\x71\xc7'* | 070701)
CAT="cat --"
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2> /dev/null)
# Debian mkinitramfs does not create the file 'early_cpio', so let's check if firmware files exist
[[ "$is_early" ]] || is_early=$(cpio --list --verbose --quiet --to-stdout -- 'kernel/*/microcode/*.bin' < "$image" 2> /dev/null)
if [[ "$is_early" ]]; then
if [[ -n $unpack ]]; then
# should use --unpackearly for early CPIO
:
elif [[ -n $unpackearly ]]; then
unpack_files
elif ((${#filenames[@]} > 0)); then
extract_files
else
echo "Early CPIO image"
list_files
fi
if [[ -d "$dracutbasedir/skipcpio" ]]; then
SKIP="$dracutbasedir/skipcpio/skipcpio"
else
SKIP="$dracutbasedir/skipcpio"
fi
if ! [[ -x $SKIP ]]; then
echo
echo "'$SKIP' not found, cannot display remaining contents!" >&2
echo
exit 0
fi
fi
;;
esac
if [[ $SKIP ]]; then
bin="$($SKIP "$image" | { read -r -N 6 bin && echo "$bin"; })"
else
read -r -N 6 bin < "$image"
fi
case $bin in
$'\x1f\x8b'*)
CAT="zcat --"
;;
BZh*)
CAT="bzcat --"
;;
$'\x71\xc7'* | 070701)
CAT="cat --"
;;
$'\x02\x21'*)
CAT="lz4 -d -c"
;;
$'\x89'LZO$'\0'*)
CAT="lzop -d -c"
;;
$'\x28\xB5\x2F\xFD'*)
CAT="zstd -d -c"
;;
*)
if echo "test" | xz | xzcat --single-stream > /dev/null 2>&1; then
CAT="xzcat --single-stream --"
else
CAT="xzcat --"
fi
;;
esac
skipcpio() {
$SKIP "$@" | $ORIG_CAT
}
if [[ $SKIP ]]; then
ORIG_CAT="$CAT"
CAT=skipcpio
fi
if ((${#filenames[@]} > 1)); then
TMPFILE="$TMPDIR/initrd.cpio"
$CAT "$image" 2> /dev/null > "$TMPFILE"
pre_decompress() {
cat "$TMPFILE"
}
CAT=pre_decompress
fi
ret=0
if [[ -n $unpack ]]; then
unpack_files
elif ((${#filenames[@]} > 0)); then
extract_files
else
# shellcheck disable=SC2046
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs 'dracut-*') 2> /dev/null)
((ret += $?))
echo "Version: $version"
echo
if [ "$modules" -eq 1 ]; then
list_modules
echo "========================================================================"
else
echo -n "Arguments: "
# shellcheck disable=SC2046
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs build-parameter.txt) 2> /dev/null
echo
list_modules
list_files
list_squash_content
fi
fi
exit "$ret"

View File

@ -0,0 +1,93 @@
'\" t
.\" Title: dracut-catimages
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 05/17/2021
.\" Manual: dracut
.\" Source: dracut
.\" Language: English
.\"
.TH "DRACUT\-CATIMAGES" "8" "05/17/2021" "dracut" "dracut"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
dracut-catimages \- creates initial ramdisk image by concatenating images
.SH "SYNOPSIS"
.sp
\fBdracut\-catimages\fR [\fIOPTION\fR\&...] \fI<initramfs base image>\fR [\fI<image>\fR\&...]
.SH "DESCRIPTION"
.sp
dracut\-catimages creates an initial ramdisk image by concatenating several images from the command line and /boot/dracut/*\&.img
.SH "OPTIONS"
.PP
\fB\-f, \-\-force\fR
.RS 4
overwrite existing initramfs file\&.
.RE
.PP
\fB\-i, \-\-imagedir\fR
.RS 4
Directory with additional images to add (default: /boot/dracut/)
.RE
.PP
\fB\-o, \-\-overlaydir\fR
.RS 4
Overlay directory, which contains additional files that will be used to create an additional image
.RE
.PP
\fB\-\-nooverlay\fR
.RS 4
Do not use the overlay directory
.RE
.PP
\fB\-\-noimagedir\fR
.RS 4
Do not use the additional image directory
.RE
.PP
\fB\-h, \-\-help\fR
.RS 4
display help text and exit\&.
.RE
.PP
\fB\-\-debug\fR
.RS 4
output debug information of the build process
.RE
.PP
\fB\-v, \-\-verbose\fR
.RS 4
verbose output during the build process
.RE
.SH "FILES"
.PP
\fI/boot/dracut/*\&.img\fR
.RS 4
images to work with
.RE
.SH "AUTHORS"
.sp
Harald Hoyer
.SH "AVAILABILITY"
.sp
The dracut\-catimages command is part of the dracut package and is available from \m[blue]\fBhttps://dracut\&.wiki\&.kernel\&.org\fR\m[]
.SH "SEE ALSO"
.sp
\fBdracut\fR(8)

View File

@ -0,0 +1,59 @@
DRACUT-CATIMAGES(8)
===================
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
dracut-catimages - creates initial ramdisk image by concatenating images
SYNOPSIS
--------
**dracut-catimages** [_OPTION_...] _<initramfs base image>_ [_<image>_...]
DESCRIPTION
-----------
dracut-catimages creates an initial ramdisk image by concatenating several
images from the command line and /boot/dracut/*.img
OPTIONS
-------
**-f, --force**::
overwrite existing initramfs file.
**-i, --imagedir**::
Directory with additional images to add (default: /boot/dracut/)
**-o, --overlaydir**::
Overlay directory, which contains additional files that will be used to
create an additional image
**--nooverlay**:: Do not use the overlay directory
**--noimagedir**:: Do not use the additional image directory
**-h, --help**:: display help text and exit.
**--debug**:: output debug information of the build process
**-v, --verbose**:: verbose output during the build process
FILES
-----
_/boot/dracut/*.img_::
images to work with
AUTHORS
-------
Harald Hoyer
AVAILABILITY
------------
The dracut-catimages command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
SEE ALSO
--------
*dracut*(8)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,687 @@
DRACUT(8)
=========
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
dracut - low-level tool for generating an initramfs/initrd image
SYNOPSIS
--------
*dracut* [__OPTION...__] [__<image>__ [__<kernel version>__]]
DESCRIPTION
-----------
Create an initramfs <image> for the kernel with the version <kernel version>.
If <kernel version> is omitted, then the version of the actual running
kernel is used. If <image> is omitted or empty, then the default location
/boot/initramfs-<kernel version>.img is used.
dracut creates an initial image used by the kernel for preloading the block
device modules (such as IDE, SCSI or RAID) which are needed to access the root
filesystem, mounting the root filesystem and booting into the real system.
At boot time, the kernel unpacks that archive into RAM disk, mounts and uses it
as initial root file system. All finding of the root device happens in this
early userspace.
Initramfs images are also called "initrd".
For a complete list of kernel command line options see *dracut.cmdline*(7).
If you are dropped to an emergency shell, while booting your initramfs,
the file _/run/initramfs/rdsosreport.txt_ is created, which can be saved to a
(to be mounted by hand) partition (usually /boot) or a USB stick.
Additional debugging info can be produced by adding **rd.debug** to the kernel
command line. _/run/initramfs/rdsosreport.txt_ contains all logs and the output
of some tools. It should be attached to any report about dracut problems.
USAGE
-----
include::dracut.usage.asc[]
OPTIONS
-------
**--kver** _<kernel version>_::
set the kernel version. This enables to specify the kernel version, without
specifying the location of the initramfs image. For example:
----
# dracut --kver 3.5.0-0.rc7.git1.2.fc18.x86_64
----
**-f, --force**::
overwrite existing initramfs file.
**-a, --add** _<list of dracut modules>_::
add a space-separated list of dracut modules to the default set of modules.
This parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --add "module1 module2" ...
----
===============================
**--force-add** _<list of dracut modules>_::
force to add a space-separated list of dracut modules to the default set of
modules, when -H is specified. This parameter can be specified multiple
times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --force-add "module1 module2" ...
----
===============================
**-o, --omit** _<list of dracut modules>_::
omit a space-separated list of dracut modules. This parameter can be
specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --omit "module1 module2" ...
----
===============================
**-m, --modules** _<list of dracut modules>_::
specify a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_. This
parameter can be specified multiple times.
This option forces dracut to only include the specified dracut modules.
In most cases the "--add" option is what you want to use.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --modules "module1 module2" ...
----
===============================
**-d, --drivers** _<list of kernel modules>_::
specify a space-separated list of kernel modules to exclusively include
in the initramfs. The kernel modules have to be specified without the ".ko"
suffix. This parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --drivers "kmodule1 kmodule2" ...
----
===============================
**--add-drivers** _<list of kernel modules>_::
specify a space-separated list of kernel modules to add to the initramfs.
The kernel modules have to be specified without the ".ko" suffix. This
parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --add-drivers "kmodule1 kmodule2" ...
----
===============================
**--force-drivers** _<list of kernel modules>_::
See add-drivers above. But in this case it is ensured that the drivers
are tried to be loaded early via modprobe.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --force-drivers "kmodule1 kmodule2" ...
----
===============================
**--omit-drivers** _<list of kernel modules>_::
specify a space-separated list of kernel modules not to add to the
initramfs.
The kernel modules have to be specified without the ".ko" suffix. This
parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --omit-drivers "kmodule1 kmodule2" ...
----
===============================
**--filesystems** _<list of filesystems>_::
specify a space-separated list of kernel filesystem modules to exclusively
include in the generic initramfs. This parameter can be specified multiple
times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --filesystems "filesystem1 filesystem2" ...
----
===============================
**-k, --kmoddir** _<kernel directory>_::
specify the directory, where to look for kernel modules
**--fwdir** _<dir>[:<dir>...]++_::
specify additional directories, where to look for firmwares. This parameter
can be specified multiple times.
**--kernel-cmdline <parameters>**::
specify default kernel command line parameters
**--kernel-only**::
only install kernel drivers and firmware files
**--no-kernel**::
do not install kernel drivers and firmware files
**--early-microcode**::
Combine early microcode with ramdisk
**--no-early-microcode**::
Do not combine early microcode with ramdisk
**--print-cmdline**::
print the kernel command line for the current disk layout
**--mdadmconf**::
include local _/etc/mdadm.conf_
**--nomdadmconf**::
do not include local _/etc/mdadm.conf_
**--lvmconf**::
include local _/etc/lvm/lvm.conf_
**--nolvmconf**::
do not include local _/etc/lvm/lvm.conf_
**--fscks** [LIST]::
add a space-separated list of fsck tools, in addition to _dracut.conf_'s
specification; the installation is opportunistic (non-existing tools are
ignored)
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --fscks "fsck.foo barfsck" ...
----
===============================
**--nofscks**::
inhibit installation of any fsck tools
**--strip**::
strip binaries in the initramfs (default)
**--nostrip**::
do not strip binaries in the initramfs
**--hardlink**::
hardlink files in the initramfs (default)
**--nohardlink**::
do not hardlink files in the initramfs
**--prefix** _<dir>_::
prefix initramfs files with the specified directory
**--noprefix**::
do not prefix initramfs files (default)
**-h, --help**::
display help text and exit.
**--debug**::
output debug information of the build process
**-v, --verbose**::
increase verbosity level (default is info(4))
**--version**::
display version and exit
**-q, --quiet**:: decrease verbosity level (default is info(4))
**-c, --conf** _<dracut configuration file>_::
specify configuration file to use.
+
Default:
_/etc/dracut.conf_
**--confdir** _<configuration directory>_::
specify configuration directory to use.
+
Default:
_/etc/dracut.conf.d_
**--tmpdir** _<temporary directory>_::
specify temporary directory to use.
+
Default:
_/var/tmp_
**-r, --sysroot** _<sysroot directory>_::
specify the sysroot directory to collect files from.
This is useful to create the initramfs image from
a cross-compiled sysroot directory. For the extra helper
variables, see *ENVIRONMENT* below.
+
Default:
_empty_
**--sshkey** _<sshkey file>_:: ssh key file used with ssh-client module.
**--logfile** _<logfile>_:: logfile to use; overrides any setting from
the configuration files.
+
Default:
_/var/log/dracut.log_
**-l, --local**::
activates the local mode. dracut will use modules from the current working
directory instead of the system-wide installed modules in
_/usr/lib/dracut/modules.d_.
This is useful when running dracut from a git checkout.
**-H, --hostonly**::
Host-Only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration.
+
[WARNING]
====
If chrooted to another root other than the real root device, use "--fstab" and
provide a valid _/etc/fstab_.
====
**-N, --no-hostonly**::
Disable Host-Only mode
**--hostonly-cmdline**:
Store kernel command line arguments needed in the initramfs
**--no-hostonly-cmdline**:
Do not store kernel command line arguments needed in the initramfs
**--no-hostonly-default-device**:
Do not generate implicit host devices like root, swap, fstab, etc.
Use "--mount" or "--add-device" to explicitly add devices as needed.
**--hostonly-i18n**:
Install only needed keyboard and font files according to the host configuration (default).
**--no-hostonly-i18n**:
Install all keyboard and font files available.
**--persistent-policy** _<policy>_::
Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label"
**--fstab**::
Use _/etc/fstab_ instead of _/proc/self/mountinfo_.
**--add-fstab** _<filename>_::
Add entries of _<filename>_ to the initramfs /etc/fstab.
**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ [_<filesystem options>_ [_<dump frequency>_ [_<fsck order>_]]]"::
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ in the
initramfs. _<filesystem options>_, _<dump options>_ and _<fsck order>_ can
be specified, see fstab manpage for the details.
The default _<filesystem options>_ is "defaults".
The default _<dump frequency>_ is "0".
the default _<fsck order>_ is "2".
**--mount** "_<mountpoint>_"::
Like above, but _<device>_, _<filesystem type>_ and _<filesystem options>_
are determined by looking at the current mounts.
**--add-device** _<device>_ ::
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
This can be useful in hostonly mode for resume support when your swap is on
LVM or an encrypted partition.
[NB --device can be used for compatibility with earlier releases]
**-i, --include** _<SOURCE>_ _<TARGET>_::
include the files in the SOURCE directory into the
TARGET directory in the final initramfs. If SOURCE is a file, it will be
installed to TARGET in the final initramfs. This parameter can be specified
multiple times.
**-I, --install** _<file list>_::
install the space separated list of files into the initramfs.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --install "/bin/foo /sbin/bar" ...
----
===============================
**--install-optional** _<file list>_::
install the space separated list of files into the initramfs, if they exist.
**--gzip**::
Compress the generated initramfs using gzip. This will be done by default,
unless another compression option or --no-compress is passed. Equivalent to
"--compress=gzip -9"
**--bzip2**::
Compress the generated initramfs using bzip2.
+
[WARNING]
====
Make sure your kernel has bzip2 decompression support compiled in, otherwise you
will not be able to boot. Equivalent to "--compress=bzip2"
====
**--lzma**::
Compress the generated initramfs using lzma.
+
[WARNING]
====
Make sure your kernel has lzma decompression support compiled in, otherwise you
will not be able to boot. Equivalent to "lzma --compress=lzma -9"
====
**--xz**::
Compress the generated initramfs using xz.
+
[WARNING]
====
Make sure your kernel has xz decompression support compiled in, otherwise you
will not be able to boot. Equivalent to
"lzma --compress=xz --check=crc32 --lzma2=dict=1MiB"
====
**--lzo**::
Compress the generated initramfs using lzop.
[WARNING]
====
Make sure your kernel has lzo decompression support compiled in, otherwise you
will not be able to boot.
====
**--lz4**::
Compress the generated initramfs using lz4.
[WARNING]
====
Make sure your kernel has lz4 decompression support compiled in, otherwise you
will not be able to boot.
====
**--zstd**::
Compress the generated initramfs using Zstandard.
[WARNING]
====
Make sure your kernel has zstd decompression support compiled in, otherwise you
will not be able to boot.
====
**--compress** _<compressor>_::
Compress the generated initramfs using the passed compression program. If
you pass it just the name of a compression program, it will call that
program with known-working arguments. If you pass a quoted string with
arguments, it will be called with exactly those arguments. Depending on what
you pass, this may result in an initramfs that the kernel cannot decompress.
The default value can also be set via the _INITRD_COMPRESS_ environment variable.
**--no-compress**::
Do not compress the generated initramfs. This will override any other
compression options.
**--reproducible**::
Create reproducible images.
**--no-reproducible**::
Do not create reproducible images.
**--list-modules**::
List all available dracut modules.
**-M, --show-modules**::
Print included module's name to standard output during build.
**--keep**::
Keep the initramfs temporary directory for debugging purposes.
**--printsize**::
Print out the module install size
**--profile**:
Output profile information of the build process
**--ro-mnt**:
Mount / and /usr read-only by default.
**-L, --stdlog** _<level>_::
[0-6] Specify logging level (to standard error)
----
0 - suppress any messages
1 - only fatal errors
2 - all errors
3 - warnings
4 - info
5 - debug info (here starts lots of output)
6 - trace info (and even more)
----
**--regenerate-all**::
Regenerate all initramfs images at the default location with the kernel
versions found on the system. Additional parameters are passed through.
**--loginstall _<DIR>_**::
Log all files installed from the host to _<DIR>_.
**--uefi**::
Instead of creating an initramfs image, dracut will create an UEFI executable,
which can be executed by an UEFI BIOS. The default output filename is
_<EFI>/EFI/Linux/linux-$kernel$-<MACHINE_ID>-<BUILD_ID>.efi_. <EFI> might be
_/efi_, _/boot_ or _/boot/efi_ depending on where the ESP partition is mounted.
The <BUILD_ID> is taken from BUILD_ID in _/usr/lib/os-release_ or if it exists
_/etc/os-release_ and is left out, if BUILD_ID is non-existant or empty.
**--no-uefi**::
Disables UEFI mode.
**--no-machineid**::
affects the default output filename of **--uefi** and will discard the <MACHINE_ID>
part.
**--uefi-stub _<FILE>_**::
Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
kernel command line and boots the kernel. The default is
_$prefix/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
**--uefi-splash-image _<FILE>_**::
Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image
format.
**--kernel-image _<FILE>_**::
Specifies the kernel image, which to include in the UEFI executable. The default is
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
ENVIRONMENT
-----------
_INITRD_COMPRESS_::
sets the default compression program. See **--compress**.
_DRACUT_LDCONFIG_::
sets the _ldconfig_ program path and options. Optional.
Used for **--sysroot**.
+
Default:
_ldconfig_
_DRACUT_LDD_::
sets the _ldd_ program path and options. Optional.
Used for **--sysroot**.
+
Default:
_ldd_
_DRACUT_TESTBIN_::
sets the initially tested binary for detecting library paths.
Optional. Used for **--sysroot**. In the cross-compiled sysroot,
the default value (_/bin/sh_) is unusable, as it is an absolute
symlink and points outside the sysroot directory.
+
Default:
_/bin/sh_
_DRACUT_INSTALL_::
overrides path and options for executing _dracut-install_ internally.
Optional. Can be used to debug _dracut-install_ while running the
main dracut script.
+
Default:
_dracut-install_
+
Example:
DRACUT_INSTALL="valgrind dracut-install"
_DRACUT_COMPRESS_BZIP2_::
_DRACUT_COMPRESS_BZIP2_::
_DRACUT_COMPRESS_LBZIP2_::
_DRACUT_COMPRESS_LZMA_::
_DRACUT_COMPRESS_XZ_::
_DRACUT_COMPRESS_GZIP_::
_DRACUT_COMPRESS_PIGZ_::
_DRACUT_COMPRESS_LZOP_::
_DRACUT_COMPRESS_ZSTD_::
_DRACUT_COMPRESS_LZ4_::
_DRACUT_COMPRESS_CAT_::
overrides for compression utilities to support using them from
non-standard paths.
+
Default values are the default compression utility names to be found in **PATH**.
_DRACUT_ARCH_::
overrides the value of **uname -m**. Used for **--sysroot**.
+
Default:
_empty_ (the value of **uname -m** on the host system)
_SYSTEMD_VERSION_::
overrides systemd version. Used for **--sysroot**.
_SYSTEMCTL_::
overrides the systemctl binary. Used for **--sysroot**.
_NM_VERSION_::
overrides the NetworkManager version. Used for **--sysroot**.
_DRACUT_INSTALL_PATH_::
overrides **PATH** environment for **dracut-install** to look for
binaries relative to **--sysroot**. In a cross-compiled environment
(e.g. Yocto), PATH points to natively built binaries that are not
in the host's /bin, /usr/bin, etc. **dracut-install** still needs plain
/bin and /usr/bin that are relative to the cross-compiled sysroot.
+
Default:
_PATH_
_DRACUT_INSTALL_LOG_TARGET_::
overrides **DRACUT_LOG_TARGET** for **dracut-install**. It allows
running **dracut-install* to run with different log target that
**dracut** runs with.
+
Default:
_DRACUT_LOG_TARGET_
_DRACUT_INSTALL_LOG_LEVEL_::
overrides **DRACUT_LOG_LEVEL** for **dracut-install**. It allows
running **dracut-install* to run with different log level that
**dracut** runs with.
+
Default:
_DRACUT_LOG_LEVEL_
FILES
-----
_/var/log/dracut.log_::
logfile of initramfs image creation
_/tmp/dracut.log_::
logfile of initramfs image creation, if _/var/log/dracut.log_ is not
writable
_/etc/dracut.conf_::
see dracut.conf5
_/etc/dracut.conf.d/*.conf_::
see dracut.conf5
_/usr/lib/dracut/dracut.conf.d/*.conf_::
see dracut.conf5
Configuration in the initramfs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_/etc/conf.d/_::
Any files found in _/etc/conf.d/_ will be sourced in the initramfs to
set initial values. Command line options will override these values
set in the configuration files.
_/etc/cmdline_::
Can contain additional command line options. Deprecated, better use
/etc/cmdline.d/*.conf.
_/etc/cmdline.d/*.conf_::
Can contain additional command line options.
AVAILABILITY
------------
The dracut command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
AUTHORS
-------
Harald Hoyer
Victor Lowther
Amadeusz Żołnowski
Hannes Reinecke
Daniel Molkentin
Will Woods
Philippe Seewer
Warren Togami
SEE ALSO
--------
*dracut.cmdline*(7) *dracut.conf*(5) *lsinitrd*(1)

View File

@ -0,0 +1,182 @@
dracut {mainversion}
====================
:author: Harald Hoyer
:email: harald@redhat.com
:revnumber: {version}
:language: bash
= Introduction
This section is a modified version of
http://en.wikipedia.org/wiki/Initrd which is licensed under the
Creative Commons Attribution/Share-Alike License.
== Definition
An _initial ramdisk_ is a temporary file system used in the boot process of the
Linux kernel. _initrd_ and _initramfs_ refer to slightly different schemes for
loading this file system into memory. Both are commonly used to make
preparations before the real root file system can be mounted.
== Rationale
Many Linux distributions ship a single, generic kernel image that is intended to
boot as wide a variety of hardware as possible. The device drivers for this
generic kernel image are included as loadable modules, as it is not possible to
statically compile them all into the one kernel without making it too large to
boot from computers with limited memory or from lower-capacity media like floppy
disks.
This then raises the problem of detecting and loading the modules necessary to
mount the root file system at boot time (or, for that matter, deducing where or
what the root file system is).
To further complicate matters, the root file system may be on a software RAID
volume, LVM, NFS (on diskless workstations), or on an encrypted partition. All
of these require special preparations to mount.
Another complication is kernel support for hibernation, which suspends the
computer to disk by dumping an image of the entire system to a swap partition or
a regular file, then powering off. On next boot, this image has to be made
accessible before it can be loaded back into memory.
To avoid having to hardcode handling for so many special cases into the kernel,
an initial boot stage with a temporary root file system
—now dubbed early user space— is used. This root file system would contain
user-space helpers that would do the hardware detection, module loading and
device discovery necessary to get the real root file system mounted.
== Implementation
An image of this initial root file system (along with the kernel image) must be
stored somewhere accessible by the Linux bootloader or the boot firmware of the
computer. This can be:
* The root file system itself
* A boot image on an optical disc
* A small ext2/ext3 or FAT-formatted partition on a local disk
(a _boot partition_)
* A TFTP server (on systems that can boot from Ethernet)
The bootloader will load the kernel and initial root file system image into
memory and then start the kernel, passing in the memory address of the image.
Depending on which algorithms were compiled statically into it, the kernel can
currently unpack initrd/initramfs images compressed with gzip, bzip2 and LZMA.
== Mount preparations
dracut can generate a customized initramfs image which contains only whatever is
necessary to boot some particular computer, such as ATA, SCSI and filesystem
kernel modules (host-only mode).
dracut can also generate a more generic initramfs image (default mode).
dracut's initramfs starts only with the device name of the root file system (or
its UUID) and must discover everything else at boot time. A complex cascade of
tasks must be performed to get the root file system mounted:
* Any hardware drivers that the boot process depends on must be loaded. All
kernel modules for common storage devices are packed onto the initramfs and then
udev pulls in modules matching the computer's detected hardware.
* On systems which display a boot rd.splash screen, the video hardware must be
initialized and a user-space helper started to paint animations onto the display
in lockstep with the boot process.
* If the root file system is on NFS, dracut does then:
** Bring up the primary network interface.
** Invoke a DHCP client, with which it can obtain a DHCP lease.
** Extract the name of the NFS share and the address of the NFS server from the
lease.
** Mount the NFS share.
* If the root file system appears to be on a software RAID device, there is no
way of knowing which devices the RAID volume spans; the standard MD utilities
must be invoked to scan all available block devices with a raid signature and
bring the required ones online.
* If the root file system appears to be on a logical volume, the LVM utilities
must be invoked to scan for and activate the volume group containing it.
* If the root file system is on an encrypted block device:
** Invoke a helper script to prompt the user to type in a passphrase and/or
insert a hardware token (such as a smart card or a USB security dongle).
* Create a decryption target with the device mapper.
dracut uses udev, an event-driven hotplug agent, which invokes helper programs
as hardware devices, disk partitions and storage volumes matching certain rules
come online. This allows discovery to run in parallel, and to progressively
cascade into arbitrary nestings of LVM, RAID or encryption to get at the root
file system.
When the root file system finally becomes visible:
* Any maintenance tasks which cannot run on a mounted root file system
are done.
* The root file system is mounted read-only.
* Any processes which must continue running (such as the rd.splash screen helper
and its command FIFO) are hoisted into the newly-mounted root file system.
The final root file system cannot simply be mounted over /, since that would
make the scripts and tools on the initial root file system inaccessible for any
final cleanup tasks. On an initramfs, the initial root file system cannot be
rotated away. Instead, it is simply emptied and the final root file system
mounted over the top.
If the systemd module is used in the initramfs, the ordering of the services
started looks like <<dracutbootup7>>.
== Dracut on shutdown
On a systemd driven system, the dracut initramfs is also used for the shutdown
procedure.
The following steps are executed during a shutdown:
* systemd switches to the shutdown.target
* systemd starts
$prefix/lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
* dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore
which unpacks the initramfs to /run/initramfs
* systemd finishes shutdown.target
* systemd kills all processes
* systemd tries to unmount everything and mounts the remaining read-only
* systemd checks, if there is a /run/initramfs/shutdown executable
* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown.
The old root is then mounted on /oldroot.
/usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
* shutdown will try to unmount every /oldroot mount and calls the various
shutdown hooks from the dracut modules
This ensures, that all devices are disassembled and unmounted cleanly.
= User Manual
:leveloffset: 1
include::dracut.8.asc[]
:leveloffset: 1
[[dracutconf5]]
include::dracut.conf.5.asc[]
[[dracutcmdline7]]
include::dracut.cmdline.7.asc[]
[[lsinitrd1]]
include::lsinitrd.1.asc[]
= Developer Manual
:leveloffset: 1
[[dracutmodules7]]
include::dracut.modules.7.asc[]
[[dracutbootup7]]
include::dracut.bootup.7.asc[]
:leveloffset: 0
[appendix]
License
-------
This work is licensed under the Creative Commons Attribution/Share-Alike
License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

View File

@ -0,0 +1,145 @@
'\" t
.\" Title: dracut.bootup
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 05/17/2021
.\" Manual: dracut
.\" Source: dracut 054-2-gb9b6f0ee
.\" Language: English
.\"
.TH "DRACUT\&.BOOTUP" "7" "05/17/2021" "dracut 054\-2\-gb9b6f0ee" "dracut"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
dracut.bootup \- boot ordering in the initramfs
.SH "DESCRIPTION"
.sp
This flow chart illustrates the ordering of the services, if systemd is used in the dracut initramfs\&.
.sp
.if n \{\
.RS 4
.\}
.nf
systemd\-journal\&.socket
|
v
dracut\-cmdline\&.service
|
v
dracut\-pre\-udev\&.service
|
v
systemd\-udevd\&.service
|
v
local\-fs\-pre\&.target dracut\-pre\-trigger\&.service
| |
v v
(various mounts) (various swap systemd\-udev\-trigger\&.service
| devices\&.\&.\&.) | (various low\-level (various low\-level
| | | services: seed, API VFS mounts:
v v v tmpfiles, random mqueue, configfs,
local\-fs\&.target swap\&.target dracut\-initqueue\&.service sysctl, \&.\&.\&.) debugfs, \&.\&.\&.)
| | | | |
\e_______________|____________________ | ___________________|____________________/
\e|/
v
sysinit\&.target
|
_________________/|\e___________________
/ | \e
| | |
v | v
(various | rescue\&.service
sockets\&.\&.\&.) | |
| | v
v | rescue\&.target
sockets\&.target |
| |
\e_________________ | emergency\&.service
\e| |
v v
basic\&.target emergency\&.target
|
______________________/|
/ |
| v
| dracut\-pre\-mount\&.service
| |
| v
| sysroot\&.mount
| |
| v
| initrd\-root\-fs\&.target
(custom initrd services) |
| v
| dracut\-mount\&.service
| |
| v
| initrd\-parse\-etc\&.service
| |
| v
| (sysroot\-usr\&.mount and
| various mounts marked
| with fstab option
| x\-initrd\&.mount)
| |
| v
| initrd\-fs\&.target
\e______________________ |
\e|
v
initrd\&.target
|
v
dracut\-pre\-pivot\&.service
|
v
initrd\-cleanup\&.service
isolates to
initrd\-switch\-root\&.target
|
v
______________________/|
/ |
| initrd\-udevadm\-cleanup\-db\&.service
| |
(custom initrd services) |
| |
\e______________________ |
\e|
v
initrd\-switch\-root\&.target
|
v
initrd\-switch\-root\&.service
|
v
switch\-root
.fi
.if n \{\
.RE
.\}
.SH "AUTHOR"
.sp
Harald Hoyer
.SH "SEE ALSO"
.sp
\fBdracut\fR(8) \fBbootup\fR(7)

View File

@ -0,0 +1,124 @@
DRACUT.BOOTUP(7)
================
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
dracut.bootup - boot ordering in the initramfs
DESCRIPTION
-----------
This flow chart illustrates the ordering of the services, if systemd is used in
the dracut initramfs.
----
systemd-journal.socket
|
v
dracut-cmdline.service
|
v
dracut-pre-udev.service
|
v
systemd-udevd.service
|
v
local-fs-pre.target dracut-pre-trigger.service
| |
v v
(various mounts) (various swap systemd-udev-trigger.service
| devices...) | (various low-level (various low-level
| | | services: seed, API VFS mounts:
v v v tmpfiles, random mqueue, configfs,
local-fs.target swap.target dracut-initqueue.service sysctl, ...) debugfs, ...)
| | | | |
\_______________|____________________ | ___________________|____________________/
\|/
v
sysinit.target
|
_________________/|\___________________
/ | \
| | |
v | v
(various | rescue.service
sockets...) | |
| | v
v | rescue.target
sockets.target |
| |
\_________________ | emergency.service
\| |
v v
basic.target emergency.target
|
______________________/|
/ |
| v
| dracut-pre-mount.service
| |
| v
| sysroot.mount
| |
| v
| initrd-root-fs.target
(custom initrd services) |
| v
| dracut-mount.service
| |
| v
| initrd-parse-etc.service
| |
| v
| (sysroot-usr.mount and
| various mounts marked
| with fstab option
| x-initrd.mount)
| |
| v
| initrd-fs.target
\______________________ |
\|
v
initrd.target
|
v
dracut-pre-pivot.service
|
v
initrd-cleanup.service
isolates to
initrd-switch-root.target
|
v
______________________/|
/ |
| initrd-udevadm-cleanup-db.service
| |
(custom initrd services) |
| |
\______________________ |
\|
v
initrd-switch-root.target
|
v
initrd-switch-root.service
|
v
switch-root
----
AUTHOR
------
Harald Hoyer
SEE ALSO
--------
*dracut*(8) *bootup*(7)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,343 @@
'\" t
.\" Title: dracut.conf
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 05/17/2021
.\" Manual: dracut
.\" Source: dracut 054-2-gb9b6f0ee
.\" Language: English
.\"
.TH "DRACUT\&.CONF" "5" "05/17/2021" "dracut 054\-2\-gb9b6f0ee" "dracut"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
dracut.conf \- configuration file(s) for dracut
.SH "SYNOPSIS"
.sp
\fI/etc/dracut\&.conf\fR \fI/etc/dracut\&.conf\&.d/*\&.conf\fR \fI/usr/lib/dracut/dracut\&.conf\&.d/*\&.conf\fR
.SH "DESCRIPTION"
.sp
\fIdracut\&.conf\fR is loaded during the initialisation phase of dracut\&. Command line parameter will override any values set here\&.
.sp
\fI*\&.conf\fR files are read from /usr/lib/dracut/dracut\&.conf\&.d and /etc/dracut\&.conf\&.d\&. Files with the same name in /etc/dracut\&.conf\&.d will replace files in /usr/lib/dracut/dracut\&.conf\&.d\&. The files are then read in alphanumerical order and will override parameters set in \fI/etc/dracut\&.conf\fR\&. Each line specifies an attribute and a value\&. A \fI#\fR indicates the beginning of a comment; following characters, up to the end of the line are not interpreted\&.
.sp
dracut command line options will override any values set here\&.
.sp
Configuration files must have the extension \&.conf; other extensions are ignored\&.
.PP
\fBadd_dracutmodules+=\fR"\ \&\fI<dracut modules>\fR\ \&"
.RS 4
Add a space\-separated list of dracut modules to call when building the initramfs\&. Modules are located in
\fI/usr/lib/dracut/modules\&.d\fR\&.
.RE
.PP
\fBdracutmodules+=\fR"\ \&\fI<dracut modules>\fR\ \&"
.RS 4
Specify a space\-separated list of dracut modules to call when building the initramfs\&. Modules are located in
\fI/usr/lib/dracut/modules\&.d\fR\&. This option forces dracut to only include the specified dracut modules\&. In most cases the "add_dracutmodules" option is what you want to use\&.
.RE
.PP
\fBomit_dracutmodules+=\fR"\ \&\fI<dracut modules>\fR\ \&"
.RS 4
Omit a space\-separated list of dracut modules to call when building the initramfs\&. Modules are located in
\fI/usr/lib/dracut/modules\&.d\fR\&.
.RE
.PP
\fBdrivers+=\fR"\ \&\fI<kernel modules>\fR\ \&"
.RS 4
Specify a space\-separated list of kernel modules to exclusively include in the initramfs\&. The kernel modules have to be specified without the "\&.ko" suffix\&.
.RE
.PP
\fBadd_drivers+=\fR"\ \&\fI<kernel modules>\fR\ \&"
.RS 4
Specify a space\-separated list of kernel modules to add to the initramfs\&. The kernel modules have to be specified without the "\&.ko" suffix\&.
.RE
.PP
\fBforce_drivers+=\fR"\ \&\fI<list of kernel modules>\fR\ \&"
.RS 4
See add_drivers above\&. But in this case it is ensured that the drivers are tried to be loaded early via modprobe\&.
.RE
.PP
\fBomit_drivers+=\fR"\ \&\fI<kernel modules>\fR\ \&"
.RS 4
Specify a space\-separated list of kernel modules not to add to the initramfs\&. The kernel modules have to be specified without the "\&.ko" suffix\&.
.RE
.PP
\fBfilesystems+=\fR"\ \&\fI<filesystem names>\fR\ \&"
.RS 4
Specify a space\-separated list of kernel filesystem modules to exclusively include in the generic initramfs\&.
.RE
.PP
\fBdrivers_dir=\fR"\fI<kernel modules directory>\fR"
.RS 4
Specify the directory, where to look for kernel modules
.RE
.PP
\fBfw_dir+=\fR"\ \&:\fI<dir>\fR[:\fI<dir>\fR\ \&\&...]\ \&"
.RS 4
Specify additional directories, where to look for firmwares, separated by :
.RE
.PP
\fBinstall_items+=\fR"\ \&\fI<file>\fR[ \fI<file>\fR\ \&\&...]\ \&"
.RS 4
Specify additional files to include in the initramfs, separated by spaces\&.
.RE
.PP
\fBinstall_optional_items+=\fR"\ \&\fI<file>\fR[ \fI<file>\fR\ \&\&...]\ \&"
.RS 4
Specify additional files to include in the initramfs, separated by spaces, if they exist\&.
.RE
.PP
\fBcompress=\fR"\fI{cat|bzip2|lzma|xz|gzip|lzo|lz4|zstd|<compressor [args \&...]>}\fR"
.RS 4
Compress the generated initramfs using the passed compression program\&. If you pass it just the name of a compression program, it will call that program with known\-working arguments\&. If you pass arguments, it will be called with exactly those arguments\&. Depending on what you pass, this may result in an initramfs that the kernel cannot decompress\&. To disable compression, use "cat"\&.
.RE
.PP
\fBdo_strip=\fR"\fI{yes|no}\fR"
.RS 4
Strip binaries in the initramfs (default=yes)
.RE
.PP
\fBhostonly=\fR"\fI{yes|no}\fR"
.RS 4
Host\-Only mode: Install only what is needed for booting the local host instead of a generic host and generate host\-specific configuration\&.
.RE
.PP
\fBhostonly_cmdline=\fR"\fI{yes|no}\fR"
.RS 4
If set to "yes", store the kernel command line arguments needed in the initramfs
.RE
.PP
\fBpersistent_policy=\fR"\fI<policy>\fR"
.RS 4
Use
\fI<policy>\fR
to address disks and partitions\&.
\fI<policy>\fR
can be any directory name found in /dev/disk\&. E\&.g\&. "by\-uuid", "by\-label"
.RE
.PP
\fBtmpdir=\fR"\fI<temporary directory>\fR"
.RS 4
Specify temporary directory to use\&.
.RE
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBWarning\fR
.ps -1
.br
.sp
If chrooted to another root other than the real root device, use \-\-fstab and provide a valid \fI/etc/fstab\fR\&.
.sp .5v
.RE
.PP
\fBuse_fstab=\fR"\fI{yes|no}\fR"
.RS 4
Use
\fI/etc/fstab\fR
instead of
\fI/proc/self/mountinfo\fR\&.
.RE
.PP
\fBadd_fstab+=\fR"\ \&\fI<filename>\fR\ \&"
.RS 4
Add entries of
\fI<filename>\fR
to the initramfs /etc/fstab\&.
.RE
.PP
\fBadd_device+=\fR"\ \&\fI<device>\fR\ \&"
.RS 4
Bring up
\fI<device>\fR
in initramfs,
\fI<device>\fR
should be the device name\&. This can be useful in hostonly mode for resume support when your swap is on LVM an encrypted partition\&.
.RE
.PP
\fBmdadmconf=\fR"\fI{yes|no}\fR"
.RS 4
Include local
\fI/etc/mdadm\&.conf\fR
(default=yes)
.RE
.PP
\fBlvmconf=\fR"\fI{yes|no}\fR"
.RS 4
Include local
\fI/etc/lvm/lvm\&.conf\fR
(default=yes)
.RE
.PP
\fBfscks=\fR"\ \&\fI<fsck tools>\fR\ \&"
.RS 4
Add a space\-separated list of fsck tools\&. If nothing is specified, the default is: "umount mount /sbin/fsck* xfs_db xfs_check xfs_repair e2fsck jfs_fsck reiserfsck btrfsck"\&. The installation is opportunistic (non\-existing tools are ignored)\&.
.RE
.PP
\fBnofscks=\fR"\fI{yes|no}\fR"
.RS 4
If specified, inhibit installation of any fsck tools\&.
.RE
.PP
\fBro_mnt=\fR"\fI{yes|no}\fR"
.RS 4
Mount
\fI/\fR
and
\fI/usr\fR
read\-only by default\&.
.RE
.PP
\fBkernel_cmdline=\fR"\fIparameters\fR"
.RS 4
Specify default kernel command line parameters
.RE
.PP
\fBkernel_only=\fR"\fI{yes|no}\fR"
.RS 4
Only install kernel drivers and firmware files\&. (default=no)
.RE
.PP
\fBno_kernel=\fR"\fI{yes|no}\fR"
.RS 4
Do not install kernel drivers and firmware files (default=no)
.RE
.PP
\fBacpi_override=\fR"\fI{yes|no}\fR"
.RS 4
[WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING!
Override BIOS provided ACPI tables\&. For further documentation read Documentation/acpi/initrd_table_override\&.txt in the kernel sources\&. Search for ACPI table files (must have \&.aml suffix) in acpi_table_dir= directory (see below) and add them to a separate uncompressed cpio archive\&. This cpio archive gets glued (concatenated, uncompressed one must be the first one) to the compressed cpio archive\&. The first, uncompressed cpio archive is for data which the kernel must be able to access very early (and cannot make use of uncompress algorithms yet) like microcode or ACPI tables (default=no)\&.
.RE
.PP
\fBacpi_table_dir=\fR"\fI<dir>\fR"
.RS 4
Directory to search for ACPI tables if acpi_override= is set to yes\&.
.RE
.PP
\fBearly_microcode=\fR"{yes|no}"
.RS 4
Combine early microcode with ramdisk (default=yes)
.RE
.PP
\fBstdloglvl\fR="\fI{0\-6}\fR"
.RS 4
Set logging to standard error level\&.
.RE
.PP
\fBsysloglvl\fR="\fI{0\-6}\fR"
.RS 4
Set logging to syslog level\&.
.RE
.PP
\fBfileloglvl=\fR"\fI{0\-6}\fR"
.RS 4
Set logging to file level\&.
.RE
.PP
\fBlogfile=\fR"\fI<file>\fR"
.RS 4
Path to log file\&.
.RE
.PP
\fBshow_modules=\fR"\fI{yes|no}\fR"
.RS 4
Print the name of the included modules to standard output during build\&.
.RE
.PP
\fBi18n_vars=\fR"\fI<variable mapping>\fR"
.RS 4
Distribution specific variable mapping\&. See dracut/modules\&.d/10i18n/README for a detailed description\&.
.RE
.PP
\fBi18n_default_font=\fR"\fI<fontname>\fR"
.RS 4
The font <fontname> to install, if not specified otherwise\&. Default is "eurlatgr"\&.
.RE
.PP
\fBi18n_install_all=\fR"\fI{yes|no}\fR"
.RS 4
Install everything regardless of generic or hostonly mode\&.
.RE
.PP
\fBreproducible=\fR"\fI{yes|no}\fR"
.RS 4
Create reproducible images\&.
.RE
.PP
\fBloginstall=\fR"\fI<DIR>\fR"
.RS 4
Log all files installed from the host to
\fI<DIR>\fR\&.
.RE
.PP
\fBuefi_stub=\fR"\fI<FILE>\fR"
.RS 4
Specifies the UEFI stub loader, which will load the attached kernel, initramfs and kernel command line and boots the kernel\&. The default is
\fI/lib/systemd/boot/efi/linux<EFI\-MACHINE\-TYPE\-NAME>\&.efi\&.stub\fR
.RE
.PP
\fBuefi_splash_image=\fR"\fI<FILE>\fR"
.RS 4
Specifies the UEFI stub loader\(cqs splash image\&. Requires bitmap (\fB\&.bmp\fR) image format\&.
.RE
.PP
\fBuefi_secureboot_cert=\fR"\fI<FILE>\fR", \fBuefi_secureboot_key=\fR"\fI<FILE>\fR"
.RS 4
Specifies a certificate and corresponding key, which are used to sign the created UEFI executable\&. Requires both certificate and key need to be specified and
\fIsbsign\fR
to be installed\&.
.RE
.PP
\fBkernel_image=\fR"\fI<FILE>\fR"
.RS 4
Specifies the kernel image, which to include in the UEFI executable\&. The default is
\fI/lib/modules/<KERNEL\-VERSION>/vmlinuz\fR
or
\fI/boot/vmlinuz\-<KERNEL\-VERSION>\fR
.RE
.SH "FILES"
.PP
\fI/etc/dracut\&.conf\fR
.RS 4
Old configuration file\&. You better use your own file in
\fI/etc/dracut\&.conf\&.d/\fR\&.
.RE
.PP
\fI/etc/dracut\&.conf\&.d/\fR
.RS 4
Any
\fI/etc/dracut\&.conf\&.d/*\&.conf\fR
file can override the values in
\fI/etc/dracut\&.conf\fR\&. The configuration files are read in alphanumerical order\&.
.RE
.SH "AUTHOR"
.sp
Harald Hoyer
.SH "SEE ALSO"
.sp
\fBdracut\fR(8) \fBdracut\&.cmdline\fR(7)

View File

@ -0,0 +1,237 @@
DRACUT.CONF(5)
==============
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
dracut.conf - configuration file(s) for dracut
SYNOPSIS
--------
_/etc/dracut.conf_
_/etc/dracut.conf.d/\*.conf_
_/usr/lib/dracut/dracut.conf.d/*.conf_
Description
-----------
_dracut.conf_ is loaded during the initialisation phase of dracut. Command line
parameter will override any values set here.
_*.conf_ files are read from /usr/lib/dracut/dracut.conf.d and
/etc/dracut.conf.d. Files with the same name in /etc/dracut.conf.d will replace
files in /usr/lib/dracut/dracut.conf.d.
The files are then read in alphanumerical order and will override parameters
set in _/etc/dracut.conf_. Each line specifies an attribute and a value. A '#'
indicates the beginning of a comment; following characters, up to the end of the
line are not interpreted.
dracut command line options will override any values set here.
Configuration files must have the extension .conf; other extensions are ignored.
*add_dracutmodules+=*" __<dracut modules>__ "::
Add a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
*dracutmodules+=*" __<dracut modules>__ "::
Specify a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
This option forces dracut to only include the specified dracut modules.
In most cases the "add_dracutmodules" option is what you want to use.
*omit_dracutmodules+=*" __<dracut modules>__ "::
Omit a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
*drivers+=*" __<kernel modules>__ "::
Specify a space-separated list of kernel modules to exclusively include in
the initramfs. The kernel modules have to be specified without the ".ko"
suffix.
*add_drivers+=*" __<kernel modules>__ "::
Specify a space-separated list of kernel modules to add to the initramfs.
The kernel modules have to be specified without the ".ko" suffix.
*force_drivers+=*" __<list of kernel modules>__ "::
See add_drivers above. But in this case it is ensured that the drivers
are tried to be loaded early via modprobe.
*omit_drivers+=*" __<kernel modules>__ "::
Specify a space-separated list of kernel modules not to add to the
initramfs. The kernel modules have to be specified without the ".ko" suffix.
*filesystems+=*" __<filesystem names>__ "::
Specify a space-separated list of kernel filesystem modules to exclusively
include in the generic initramfs.
*drivers_dir=*"__<kernel modules directory>__"::
Specify the directory, where to look for kernel modules
*fw_dir+=*" :__<dir>__[:__<dir>__ ...] "::
Specify additional directories, where to look for firmwares, separated by :
*install_items+=*" __<file>__[ __<file>__ ...] "::
Specify additional files to include in the initramfs, separated by spaces.
*install_optional_items+=*" __<file>__[ __<file>__ ...] "::
Specify additional files to include in the initramfs, separated by spaces,
if they exist.
*compress=*"__{cat|bzip2|lzma|xz|gzip|lzo|lz4|zstd|<compressor [args ...]>}__"::
Compress the generated initramfs using the passed compression program. If
you pass it just the name of a compression program, it will call that
program with known-working arguments. If you pass arguments, it will be called
with exactly those arguments. Depending on what you pass, this may result in
an initramfs that the kernel cannot decompress.
To disable compression, use "cat".
*do_strip=*"__{yes|no}__"::
Strip binaries in the initramfs (default=yes)
*hostonly=*"__{yes|no}__"::
Host-Only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration.
*hostonly_cmdline=*"__{yes|no}__"::
If set to "yes", store the kernel command line arguments needed in the initramfs
*persistent_policy=*"__<policy>__"::
Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label"
*tmpdir=*"__<temporary directory>__"::
Specify temporary directory to use.
[WARNING]
====
If chrooted to another root other than the real root device, use --fstab and
provide a valid _/etc/fstab_.
====
*use_fstab=*"__{yes|no}__"::
Use _/etc/fstab_ instead of _/proc/self/mountinfo_.
*add_fstab+=*" __<filename>__ "::
Add entries of __<filename>__ to the initramfs /etc/fstab.
*add_device+=*" __<device>__ "::
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
This can be useful in hostonly mode for resume support when your swap is on
LVM an encrypted partition.
*mdadmconf=*"__{yes|no}__"::
Include local _/etc/mdadm.conf_ (default=yes)
*lvmconf=*"__{yes|no}__"::
Include local _/etc/lvm/lvm.conf_ (default=yes)
*fscks=*" __<fsck tools>__ "::
Add a space-separated list of fsck tools. If nothing is specified, the
default is: "umount mount /sbin/fsck* xfs_db xfs_check xfs_repair e2fsck
jfs_fsck reiserfsck btrfsck". The installation is opportunistic
(non-existing tools are ignored).
*nofscks=*"__{yes|no}__"::
If specified, inhibit installation of any fsck tools.
*ro_mnt=*"__{yes|no}__"::
Mount _/_ and _/usr_ read-only by default.
*kernel_cmdline=*"__parameters__"::
Specify default kernel command line parameters
*kernel_only=*"__{yes|no}__"::
Only install kernel drivers and firmware files. (default=no)
*no_kernel=*"__{yes|no}__"::
Do not install kernel drivers and firmware files (default=no)
*acpi_override=*"__{yes|no}__"::
[WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING! +
Override BIOS provided ACPI tables. For further documentation read
Documentation/acpi/initrd_table_override.txt in the kernel sources.
Search for ACPI table files (must have .aml suffix) in acpi_table_dir=
directory (see below) and add them to a separate uncompressed cpio
archive. This cpio archive gets glued (concatenated, uncompressed one
must be the first one) to the compressed cpio archive. The first,
uncompressed cpio archive is for data which the kernel must be able
to access very early (and cannot make use of uncompress algorithms yet)
like microcode or ACPI tables (default=no).
*acpi_table_dir=*"__<dir>__"::
Directory to search for ACPI tables if acpi_override= is set to yes.
*early_microcode=*"{yes|no}"::
Combine early microcode with ramdisk (default=yes)
*stdloglvl*="__\{0-6\}__"::
Set logging to standard error level.
*sysloglvl*="__\{0-6\}__"::
Set logging to syslog level.
*fileloglvl=*"__\{0-6\}__"::
Set logging to file level.
*logfile=*"__<file>__"::
Path to log file.
*show_modules=*"__{yes|no}__"::
Print the name of the included modules to standard output during build.
*i18n_vars=*"__<variable mapping>__"::
Distribution specific variable mapping.
See dracut/modules.d/10i18n/README for a detailed description.
*i18n_default_font=*"__<fontname>__"::
The font <fontname> to install, if not specified otherwise.
Default is "eurlatgr".
*i18n_install_all=*"__{yes|no}__"::
Install everything regardless of generic or hostonly mode.
*reproducible=*"__{yes|no}__"::
Create reproducible images.
*loginstall=*"__<DIR>__"::
Log all files installed from the host to _<DIR>_.
*uefi_stub=*"_<FILE>_"::
Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
kernel command line and boots the kernel. The default is
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
*uefi_splash_image=*"_<FILE>_"::
Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image format.
*uefi_secureboot_cert=*"_<FILE>_", *uefi_secureboot_key=*"_<FILE>_"::
Specifies a certificate and corresponding key, which are used to sign the created UEFI executable.
Requires both certificate and key need to be specified and _sbsign_ to be installed.
*kernel_image=*"_<FILE>_"::
Specifies the kernel image, which to include in the UEFI executable. The default is
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
Files
-----
_/etc/dracut.conf_::
Old configuration file. You better use your own file in
_/etc/dracut.conf.d/_.
_/etc/dracut.conf.d/_::
Any _/etc/dracut.conf.d/*.conf_ file can override the values in
_/etc/dracut.conf_. The configuration files are read in alphanumerical
order.
AUTHOR
------
Harald Hoyer
See Also
--------
*dracut*(8) *dracut.cmdline*(7)

View File

@ -0,0 +1,329 @@
'\" t
.\" Title: dracut.modules
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 05/17/2021
.\" Manual: dracut
.\" Source: dracut 054-2-gb9b6f0ee
.\" Language: English
.\"
.TH "DRACUT\&.MODULES" "7" "05/17/2021" "dracut 054\-2\-gb9b6f0ee" "dracut"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
dracut.modules \- dracut modules
.SH "DESCRIPTION"
.sp
dracut uses a modular system to build and extend the initramfs image\&. All modules are located in \fI/usr/lib/dracut/modules\&.d\fR or in \fI<git\-src>/modules\&.d\fR\&. The most basic dracut module is \fI99base\fR\&. In \fI99base\fR the initial shell script init is defined, which gets run by the kernel after initramfs loading\&. Although you can replace init with your own version of \fI99base\fR, this is not encouraged\&. Instead you should use, if possible, the hooks of dracut\&. All hooks, and the point of time in which they are executed, are described in the section called \(lqBOOT PROCESS STAGES\(rq\&.
.sp
The main script, which creates the initramfs is dracut itself\&. It parses all arguments and sets up the directory, in which everything is installed\&. It then executes all check, install, installkernel scripts found in the modules, which are to be processed\&. After everything is installed, the install directory is archived and compressed to the final initramfs image\&. All helper functions used by check, install and installkernel are found in in the file \fIdracut\-functions\fR\&. These shell functions are available to all module installer (install, installkernel) scripts, without the need to source \fIdracut\-functions\fR\&.
.sp
A module can check the preconditions for install and installkernel with the check script\&. Also dependencies can be expressed with check\&. If a module passed check, install and installkernel will be called to install all of the necessary files for the module\&. To split between kernel and non\-kernel parts of the installation, all kernel module related parts have to be in installkernel\&. All other files found in a module directory are module specific and mostly are hook scripts and udev rules\&.
.SH "BOOT PROCESS STAGES"
.sp
dracut modules can insert custom script at various points, to control the boot process\&. These hooks are plain directories containing shell scripts ending with "\&.sh", which are sourced by init\&. Common used functions are in \fIdracut\-lib\&.sh\fR, which can be sourced by any script\&.
.SS "Hook: cmdline"
.sp
The \fIcmdline\fR hook is a place to insert scripts to parse the kernel command line and prepare the later actions, like setting up udev rules and configuration files\&.
.sp
In this hook the most important environment variable is defined: root\&. The second one is rootok, which indicates, that a module claimed to be able to parse the root defined\&. So for example, \fBroot=\fR\fIiscsi:\&...\&.\fR will be claimed by the iscsi dracut module, which then sets rootok\&.
.SS "Hook: pre\-udev"
.sp
This hook is executed right after the cmdline hook and a check if root and rootok were set\&. Here modules can take action with the final root, and before udev has been run\&.
.SS "Start Udev"
.sp
Now udev is started and the logging for udev is setup\&.
.SS "Hook: pre\-trigger"
.sp
In this hook, you can set udev environment variables with \fBudevadm control \-\-property=KEY=\fR\fB\fIvalue\fR\fR or control the further execution of udev with udevadm\&.
.SS "Trigger Udev"
.sp
udev is triggered by calling udevadm trigger, which sends add events for all devices and subsystems\&.
.SS "Main Loop"
.sp
In the main loop of dracut loops until udev has settled and all scripts in \fIinitqueue/finished\fR returned true\&. In this loop there are three hooks, where scripts can be inserted by calling /sbin/initqueue\&.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBInitqueue\fR
.RS 4
.sp
This hook gets executed every time a script is inserted here, regardless of the udev state\&.
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBInitqueue settled\fR
.RS 4
.sp
This hook (initqueue/settled) gets executed every time udev has settled\&.
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBInitqueue timeout\fR
.RS 4
.sp
This hook (initqueue/timeout) gets executed, when the main loop counter becomes half of the rd\&.retry counter\&.
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBInitqueue online\fR
.RS 4
.sp
This hook (initqueue/online) gets executed whenever a network interface comes online (that is, once it is up and configured by the configured network module)\&.
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBInitqueue finished\fR
.RS 4
.sp
This hook (initqueue/finished) is called after udev has settled and if all scripts herein return 0 the main loop will be ended\&. Arbitrary scripts can be added here, to loop in the initqueue until something happens, which a dracut module wants to wait for\&.
.RE
.SS "Hook: pre\-mount"
.sp
Before the root device is mounted all scripts in the hook pre\-mount are executed\&. In some cases (e\&.g\&. NFS) the real root device is already mounted, though\&.
.SS "Hook: mount"
.sp
This hook is mainly to mount the real root device\&.
.SS "Hook: pre\-pivot"
.sp
This hook is called before cleanup hook, This is a good place for actions other than cleanups which need to be called before pivot\&.
.SS "Hook: cleanup"
.sp
This hook is the last hook and is called before init finally switches root to the real root device\&. This is a good place to clean up and kill processes not needed anymore\&.
.SS "Cleanup and switch_root"
.sp
Init (or systemd) kills all udev processes, cleans up the environment, sets up the arguments for the real init process and finally calls switch_root\&. switch_root removes the whole filesystem hierarchy of the initramfs, chroot()s to the real root device and calls /sbin/init with the specified arguments\&.
.sp
To ensure all files in the initramfs hierarchy can be removed, all processes still running from the initramfs should not have any open file descriptors left\&.
.SH "NETWORK INFRASTRUCTURE"
.sp
FIXME
.SH "WRITING A MODULE"
.sp
A simple example module is \fI90kernel\-modules\fR, which modprobes a kernel module after udev has settled and the basic device drivers have been loaded\&.
.sp
All module installation information is in the file module\-setup\&.sh\&.
.sp
First we create a check() function, which just exits with 0 indicating that this module should be included by default\&.
.sp
check():
.sp
.if n \{\
.RS 4
.\}
.nf
return 0
.fi
.if n \{\
.RE
.\}
.sp
Then we create the install() function, which installs a cmdline hook with priority number 20 called \fIparse\-insmodpost\&.sh\fR\&. It also installs the \fIinsmodpost\&.sh\fR script in \fI/sbin\fR\&.
.sp
install():
.sp
.if n \{\
.RS 4
.\}
.nf
inst_hook cmdline 20 "$moddir/parse\-insmodpost\&.sh"
inst_simple "$moddir/insmodpost\&.sh" /sbin/insmodpost\&.sh
.fi
.if n \{\
.RE
.\}
.sp
The \fIparse\-instmodpost\&.sh\fR parses the kernel command line for a argument rd\&.driver\&.post, blacklists the module from being autoloaded and installs the hook \fIinsmodpost\&.sh\fR in the \fIinitqueue/settled\fR\&.
.sp
\fIparse\-insmodpost\&.sh\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
for p in $(getargs rd\&.driver\&.post=); do
echo "blacklist $p" >> /etc/modprobe\&.d/initramfsblacklist\&.conf
_do_insmodpost=1
done
[ \-n "$_do_insmodpost" ] && /sbin/initqueue \-\-settled \-\-unique \-\-onetime /sbin/insmodpost\&.sh
unset _do_insmodpost
.fi
.if n \{\
.RE
.\}
.sp
\fIinsmodpost\&.sh\fR, which is called in the \fIinitqueue/settled\fR hook will just modprobe the kernel modules specified in all rd\&.driver\&.post kernel command line parameters\&. It runs after udev has settled and is only called once (\-\-onetime)\&.
.sp
\fIinsmodpost\&.sh\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
\&. /lib/dracut\-lib\&.sh
for p in $(getargs rd\&.driver\&.post=); do
modprobe $p
done
.fi
.if n \{\
.RE
.\}
.SS "module\-setup\&.sh: check()"
.sp
\fIcheck()\fR is called by dracut to evaluate the inclusion of a dracut module in the initramfs\&.
.PP
$hostonly
.RS 4
If the $hostonly variable is set, then the module check() function should be in "hostonly" mode, which means, that the check() should only return 0, if the module is really needed to boot this specific host\&.
.RE
.sp
check() should return with:
.PP
0
.RS 4
Include the dracut module in the initramfs\&.
.RE
.PP
1
.RS 4
Do not include the dracut module\&. The requirements are not fulfilled (missing tools, etc\&.)
.RE
.PP
255
.RS 4
Only include the dracut module, if another module requires it or if explicitly specified in the config file or on the argument list\&.
.RE
.SS "module\-setup\&.sh: depends()"
.sp
The function depends() should echo all other dracut module names the module depends on\&.
.SS "module\-setup\&.sh: cmdline()"
.sp
This function should print the kernel command line options needed to boot the current machine setup\&. It should start with a space and should not print a newline\&.
.SS "module\-setup\&.sh: install()"
.sp
The install() function is called to install everything non\-kernel related\&. To install binaries, scripts, and other files, you can use the functions mentioned in [creation]\&.
.sp
To address a file in the current module directory, use the variable "$moddir"\&.
.SS "module\-setup\&.sh: installkernel()"
.sp
In installkernel() all kernel related files should be installed\&. You can use all of the functions mentioned in [creation] to install files\&.
.SS "Creation Functions"
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBinst_multiple [-o] <file> [ <file> \&...]\fR
.RS 4
.sp
installs multiple binaries and files\&. If executables are specified without a path, dracut will search the path PATH=/usr/sbin:/sbin:/usr/bin:/bin for the binary\&. If the option "\-o" is given as the first parameter, a missing file does not lead to an error\&.
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBinst <src> [<dst>]\fR
.RS 4
.sp
installs \fIone\fR file <src> either to the same place in the initramfs or to an optional <dst>\&. inst with more than two arguments is treated the same as inst_multiple, all arguments are treated as files to install and none as install destinations\&.
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBinst_hook <hookdir> <prio> <src>\fR
.RS 4
.sp
installs an executable/script <src> in the dracut hook <hookdir> with priority <prio>\&.
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBinst_rules <udevrule> [ <udevrule> \&...]\fR
.RS 4
.sp
installs one or more udev rules\&. Non\-existant udev rules are reported, but do not let dracut fail\&.
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBinstmods <kernelmodule> [ <kernelmodule> \&... ]\fR
.RS 4
.sp
instmods should be used only in the installkernel() function\&.
.sp
instmods installs one or more kernel modules in the initramfs\&. <kernelmodule> can also be a whole subsystem, if prefixed with a "=", like "=drivers/net/team"\&.
.sp
instmods will not install the kernel module, if $hostonly is set and the kernel module is not currently needed by any /sys/\fB\&...\fR/uevent MODALIAS\&. To install a kernel module regardless of the hostonly mode use the form:
.sp
.if n \{\
.RS 4
.\}
.nf
hostonly=\*(Aq\*(Aq instmods <kernelmodule>
.fi
.if n \{\
.RE
.\}
.RE
.SS "Initramfs Functions"
.sp
FIXME
.SS "Network Modules"
.sp
FIXME
.SH "AUTHOR"
.sp
Harald Hoyer
.SH "SEE ALSO"
.sp
\fBdracut\fR(8)

View File

@ -0,0 +1,307 @@
DRACUT.MODULES(7)
=================
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
dracut.modules - dracut modules
DESCRIPTION
-----------
dracut uses a modular system to build and extend the initramfs image. All
modules are located in _/usr/lib/dracut/modules.d_ or in _<git-src>/modules.d_.
The most basic dracut module is _99base_. In _99base_ the initial shell script
init is defined, which gets run by the kernel after initramfs loading. Although
you can replace init with your own version of _99base_, this is not encouraged.
Instead you should use, if possible, the hooks of dracut. All hooks, and the
point of time in which they are executed, are described in <<stages>>.
The main script, which creates the initramfs is dracut itself. It parses all
arguments and sets up the directory, in which everything is installed. It then
executes all check, install, installkernel scripts found in the modules, which
are to be processed. After everything is installed, the install directory is
archived and compressed to the final initramfs image. All helper functions used
by check, install and installkernel are found in in the file _dracut-functions_.
These shell functions are available to all module installer (install,
installkernel) scripts, without the need to source _dracut-functions_.
A module can check the preconditions for install and installkernel with the
check script. Also dependencies can be expressed with check. If a module passed
check, install and installkernel will be called to install all of the necessary
files for the module. To split between kernel and non-kernel parts of the
installation, all kernel module related parts have to be in installkernel. All
other files found in a module directory are module specific and mostly are hook
scripts and udev rules.
[[stages]]
== Boot Process Stages
dracut modules can insert custom script at various points, to control the boot
process.
These hooks are plain directories containing shell scripts ending with ".sh",
which are sourced by init.
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
=== Hook: cmdline
The _cmdline_ hook is a place to insert scripts to parse the kernel command line
and prepare the later actions, like setting up udev rules and configuration
files.
In this hook the most important environment variable is defined: root. The
second one is rootok, which indicates, that a module claimed to be able to parse
the root defined. So for example, **root=**__iscsi:....__ will be claimed by the
iscsi dracut module, which then sets rootok.
=== Hook: pre-udev
This hook is executed right after the cmdline hook and a check if root and
rootok were set. Here modules can take action with the final root, and before
udev has been run.
=== Start Udev
Now udev is started and the logging for udev is setup.
=== Hook: pre-trigger
In this hook, you can set udev environment variables with **udevadm control
--property=KEY=_value_** or control the further execution of udev with
udevadm.
=== Trigger Udev
udev is triggered by calling udevadm trigger, which sends add events for all
devices and subsystems.
=== Main Loop
In the main loop of dracut loops until udev has settled and
all scripts in _initqueue/finished_ returned true.
In this loop there are three hooks, where scripts can be inserted
by calling /sbin/initqueue.
==== Initqueue
This hook gets executed every time a script is inserted here, regardless of the
udev state.
==== Initqueue settled
This hook (initqueue/settled) gets executed every time udev has settled.
==== Initqueue timeout
This hook (initqueue/timeout) gets executed, when the main loop counter becomes
half of the rd.retry counter.
==== Initqueue online
This hook (initqueue/online) gets executed whenever a network interface comes online
(that is, once it is up and configured by the configured network module).
==== Initqueue finished
This hook (initqueue/finished) is called after udev has settled and
if all scripts herein return 0 the main loop will be ended.
Arbitrary scripts can be added here, to loop in the
initqueue until something happens, which a dracut module wants to wait for.
=== Hook: pre-mount
Before the root device is mounted all scripts in the hook pre-mount are
executed. In some cases (e.g. NFS) the real root device is already mounted,
though.
=== Hook: mount
This hook is mainly to mount the real root device.
=== Hook: pre-pivot
This hook is called before cleanup hook, This is a good place for
actions other than cleanups which need to be called before pivot.
=== Hook: cleanup
This hook is the last hook and is called before init finally switches root to
the real root device. This is a good place to clean up and kill processes not
needed anymore.
=== Cleanup and switch_root
Init (or systemd) kills all udev processes, cleans up the environment,
sets up the arguments for the real init process and finally calls switch_root.
switch_root removes the whole filesystem hierarchy of the initramfs,
chroot()s to the real root device and calls /sbin/init with the specified
arguments.
To ensure all files in the initramfs hierarchy can be removed, all processes
still running from the initramfs should not have any open file descriptors left.
== Network Infrastructure
FIXME
== Writing a Module
A simple example module is _90kernel-modules_, which modprobes a kernel module
after udev has settled and the basic device drivers have been loaded.
All module installation information is in the file module-setup.sh.
First we create a check() function, which just exits with 0 indicating that this
module should be included by default.
check():
----
return 0
----
Then we create the install() function, which installs a cmdline hook with
priority number 20 called _parse-insmodpost.sh_. It also installs the
_insmodpost.sh_ script in _/sbin_.
install():
----
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
----
The _parse-instmodpost.sh_ parses the kernel command line for a argument
rd.driver.post, blacklists the module from being autoloaded and installs the
hook _insmodpost.sh_ in the _initqueue/settled_.
_parse-insmodpost.sh_:
----
for p in $(getargs rd.driver.post=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
_do_insmodpost=1
done
[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
unset _do_insmodpost
----
_insmodpost.sh_, which is called in the _initqueue/settled_ hook will just
modprobe the kernel modules specified in all rd.driver.post kernel command line
parameters. It runs after udev has settled and is only called once (--onetime).
_insmodpost.sh_:
----
. /lib/dracut-lib.sh
for p in $(getargs rd.driver.post=); do
modprobe $p
done
----
=== module-setup.sh: check()
_check()_ is called by dracut to evaluate the inclusion of a dracut module in
the initramfs.
$hostonly:: If the $hostonly variable is set, then the module check() function
should be in "hostonly" mode, which means, that the check() should only return
0, if the module is really needed to boot this specific host.
check() should return with:
0:: Include the dracut module in the initramfs.
1:: Do not include the dracut module. The requirements are not fulfilled
(missing tools, etc.)
255:: Only include the dracut module, if another module requires it or if
explicitly specified in the config file or on the argument list.
=== module-setup.sh: depends()
The function depends() should echo all other dracut module names the module
depends on.
=== module-setup.sh: cmdline()
This function should print the kernel command line options needed to boot the
current machine setup. It should start with a space and should not print a
newline.
=== module-setup.sh: install()
The install() function is called to install everything non-kernel related.
To install binaries, scripts, and other files, you can use the functions
mentioned in <<creation>>.
To address a file in the current module directory, use the variable "$moddir".
=== module-setup.sh: installkernel()
In installkernel() all kernel related files should be installed. You can use all
of the functions mentioned in <<creation>> to install files.
=== [[creation]]Creation Functions
==== inst_multiple [-o] <file> [ <file> ...]
installs multiple binaries and files. If executables are specified without a
path, dracut will search the path PATH=/usr/sbin:/sbin:/usr/bin:/bin for the
binary. If the option "-o" is given as the first parameter, a missing file does
not lead to an error.
==== inst <src> [<dst>]
installs _one_ file <src> either to the same place in the initramfs or to an
optional <dst>. inst with more than two arguments is treated the same as
inst_multiple, all arguments are treated as files to install and none as
install destinations.
==== inst_hook <hookdir> <prio> <src>
installs an executable/script <src> in the dracut hook <hookdir> with priority
<prio>.
==== inst_rules <udevrule> [ <udevrule> ...]
installs one or more udev rules. Non-existant udev rules are reported, but do
not let dracut fail.
==== instmods <kernelmodule> [ <kernelmodule> ... ]
instmods should be used only in the installkernel() function.
instmods installs one or more kernel modules in the initramfs. <kernelmodule>
can also be a whole subsystem, if prefixed with a "=", like "=drivers/net/team".
instmods will not install the kernel module, if $hostonly is set and the kernel
module is not currently needed by any /sys/*...*/uevent MODALIAS.
To install a kernel module regardless of the hostonly mode use the form:
----
hostonly='' instmods <kernelmodule>
----
=== Initramfs Functions
FIXME
=== Network Modules
FIXME
AUTHOR
------
Harald Hoyer
SEE ALSO
--------
*dracut*(8)

View File

@ -0,0 +1,518 @@
To create a initramfs image, the most simple command is:
----
# dracut
----
This will generate a general purpose initramfs image, with all possible
functionality resulting of the combination of the installed dracut modules and
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
contains the kernel modules of the currently active kernel with version
_++<kernel version>++_.
If the initramfs image already exists, dracut will display an error message, and
to overwrite the existing image, you have to use the --force option.
----
# dracut --force
----
If you want to specify another filename for the resulting image you would issue
a command like:
----
# dracut foobar.img
----
To generate an image for a specific kernel version, the command would be:
----
# dracut foobar.img 2.6.40-1.rc5.f20
----
A shortcut to generate the image at the default location for a specific kernel
version is:
----
# dracut --kver 2.6.40-1.rc5.f20
----
If you want to create lighter, smaller initramfs images, you may want to specify
the --hostonly or -H option. Using this option, the resulting image will
contain only those dracut modules, kernel modules and filesystems, which are
needed to boot this specific machine. This has the drawback, that you can't put
the disk on another controller or machine, and that you can't switch to another
root filesystem, without recreating the initramfs image. The usage of the
--hostonly option is only for experts and you will have to keep the broken
pieces. At least keep a copy of a general purpose image (and corresponding
kernel) as a fallback to rescue your system.
=== Inspecting the Contents
To see the contents of the image created by dracut, you can use the lsinitrd
tool.
----
# lsinitrd | less
----
To display the contents of a file in the initramfs also use the lsinitrd tool:
----
# lsinitrd -f /etc/ld.so.conf
include ld.so.conf.d/*.conf
----
=== Adding dracut Modules
Some dracut modules are turned off by default and have to be activated manually.
You can do this by adding the dracut modules to the configuration file
_/etc/dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_. See *dracut.conf*(5).
You can also add dracut modules on the command line
by using the -a or --add option:
----
# dracut --add module initramfs-module.img
----
To see a list of available dracut modules, use the --list-modules option:
----
# dracut --list-modules
----
=== Omitting dracut Modules
Sometimes you don't want a dracut module to be included for reasons of speed,
size or functionality. To do this, either specify the omit_dracutmodules
variable in the _dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_ configuration
file (see *dracut.conf*(5)), or use the -o or --omit option
on the command line:
----
# dracut -o "multipath lvm" no-multipath-lvm.img
----
=== Adding Kernel Modules
If you need a special kernel module in the initramfs, which is not
automatically picked up by dracut, you have the use the --add-drivers option
on the command line or the drivers variable in the _/etc/dracut.conf_
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see *dracut.conf*(5)):
----
# dracut --add-drivers mymod initramfs-with-mymod.img
----
=== Boot parameters
An initramfs generated without the "hostonly" mode, does not contain any system
configuration files (except for some special exceptions), so the configuration
has to be done on the kernel command line. With this flexibility, you can easily
boot from a changed root partition, without the need to recompile the initramfs
image. So, you could completely change your root partition (move it inside a md
raid with encryption and LVM on top), as long as you specify the correct
filesystem LABEL or UUID on the kernel command line for your root device, dracut
will find it and boot from it.
The kernel command line can also be provided by the dhcp server with the
root-path option. See <<NetworkBoot>>.
For a full reference of all kernel command line parameters,
see *dracut.cmdline*(5).
To get a quick start for the suitable kernel command line on your system,
use the __--print-cmdline__ option:
----
# dracut --print-cmdline
root=UUID=8b8b6f91-95c7-4da2-831b-171e12179081 rootflags=rw,relatime,discard,data=ordered rootfstype=ext4
----
==== Specifying the root Device
This is the only option dracut really needs to boot from your root partition.
Because your root partition can live in various environments, there are a lot of
formats for the root= option. The most basic one is root=_++<path to device
node>++_:
----
root=/dev/sda2
----
Because device node names can change, dependent on the drive ordering, you are
encouraged to use the filesystem identifier (UUID) or filesystem label (LABEL)
to specify your root partition:
----
root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331
----
or
----
root=LABEL=myrootpartitionlabel
----
To see all UUIDs or LABELs on your system, do:
----
# ls -l /dev/disk/by-uuid
----
or
----
# ls -l /dev/disk/by-label
----
If your root partition is on the network see <<NetworkBoot>>.
==== Keyboard Settings
If you have to input passwords for encrypted disk volumes, you might want to set
the keyboard layout and specify a display font.
A typical german kernel command line would contain:
----
rd.vconsole.font=eurlatgr rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
----
Setting these options can override the setting stored on your system, if you use
a modern init system, like systemd.
==== Blacklisting Kernel Modules
Sometimes it is required to prevent the automatic kernel module loading of a
specific kernel module. To do this, just add rd.blacklist=_++<kernel module
name>++_, with _++<kernel module name>++_ not containing the _.ko_
suffix, to the kernel command line. For example:
----
rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau
----
The option can be specified multiple times on the kernel command line.
==== Speeding up the Boot Process
If you want to speed up the boot process, you can specify as much information
for dracut on the kernel command as possible. For example, you can tell dracut,
that you root partition is not on a LVM volume or not on a raid partition, or
that it lives inside a specific crypto LUKS encrypted volume. By default, dracut
searches everywhere. A typical dracut kernel command line for a plain primary or
logical partition would contain:
----
rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
----
This turns off every automatic assembly of LVM, MD raids, DM raids and
crypto LUKS.
Of course, you could also omit the dracut modules in the initramfs creation
process, but then you would lose the possibility to turn it on on demand.
[[Injecting]]
=== Injecting custom Files
To add your own files to the initramfs image, you have several possibilities.
The --include option let you specify a source path and a target path.
For example
----
# dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img
----
will create an initramfs image, where the file cmdline-preset will be copied
inside the initramfs to _/etc/cmdline.d/mycmdline.conf_. --include can only
be specified once.
----
# mkdir -p rd.live.overlay/etc/cmdline.d
# mkdir -p rd.live.overlay/etc/conf.d
# echo "ip=dhcp" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
# tree rd.live.overlay/
rd.live.overlay/
`-- etc
|-- cmdline.d
| `-- mycmdline.conf
`-- conf.d
`-- testvar.conf
# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
----
This will put the contents of the rd.live.overlay directory into the root of the
initramfs image.
The --install option let you specify several files, which will get installed in
the initramfs image at the same location, as they are present on initramfs
creation time.
----
# dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img
----
This will create an initramfs with the strace, fsck.ext3 and ssh executables,
together with the libraries needed to start those. The --install option can be
specified multiple times.
[[NetworkBoot]]
=== Network Boot
If your root partition is on a network drive, you have to have the network
dracut modules installed to create a network aware initramfs image.
If you specify ip=dhcp on the kernel command line, then dracut asks a dhcp
server about the ip address for the machine. The dhcp server can also serve an
additional root-path, which will set the root device for dracut. With this
mechanism, you have static configuration on your client machine and a
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
kernel command line, then you can inject _/etc/cmdline.d/mycmdline.conf_, with a
method described in <<Injecting>>.
==== Reducing the Image Size
To reduce the size of the initramfs, you should create it with by omitting all
dracut modules, which you know, you don't need to boot the machine.
You can also specify the exact dracut and kernel modules to produce a very tiny
initramfs image.
For example for a NFS image, you would do:
----
# dracut -m "nfs network base" initramfs-nfs-only.img
----
Then you would boot from this image with your target machine and reduce the size
once more by creating it on the target machine with the --host-only option:
----
# dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img
----
This will reduce the size of the initramfs image significantly.
== Troubleshooting
If the boot process does not succeed, you have several options to debug the
situation. Some of the basic operations are covered here. For more information
you should also visit:
https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
[[identifying-your-problem-area]]
=== Identifying your problem area
. Remove ''rhgb'' and ''quiet'' from the kernel command line
. Add ''rd.shell'' to the kernel command line. This will present a shell should
dracut be unable to locate your root device
. Add ''rd.shell rd.debug log_buf_len=1M'' to the kernel command line so that
dracut shell commands are printed as they are executed
. The file /run/initramfs/rdsosreport.txt is generated,
which contains all the logs and the output of all significant tools, which are
mentioned later.
If you want to save that output, simply mount /boot by hand or insert an USB
stick and mount that. Then you can store the output for later inspection.
[[information-to-include-in-your-report]]
=== Information to include in your report
[[all-bug-reports]]
==== All bug reports
In all cases, the following should be mentioned and attached to your bug report:
* The exact kernel command-line used. Typically from the bootloader
configuration file (e.g. _/boot/grub2/grub.cfg_) or from _/proc/cmdline_.
* A copy of your disk partition information from _/etc/fstab_, which might be
obtained booting an old working initramfs or a rescue medium.
* Turn on dracut debugging (see _the 'debugging dracut' section_), and attach
the file /run/initramfs/rdsosreport.txt.
* If you use a dracut configuration file, please include _/etc/dracut.conf_ and
all files in _/etc/dracut.conf.d/*.conf_
[[network-root-device-related-problems]]
==== Network root device related problems
This section details information to include when experiencing problems on a
system whose root device is located on a network attached volume (e.g. iSCSI,
NFS or NBD). As well as the information from <<all-bug-reports>>, include the
following information:
* Please include the output of
+
----
# /sbin/ifup <interfacename>
# ip addr show
----
[[debugging-dracut]]
=== Debugging dracut
[[configure-a-serial-console]]
==== Configure a serial console
Successfully debugging dracut will require some form of console
logging during the system boot. This section documents configuring a
serial console connection to record boot messages.
. First, enable serial console output for both the kernel and the bootloader.
. Open the file _/boot/grub2/grub.cfg_ for editing. Below the line ''timeout=5'', add
the following:
+
----
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
----
+
. Also in _/boot/grub2/grub.cfg_, add the following boot arguments to the ''kernel''
line:
+
----
console=tty0 console=ttyS0,9600
----
+
. When finished, the _/boot/grub2/grub.cfg_ file should look similar to the example
below.
+
----
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
----
+
. More detailed information on how to configure the kernel for console output
can be found at
http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL.
. Redirecting non-interactive output
+
--
NOTE: You can redirect all non-interactive output to _/dev/kmsg_ and the kernel
will put it out on the console when it reaches the kernel buffer by doing
----
# exec >/dev/kmsg 2>&1 </dev/console
----
--
[[using-the-dracut-shell]]
==== Using the dracut shell
dracut offers a shell for interactive debugging in the event dracut fails to
locate your root filesystem. To enable the shell:
. Add the boot parameter ''rd.shell'' to your bootloader configuration file
(e.g. _/boot/grub2/grub.cfg_)
. Remove the boot arguments ''rhgb'' and ''quiet''
+
A sample _/boot/grub2/grub.cfg_ bootloader configuration file is listed below.
+
----
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
----
+
. If system boot fails, you will be dropped into a shell as seen in the example
below.
+
----
No root device found
Dropping to debug shell.
#
----
+
. Use this shell prompt to gather the information requested above
(see <<all-bug-reports>>).
[[accessing-the-root-volume-from-the-dracut-shell]]
==== Accessing the root volume from the dracut shell
From the dracut debug shell, you can manually perform the task of locating and
preparing your root volume for boot. The required steps will depend on how your
root volume is configured. Common scenarios include:
* A block device (e.g. _/dev/sda7_)
* A LVM logical volume (e.g. _/dev/VolGroup00/LogVol00_)
* An encrypted device
(e.g. _/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83_)
* A network attached device
(e.g. _netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.example:for.all_)
The exact method for locating and preparing will vary. However, to continue with
a successful boot, the objective is to locate your root volume and create a
symlink _/dev/root_ which points to the file system. For example, the following
example demonstrates accessing and booting a root volume that is an encrypted
LVM Logical volume.
. Inspect your partitions using parted
+
----
# parted /dev/sda -s p
Model: ATA HTS541060G9AT00 (scsi)
Disk /dev/sda: 60.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 10.8GB 107MB primary ext4 boot
2 10.8GB 55.6GB 44.7GB logical lvm
----
+
. You recall that your root volume was a LVM logical volume. Scan and activate
any logical volumes.
+
----
# lvm vgscan
# lvm vgchange -ay
----
+
. You should see any logical volumes now using the command blkid:
+
----
# blkid
/dev/sda1: UUID="3de247f3-5de4-4a44-afc5-1fe179750cf7" TYPE="ext4"
/dev/sda2: UUID="Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I" TYPE="LVM2_member"
/dev/mapper/linux-root: UUID="def0269e-424b-4752-acf3-1077bf96ad2c" TYPE="crypto_LUKS"
/dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext3"
/dev/mapper/linux-swap: UUID="47b4d329-975c-4c08-b218-f9c9bf3635f1" TYPE="swap"
----
+
. From the output above, you recall that your root volume exists on an encrypted
block device. Following the guidance disk encryption guidance from the
Installation Guide, you unlock your encrypted root volume.
+
----
# UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
Enter passphrase for /dev/mapper/linux-root:
Key slot 0 unlocked.
----
+
. Next, make a symbolic link to the unlocked root volume
+
----
# ln -s /dev/mapper/luks-$UUID /dev/root
----
+
. With the root volume available, you may continue booting the system by exiting
the dracut shell
+
----
# exit
----
[[additional-dracut-boot-parameters]]
==== Additional dracut boot parameters
For more debugging options, see *dracut.cmdline*(7).
[[debugging-dracut-on-shutdown]]
==== Debugging dracut on shutdown
To debug the shutdown sequence on systemd systems, you can _rd.break_
on _pre-shutdown_ or _shutdown_.
To do this from an already booted system:
----
# mkdir -p /run/initramfs/etc/cmdline.d
# echo "rd.debug rd.break=pre-shutdown rd.break=shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
# touch /run/initramfs/.need_shutdown
----
This will give you a dracut shell after the system pivot'ed back in the
initramfs.

View File

@ -0,0 +1,93 @@
'\" t
.\" Title: lsinitrd
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 05/17/2021
.\" Manual: dracut
.\" Source: dracut 054-2-gb9b6f0ee
.\" Language: English
.\"
.TH "LSINITRD" "1" "05/17/2021" "dracut 054\-2\-gb9b6f0ee" "dracut"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
lsinitrd \- tool to show the contents of an initramfs image
.SH "SYNOPSIS"
.sp
\fBlsinitrd\fR [\fIOPTION\&...\fR] [<image> [<filename> [<filename> [\&...] ]]]
.sp
\fBlsinitrd\fR [\fIOPTION\&...\fR] \-k <kernel\-version>
.SH "DESCRIPTION"
.sp
lsinitrd shows the contents of an initramfs image\&. if <image> is omitted, then lsinitrd uses the default image \fI/boot/<machine\-id>/<kernel\-version>/initrd\fR or \fI/boot/initramfs\-<kernel\-version>\&.img\fR\&.
.SH "OPTIONS"
.PP
\fB\-h, \-\-help\fR
.RS 4
print a help message and exit\&.
.RE
.PP
\fB\-s, \-\-size\fR
.RS 4
sort the contents of the initramfs by size\&.
.RE
.PP
\fB\-f, \-\-file\fR\ \&\fI<filename>\fR
.RS 4
print the contents of <filename>\&.
.RE
.PP
\fB\-k, \-\-kver\fR\ \&\fI<kernel version>\fR
.RS 4
inspect the initramfs of <kernel version>\&.
.RE
.PP
\fB\-m, \-\-mod\fR
.RS 4
list dracut modules included of the initramfs image\&.
.RE
.PP
\fB\-\-unpack\fR
.RS 4
unpack the initramfs to the current directory, instead of displaying the contents\&. If optional filenames are given, will only unpack specified files, else the whole image will be unpacked\&. Won\(cqt unpack anything from early cpio part\&.
.RE
.PP
\fB\-\-unpackearly\fR
.RS 4
unpack the early microcode initramfs to the current directory, instead of displaying the contents\&. Same as \-\-unpack, but only unpack files from early cpio part\&.
.RE
.PP
\fB\-v, \-\-verbose\fR
.RS 4
unpack verbosely
.RE
.SH "AVAILABILITY"
.sp
The lsinitrd command is part of the dracut package and is available from \m[blue]\fBhttps://dracut\&.wiki\&.kernel\&.org\fR\m[]
.SH "AUTHORS"
.sp
Harald Hoyer
.sp
Amerigo Wang
.sp
Nikoli
.SH "SEE ALSO"
.sp
\fBdracut\fR(8)

View File

@ -0,0 +1,68 @@
LSINITRD(1)
=========
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
lsinitrd - tool to show the contents of an initramfs image
SYNOPSIS
--------
*lsinitrd* ['OPTION...'] [<image> [<filename> [<filename> [...] ]]]
*lsinitrd* ['OPTION...'] -k <kernel-version>
DESCRIPTION
-----------
lsinitrd shows the contents of an initramfs image. if <image> is omitted, then
lsinitrd uses the default image _/boot/<machine-id>/<kernel-version>/initrd_ or
_/boot/initramfs-<kernel-version>.img_.
OPTIONS
-------
**-h, --help**::
print a help message and exit.
**-s, --size**::
sort the contents of the initramfs by size.
**-f, --file** _<filename>_::
print the contents of <filename>.
**-k, --kver** _<kernel version>_::
inspect the initramfs of <kernel version>.
**-m, --mod**::
list dracut modules included of the initramfs image.
**--unpack**::
unpack the initramfs to the current directory, instead of displaying the contents.
If optional filenames are given, will only unpack specified files, else the whole image will be unpacked.
Won't unpack anything from early cpio part.
**--unpackearly**::
unpack the early microcode initramfs to the current directory, instead of displaying the contents.
Same as --unpack, but only unpack files from early cpio part.
**-v, --verbose**::
unpack verbosely
AVAILABILITY
------------
The lsinitrd command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
AUTHORS
-------
Harald Hoyer
Amerigo Wang
Nikoli
SEE ALSO
--------
*dracut*(8)

View File

@ -0,0 +1,32 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries bash || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst /bin/bash
# Prefer bash as default shell if no other shell is preferred.
[[ -L $initdir/bin/sh ]] || ln -sf bash "${initdir}/bin/sh"
}

View File

@ -0,0 +1,32 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries dash || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst /bin/dash
# Prefer dash as default shell if no other shell is preferred.
[[ -L $initdir/bin/sh ]] || ln -sf dash "${initdir}/bin/sh"
}

View File

@ -0,0 +1,32 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries mksh || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst /bin/mksh
# Prefer mksh as default shell if no other shell is preferred.
[[ -L $initdir/bin/sh ]] || ln -sf mksh "${initdir}/bin/sh"
}

View File

@ -0,0 +1,21 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo systemd systemd-hostnamed systemd-networkd systemd-resolved systemd-timedated systemd-timesyncd
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}

View File

@ -0,0 +1,254 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
[[ $mount_needs ]] && return 1
# If the binary(s) requirements are not fulfilled the module can't be installed
require_binaries "$systemdutildir"/systemd || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# called by dracut
depends() {
return 0
}
installkernel() {
hostonly='' instmods autofs4 ipv6 algif_hash hmac sha256
instmods -s efivarfs
}
# called by dracut
install() {
local _mods
if [[ $prefix == /run/* ]]; then
dfatal 'systemd does not work with a prefix, which contains "/run"!!'
exit 1
fi
inst_multiple -o \
"$systemdutildir"/systemd \
"$systemdutildir"/systemd-coredump \
"$systemdutildir"/systemd-cgroups-agent \
"$systemdutildir"/systemd-shutdown \
"$systemdutildir"/systemd-reply-password \
"$systemdutildir"/systemd-fsck \
"$systemdutildir"/systemd-udevd \
"$systemdutildir"/systemd-journald \
"$systemdutildir"/systemd-sysctl \
"$systemdutildir"/systemd-modules-load \
"$systemdutildir"/systemd-vconsole-setup \
"$systemdutildir"/systemd-volatile-root \
"$systemdutildir"/system-generators/systemd-debug-generator \
"$systemdutildir"/system-generators/systemd-fstab-generator \
"$systemdutildir"/system-generators/systemd-gpt-auto-generator \
\
"$systemdsystemunitdir"/debug-shell.service \
"$systemdsystemunitdir"/cryptsetup.target \
"$systemdsystemunitdir"/cryptsetup-pre.target \
"$systemdsystemunitdir"/remote-cryptsetup.target \
"$systemdsystemunitdir"/emergency.target \
"$systemdsystemunitdir"/sysinit.target \
"$systemdsystemunitdir"/basic.target \
"$systemdsystemunitdir"/halt.target \
"$systemdsystemunitdir"/kexec.target \
"$systemdsystemunitdir"/local-fs.target \
"$systemdsystemunitdir"/local-fs-pre.target \
"$systemdsystemunitdir"/remote-fs.target \
"$systemdsystemunitdir"/remote-fs-pre.target \
"$systemdsystemunitdir"/multi-user.target \
"$systemdsystemunitdir"/network.target \
"$systemdsystemunitdir"/network-pre.target \
"$systemdsystemunitdir"/network-online.target \
"$systemdsystemunitdir"/nss-lookup.target \
"$systemdsystemunitdir"/nss-user-lookup.target \
"$systemdsystemunitdir"/poweroff.target \
"$systemdsystemunitdir"/reboot.target \
"$systemdsystemunitdir"/rescue.target \
"$systemdsystemunitdir"/rpcbind.target \
"$systemdsystemunitdir"/shutdown.target \
"$systemdsystemunitdir"/final.target \
"$systemdsystemunitdir"/sigpwr.target \
"$systemdsystemunitdir"/sockets.target \
"$systemdsystemunitdir"/swap.target \
"$systemdsystemunitdir"/timers.target \
"$systemdsystemunitdir"/paths.target \
"$systemdsystemunitdir"/umount.target \
\
"$systemdsystemunitdir"/sys-kernel-config.mount \
\
"$systemdsystemunitdir"/kmod-static-nodes.service \
"$systemdsystemunitdir"/systemd-tmpfiles-setup.service \
"$systemdsystemunitdir"/systemd-tmpfiles-setup-dev.service \
"$systemdsystemunitdir"/systemd-ask-password-console.path \
"$systemdsystemunitdir"/systemd-udevd-control.socket \
"$systemdsystemunitdir"/systemd-udevd-kernel.socket \
"$systemdsystemunitdir"/systemd-ask-password-plymouth.path \
"$systemdsystemunitdir"/systemd-journald.socket \
"$systemdsystemunitdir"/systemd-journald-audit.socket \
"$systemdsystemunitdir"/systemd-ask-password-console.service \
"$systemdsystemunitdir"/systemd-modules-load.service \
"$systemdsystemunitdir"/systemd-halt.service \
"$systemdsystemunitdir"/systemd-poweroff.service \
"$systemdsystemunitdir"/systemd-reboot.service \
"$systemdsystemunitdir"/systemd-kexec.service \
"$systemdsystemunitdir"/systemd-fsck@.service \
"$systemdsystemunitdir"/systemd-udevd.service \
"$systemdsystemunitdir"/systemd-udev-trigger.service \
"$systemdsystemunitdir"/systemd-udev-settle.service \
"$systemdsystemunitdir"/systemd-ask-password-plymouth.service \
"$systemdsystemunitdir"/systemd-journald.service \
"$systemdsystemunitdir"/systemd-vconsole-setup.service \
"$systemdsystemunitdir"/systemd-volatile-root.service \
"$systemdsystemunitdir"/systemd-random-seed-load.service \
"$systemdsystemunitdir"/systemd-random-seed.service \
"$systemdsystemunitdir"/systemd-sysctl.service \
\
"$systemdsystemunitdir"/sysinit.target.wants/systemd-modules-load.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-ask-password-console.path \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-journald.service \
"$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-control.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-kernel.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald-audit.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald-dev-log.socket \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-udevd.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-udev-trigger.service \
"$systemdsystemunitdir"/sysinit.target.wants/kmod-static-nodes.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-sysctl.service \
\
"$systemdsystemunitdir"/ctrl-alt-del.target \
"$systemdsystemunitdir"/reboot.target \
"$systemdsystemunitdir"/systemd-reboot.service \
"$systemdsystemunitdir"/syslog.socket \
\
"$systemdsystemunitdir"/slices.target \
"$systemdsystemunitdir"/system.slice \
"$systemdsystemunitdir"/-.slice \
\
"$tmpfilesdir"/systemd.conf \
\
journalctl systemctl \
echo swapoff \
kmod insmod rmmod modprobe modinfo depmod lsmod \
mount umount reboot poweroff \
systemd-run systemd-escape \
systemd-cgls systemd-tmpfiles \
systemd-ask-password systemd-tty-ask-password-agent \
/etc/udev/udev.hwdb
inst_multiple -o \
/usr/lib/modules-load.d/*.conf \
/usr/lib/sysctl.d/*.conf
modules_load_get() {
local _line i
for i in "$dracutsysrootdir$1"/*.conf; do
[[ -f $i ]] || continue
while read -r _line || [ -n "$_line" ]; do
case $_line in
\#*) ;;
\;*) ;;
*)
echo "$_line"
;;
esac
done < "$i"
done
}
mapfile -t _mods < <(modules_load_get /usr/lib/modules-load.d)
[[ ${#_mods[@]} -gt 0 ]] && hostonly='' instmods "${_mods[@]}"
if [[ $hostonly ]]; then
inst_multiple -H -o \
/etc/systemd/journald.conf \
/etc/systemd/journald.conf.d/*.conf \
/etc/systemd/system.conf \
/etc/systemd/system.conf.d/*.conf \
/etc/hosts \
/etc/hostname \
/etc/nsswitch.conf \
/etc/machine-id \
/etc/machine-info \
/etc/vconsole.conf \
/etc/locale.conf \
/etc/modules-load.d/*.conf \
/etc/sysctl.d/*.conf \
/etc/sysctl.conf \
/etc/udev/udev.conf
mapfile -t _mods < <(modules_load_get /etc/modules-load.d)
[[ ${#_mods[@]} -gt 0 ]] && hostonly='' instmods "${_mods[@]}"
fi
if ! [[ -e "$initdir/etc/machine-id" ]]; then
: > "$initdir/etc/machine-id"
fi
# install adm user/group for journald
inst_multiple nologin
{
grep '^systemd-journal:' "$dracutsysrootdir"/etc/passwd 2> /dev/null
grep '^adm:' "$dracutsysrootdir"/etc/passwd 2> /dev/null
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
grep '^systemd-network:' "$dracutsysrootdir"/etc/passwd 2> /dev/null
} >> "$initdir/etc/passwd"
{
grep '^systemd-journal:' "$dracutsysrootdir"/etc/group 2> /dev/null
grep '^wheel:' "$dracutsysrootdir"/etc/group 2> /dev/null
grep '^adm:' "$dracutsysrootdir"/etc/group 2> /dev/null
grep '^utmp:' "$dracutsysrootdir"/etc/group 2> /dev/null
grep '^root:' "$dracutsysrootdir"/etc/group 2> /dev/null
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
grep '^systemd-network:' "$dracutsysrootdir"/etc/group 2> /dev/null
} >> "$initdir/etc/group"
ln_r "$systemdutildir"/systemd "/init"
ln_r "$systemdutildir"/systemd "/sbin/init"
inst_binary true
ln_r "$(find_binary true)" "/usr/bin/loginctl"
ln_r "$(find_binary true)" "/bin/loginctl"
inst_rules \
70-uaccess.rules \
71-seat.rules \
73-seat-late.rules \
90-vconsole.rules \
99-systemd.rules
for i in \
emergency.target \
rescue.target \
systemd-ask-password-console.service \
systemd-ask-password-plymouth.service; do
[[ -f "$systemdsystemunitdir"/$i ]] || continue
$SYSTEMCTL -q --root "$initdir" add-wants "$i" systemd-vconsole-setup.service
done
mkdir -p "$initdir/etc/systemd"
# We must use a volatile journal, and we don't want rate-limiting
{
echo "[Journal]"
echo "Storage=volatile"
echo "RateLimitInterval=0"
echo "RateLimitBurst=0"
} >> "$initdir/etc/systemd/journald.conf"
$SYSTEMCTL -q --root "$initdir" set-default multi-user.target
# Install library file(s)
_arch=${DRACUT_ARCH:-$(uname -m)}
inst_libdir_file \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_*"
}

View File

@ -0,0 +1,39 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# hwclock does not exist on S390(x), bail out silently then
local _arch=${DRACUT_ARCH:-$(uname -m)}
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] && return 1
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries hwclock || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_hook pre-trigger 00 "$moddir/warpclock.sh"
inst_multiple -o \
/usr/share/zoneinfo/UTC \
/etc/localtime \
/etc/adjtime \
hwclock
}

View File

@ -0,0 +1,14 @@
#!/bin/sh
# This file is part of dracut warpclock module.
# SPDX-License-Identifier: GPL-2.0-or-later
# Set the kernel's timezone and reset the system time
# if adjtime is set to LOCAL.
if test -e /etc/adjtime; then
while read -r line; do
if test "$line" = LOCAL; then
hwclock --systz
fi
done < /etc/adjtime
fi

View File

@ -0,0 +1,14 @@
#!/bin/sh
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
elif [ -z "$fipsmode" ]; then
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
elif getarg boot= > /dev/null; then
. /sbin/fips.sh
if mount_boot; then
do_fips || die "FIPS integrity test failed"
fi
fi

View File

@ -0,0 +1,12 @@
#!/bin/sh
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
elif [ -z "$fipsmode" ]; then
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
else
. /sbin/fips.sh
fips_load_crypto || die "FIPS integrity test failed"
fi

View File

@ -0,0 +1,11 @@
#!/bin/sh
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
elif [ -z "$fipsmode" ]; then
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
elif ! [ -f /tmp/fipsdone ]; then
. /sbin/fips.sh
mount_boot
do_fips || die "FIPS integrity test failed"
fi

View File

@ -0,0 +1,162 @@
#!/bin/sh
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
# systemd lets stdout go to journal only, but the system
# has to halt when the integrity check fails to satisfy FIPS.
if [ -z "$DRACUT_SYSTEMD" ]; then
fips_info() {
info "$*"
}
else
fips_info() {
echo "$*" >&2
}
fi
mount_boot() {
boot=$(getarg boot=)
if [ -n "$boot" ]; then
case "$boot" in
LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
boot="$(label_uuid_to_dev "$boot")"
;;
/dev/*) ;;
*)
die "You have to specify boot=<boot device> as a boot option for fips=1"
;;
esac
if ! [ -e "$boot" ]; then
udevadm trigger --action=add > /dev/null 2>&1
i=0
while ! [ -e "$boot" ]; do
udevadm settle --exit-if-exists="$boot"
[ -e "$boot" ] && break
sleep 0.5
i=$((i + 1))
[ $i -gt 40 ] && break
done
fi
[ -e "$boot" ] || return 1
mkdir -p /boot
fips_info "Mounting $boot as /boot"
mount -oro "$boot" /boot || return 1
elif [ -d "$NEWROOT/boot" ]; then
# shellcheck disable=SC2114
rm -fr -- /boot
ln -sf "$NEWROOT/boot" /boot
fi
}
do_rhevh_check() {
KERNEL=$(uname -r)
kpath=${1}
# If we're on RHEV-H, the kernel is in /run/initramfs/live/vmlinuz0
HMAC_SUM_ORIG=$(while read -r a _ || [ -n "$a" ]; do printf "%s\n" "$a"; done < "$NEWROOT/boot/.vmlinuz-${KERNEL}.hmac")
HMAC_SUM_CALC=$(sha512hmac "$kpath" | while read -r a _ || [ -n "$a" ]; do printf "%s\n" "$a"; done || return 1)
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
warn "HMAC sum mismatch"
return 1
fi
fips_info "rhevh_check OK"
return 0
}
nonfatal_modprobe() {
modprobe "$1" 2>&1 > /dev/stdout \
| while read -r line || [ -n "$line" ]; do
echo "${line#modprobe: FATAL: }" >&2
done
}
fips_load_crypto() {
local _k
local _v
local _found
FIPSMODULES=$(cat /etc/fipsmodules)
fips_info "Loading and integrity checking all crypto modules"
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
for _module in $FIPSMODULES; do
if [ "$_module" != "tcrypt" ]; then
if ! nonfatal_modprobe "${_module}" 2> /tmp/fips.modprobe_err; then
# check if kernel provides generic algo
_found=0
while read -r _k _ _v || [ -n "$_k" ]; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_v" != "$_module" ] && continue
_found=1
break
done < /proc/crypto
[ "$_found" = "0" ] && cat /tmp/fips.modprobe_err >&2 && return 1
fi
fi
done
mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
fips_info "Self testing crypto algorithms"
modprobe tcrypt || return 1
rmmod tcrypt
}
do_fips() {
local _v
local _module
KERNEL=$(uname -r)
fips_info "Checking integrity of kernel"
if [ -e "/run/initramfs/live/vmlinuz0" ]; then
do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1
elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
elif [ -e "/run/install/repo/images/pxeboot/vmlinuz" ]; then
# This is a boot.iso with the .hmac inside the install.img
do_rhevh_check /run/install/repo/images/pxeboot/vmlinuz || return 1
else
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
# Trim off any leading GRUB boot device (e.g. ($root) )
BOOT_IMAGE="$(echo "${BOOT_IMAGE}" | sed 's/^(.*)//')"
BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}"
BOOT_IMAGE_PATH="${BOOT_IMAGE%${BOOT_IMAGE_NAME}}"
if [ -z "$BOOT_IMAGE_NAME" ]; then
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE_NAME}" ]; then
#if /boot is not a separate partition BOOT_IMAGE might start with /boot
BOOT_IMAGE_PATH=${BOOT_IMAGE_PATH#"/boot"}
#on some achitectures BOOT_IMAGE does not contain path to kernel
#so if we can't find anything, let's treat it in the same way as if it was empty
if ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE_NAME}" ]; then
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
BOOT_IMAGE_PATH=""
fi
fi
BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}/.${BOOT_IMAGE_NAME}.hmac"
if ! [ -e "${BOOT_IMAGE_HMAC}" ]; then
warn "${BOOT_IMAGE_HMAC} does not exist"
return 1
fi
(cd "${BOOT_IMAGE_HMAC%/*}" && sha512hmac -c "${BOOT_IMAGE_HMAC}") || return 1
fi
fips_info "All initrd crypto checks done"
: > /tmp/fipsdone
umount /boot > /dev/null 2>&1
return 0
}

View File

@ -0,0 +1,85 @@
#!/bin/bash
# called by dracut
check() {
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
local _fipsmodules _mod _bootfstype
if [[ -f "${srcmods}/modules.fips" ]]; then
_fipsmodules="$(cat "${srcmods}/modules.fips")"
else
_fipsmodules=""
# Hashes:
_fipsmodules+="sha1 sha224 sha256 sha384 sha512 "
_fipsmodules+="sha3-224 sha3-256 sha3-384 sha3-512 "
_fipsmodules+="crc32c crct10dif ghash "
# Ciphers:
_fipsmodules+="cipher_null des3_ede aes cfb dh ecdh "
# Modes/templates:
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac ofb cts "
# Compression algs:
_fipsmodules+="deflate lzo zlib "
# PRNG algs:
_fipsmodules+="ansi_cprng "
# Misc:
_fipsmodules+="aead cryptomgr tcrypt crypto_user "
fi
# shellcheck disable=SC2174
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
for _mod in $_fipsmodules; do
if hostonly='' instmods -c -s "$_mod"; then
echo "$_mod" >> "${initdir}/etc/fipsmodules"
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
fi
done
# with hostonly_default_device fs module for /boot is not installed by default
if [[ $hostonly ]] && [[ $hostonly_default_device == "no" ]]; then
_bootfstype=$(find_mp_fstype /boot)
if [[ -n $_bootfstype ]]; then
hostonly='' instmods "$_bootfstype"
else
dwarning "Can't determine fs type for /boot, FIPS check may fail."
fi
fi
}
# called by dracut
install() {
inst_hook pre-mount 01 "$moddir/fips-boot.sh"
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh"
inst_script "$moddir/fips.sh" /sbin/fips.sh
inst_multiple sha512hmac rmmod insmod mount uname umount
inst_simple /etc/system-fips
[ -c "${initdir}"/dev/random ] || mknod "${initdir}"/dev/random c 1 8 \
|| {
dfatal "Cannot create /dev/random"
dfatal "To create an initramfs with fips support, dracut has to run as root"
return 1
}
[ -c "${initdir}"/dev/urandom ] || mknod "${initdir}"/dev/urandom c 1 9 \
|| {
dfatal "Cannot create /dev/random"
dfatal "To create an initramfs with fips support, dracut has to run as root"
return 1
}
}

View File

@ -0,0 +1,3 @@
# This file is part of dracut systemd ac power module
SUBSYSTEM=="power_supply", KERNEL=="AC", ATTR{online}=="0", RUN+="/usr/sbin/systemctl start initrd-on-battery-power.target"
SUBSYSTEM=="power_supply", KERNEL=="AC", ATTR{online}=="1", RUN+="/usr/sbin/systemctl start initrd-on-ac-power.target"

View File

@ -0,0 +1,8 @@
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
[Unit]
Description=Initial RAM Disk On AC Power
ConditionPathExists=/usr/lib/initrd-release
DefaultDependencies=no
StopWhenUnneeded=yes

View File

@ -0,0 +1,8 @@
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
[Unit]
Description=Initial RAM Disk On Battery Power
ConditionPathExists=/usr/lib/initrd-release
DefaultDependencies=no
StopWhenUnneeded=yes

View File

@ -0,0 +1,29 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_rules "$moddir/99-initrd-power-targets.rules"
inst_simple "$systemdutildir"/systemd-ac-power
inst_simple "$moddir/initrd-on-ac-power.target" "$systemdsystemunitdir/initrd-on-ac-power.target"
inst_simple "$moddir/initrd-on-battery-power.target" "$systemdsystemunitdir/initrd-on-battery-power.target"
}

View File

@ -0,0 +1,60 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed
require_binaries \
systemd-ask-password \
systemd-tty-ask-password-agent \
|| return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) for the module in the initramfs.
install() {
inst_multiple -o \
"$systemdsystemunitdir"/systemd-ask-password-console.path \
"$systemdsystemunitdir"/systemd-ask-password-console.service \
"$systemdsystemunitdir"/multi-user.target.wants/systemd-ask-password-wall.path \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-ask-password-console.path \
systemd-ask-password \
systemd-tty-ask-password-agent
# Enable the systemd type service unit for systemd-ask-password.
$SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-console.service
# Install systemd-ask-password plymouth units if plymouth is enabled.
if dracut_module_included "plymouth"; then
inst_multiple -o \
"$systemdsystemunitdir"/systemd-ask-password-plymouth.path \
"$systemdsystemunitdir"/systemd-ask-password-plymouth.service
$SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-plymouth.service
fi
# Uncomment this section if the usecase for wall module in the initramfs arises.
# Install systemd-ask-password wall units if <wall module> is enabled.
#if dracut_module_included "<wall module>"; then
# inst_multiple -o \
# $systemdsystemunitdir/systemd-ask-password-wall.path \
# $systemdsystemunitdir/systemd-ask-password-wall.service \
# $systemdsystemunitdir/multi-user.target.wants/systemd-ask-password-wall.path \
#
# $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-wall.service
#fi
}

View File

@ -0,0 +1,53 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed
require_binaries \
coredumpctl \
"$systemdutildir"/systemd-coredump \
|| return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on the systemd module.
echo systemd-journald systemd-sysctl
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_dir /var/lib/systemd/coredump
inst_multiple -o \
"$sysctld"/50-coredump.conf \
"$systemdutildir"/coredump.conf \
"$systemdsystemunitdir"/systemd-coredump \
"$systemdsystemunitdir"/systemd-coredump.socket \
"$systemdsystemunitdir"/systemd-coredump@.service \
"$systemdsystemunitdir"/sockets.target.wants/systemd-coredump.socket \
coredumpctl
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"$systemdutilconfdir"/coredump.conf \
"$systemdsystemconfdir/coredump.conf.d/*.conf" \
"$systemdsystemconfdir"/systemd-coredump.socket \
"$systemdsystemconfdir/systemd-coredump.socket.d/*.conf" \
"$systemdsystemconfdir"/systemd-coredump@.service \
"$systemdsystemconfdir/systemd-coredump@.service.d/*.conf" \
"$systemdsystemconfdir"/sockets.target.wants/systemd-coredump.socket
fi
}

View File

@ -0,0 +1,6 @@
# This file is part of dracut systemd-hostnamed module.
[Service]
User=systemd-network
Group=systemd-hostname
AmbientCapabilities=CAP_SYS_ADMIN

View File

@ -0,0 +1,51 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries \
hostnamectl \
"$systemdutildir"/systemd-hostnamed \
|| return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo dbus systemd-sysusers
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_simple "$moddir/systemd-hostname-dracut.conf" "$sysusers/systemd-hostname-dracut.conf"
inst_simple "$moddir/org.freedesktop.hostname1_dracut.conf" "$dbussystem/org.freedesktop.hostname1_dracut.conf"
inst_simple "$moddir/99-systemd-networkd-dracut.conf" "$systemdsystemunitdir/systemd-hostnamed.service.d/99-systemd-networkd-dracut.conf"
inst_multiple -o \
"$dbussystem"/org.freedesktop.hostname1.conf \
"$dbussystemservices"/org.freedesktop.hostname1.service \
"$systemdutildir"/systemd-hostnamed \
"$systemdsystemunitdir"/systemd-hostnamed.service \
"$systemdsystemunitdir/systemd-hostnamed.service.d/*.conf" \
hostnamectl
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
/etc/hostname \
"$systemdsystemconfdir"/systemd-hostnamed.service \
"$systemdsystemconfdir/systemd-hostnamed.service.d/*.conf"
fi
}

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?> <!--*-nxml-*-->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<!--
This file is part of dracut systemd-hostnamed module.
-->
<busconfig>
<policy group="systemd-hostname">
<allow own="org.freedesktop.hostname1"/>
<allow send_destination="org.freedesktop.hostname1"/>
<allow receive_sender="org.freedesktop.hostname1"/>
</policy>
</busconfig>

View File

@ -0,0 +1,2 @@
# This file is part of dracut systemd-hostnamed module.
g systemd-hostname - "systemd hostname"

View File

@ -0,0 +1,34 @@
#!/bin/bash
# called by dracut
check() {
[[ $mount_needs ]] && return 1
return 0
}
# called by dracut
depends() {
echo "systemd"
}
installkernel() {
return 0
}
# called by dracut
install() {
inst_multiple -o \
"$systemdsystemunitdir"/initrd.target \
"$systemdsystemunitdir"/initrd-fs.target \
"$systemdsystemunitdir"/initrd-root-device.target \
"$systemdsystemunitdir"/initrd-root-fs.target \
"$systemdsystemunitdir"/initrd-usr-fs.target \
"$systemdsystemunitdir"/initrd-switch-root.target \
"$systemdsystemunitdir"/initrd-switch-root.service \
"$systemdsystemunitdir"/initrd-cleanup.service \
"$systemdsystemunitdir"/initrd-udevadm-cleanup-db.service \
"$systemdsystemunitdir"/initrd-parse-etc.service
$SYSTEMCTL -q --root "$initdir" set-default initrd.target
}

View File

@ -0,0 +1,9 @@
# This file is part of dracut systemd-journal module.
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Dracut requires volatile journal without rate-limiting
[Journal]
Storage=volatile
RateLimitInterval=0
RateLimitBurst=0

View File

@ -0,0 +1,72 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries \
journalctl \
"$systemdutildir"/systemd-journald \
|| return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_simple "$moddir/initrd.conf" "$systemdutildir/journald.conf.d/initrd.conf"
inst_multiple -o \
"$systemdutildir"/journald.conf \
"$systemdutildir/journald.conf.d/*.conf" \
"$systemdutildir"/systemd-journald \
"$systemdsystemunitdir"/systemd-journald.service \
"$systemdsystemunitdir"/systemd-journald.socket \
"$systemdsystemunitdir"/systemd-journald@.service \
"$systemdsystemunitdir"/systemd-journald@.socket \
"$systemdsystemunitdir"/systemd-journald-audit.socket \
"$systemdsystemunitdir"/systemd-journald-dev-log.socket \
"$systemdsystemunitdir"/systemd-journald-varlink@.socket \
"$systemdsystemunitdir"/systemd-journal-flush.service \
"$systemdsystemunitdir"/systemd-journal-catalog-update.service \
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald-audit.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald-dev-log.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald-audit.socket \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-journald.service \
journalctl
# Install library file(s)
_arch=${DRACUT_ARCH:-$(uname -m)}
inst_libdir_file \
{"tls/$_arch/",tls/,"$_arch/",}"liblz4.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libzstd.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"liblzma.so.*"
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"$systemdutilconfdir"/journald.conf \
"$systemdutilconfdir/journald.conf.d/*.conf" \
"$systemdsystemconfdir"/systemd-journald.service \
"$systemdsystemconfdir/systemd-journald.service.d/*.conf" \
"$systemdsystemconfdir"/systemd-journal-flush.service \
"$systemdsystemconfdir/systemd-journal-flush.service.d/*.conf" \
"$systemdsystemconfdir"/systemd-journal-catalog-update.service \
"$systemdsystemconfdir/systemd-journal-catalog-update.service.d/*.conf"
fi
}

View File

@ -0,0 +1,49 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries ldconfig || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo systemd
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_multiple -o \
/etc/ld.so.cache \
/etc/ld.so.conf \
"/etc/ld.so.conf.d/*.conf" \
"$systemdsystemunitdir"/ldconfig.service \
"$systemdsystemunitdir/ldconfig.service.d/*.conf" \
"$systemdsystemunitdir"/sysinit.target.wants/ldconfig.service \
ldconfig
# Install required libraries.
_arch=${DRACUT_ARCH:-$(uname -m)}
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"ld.so"
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"$systemdsystemconfdir"/ldconfig.service \
"$systemdsystemconfdir/ldconfig.service.d/*.conf"
fi
}

View File

@ -0,0 +1,44 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed
require_binaries "$systemdutildir"/systemd-modules-load || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_multiple -o \
"$modulesload/*.conf" \
"$systemdutildir"/systemd-modules-load \
"$systemdsystemunitdir"/systemd-modules-load.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-modules-load.service
# Enable systemd type unit(s)
$SYSTEMCTL -q --root "$initdir" enable systemd-modules-load.service
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"$modulesloadconfdir/*.conf" \
"$systemdsystemconfdir"/systemd-modules-load.service \
"$systemdsystemconfdir/systemd-modules-load.service.d/*.conf"
fi
}

View File

@ -0,0 +1,79 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
[[ $mount_needs ]] && return 1
# If the binary(s) requirements are not fulfilled the module can't be installed
require_binaries ip networkctl \
"$systemdutildir"/systemd-networkd \
"$systemdutildir"/systemd-network-generator \
"$systemdutildir"/systemd-networkd-wait-online \
|| return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo dbus kernel-network-modules systemd-sysusers
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_multiple -o \
"$dbussystem"/org.freedesktop.network1.conf \
"$dbussystemservices"/org.freedesktop.network1.service \
"$systemdutildir"/networkd.conf \
"$systemdutildir/networkd.conf.d/*.conf" \
"$systemdutildir"/systemd-networkd \
"$systemdutildir"/systemd-network-generator \
"$systemdutildir"/systemd-networkd-wait-online \
"$systemdutildir"/network/80-container-host0.network \
"$systemdutildir"/network/80-container-ve.network \
"$systemdutildir"/network/80-container-vz.network \
"$systemdutildir"/network/80-vm-vt.network \
"$systemdutildir"/network/80-wifi-adhoc.network \
"$systemdutildir"/network/99-default.link \
"$systemdsystemunitdir"/systemd-networkd.service \
"$systemdsystemunitdir"/systemd-networkd.socket \
"$systemdsystemunitdir"/systemd-network-generator.service \
"$systemdsystemunitdir"/systemd-networkd-wait-online.service \
"$systemdsystemunitdir"/systemd-network-generator.service \
networkctl ip
# Enable systemd type units
for i in \
systemd-networkd.service \
systemd-networkd.socket \
systemd-network-generator.service \
systemd-networkd-wait-online.service; do
$SYSTEMCTL -q --root "$initdir" enable "$i"
done
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"$systemdutilconfdir"/networkd.conf \
"$systemdutilconfdir/networkd.conf.d/*.conf" \
"$systemdutilconfdir/network/*" \
"$systemdsystemconfdir"/systemd-networkd.service \
"$systemdsystemconfdir/systemd-networkd.service/*.conf" \
"$systemdsystemunitdir"/systemd-networkd.socket \
"$systemdsystemunitdir/systemd-networkd.socket/*.conf" \
"$systemdsystemconfdir"/systemd-network-generator.service \
"$systemdsystemconfdir/systemd-network-generator.service/*.conf" \
"$systemdsystemconfdir"/systemd-networkd-wait-online.service \
"$systemdsystemconfdir/systemd-networkd-wait-online.service/*.conf"
fi
}

View File

@ -0,0 +1,40 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries systemd-repart || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) for the module in the initramfs.
install() {
inst_multiple -o \
"$libdir/repart.d/*.conf" \
"$systemdsystemunitdir"/systemd-repart.service \
"$systemdsystemunitdir"/initrd-root-fs.target.wants/systemd-repart.service \
systemd-repart
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"/etc/repart.d/*.conf" \
"$systemdsystemconfdir"/systemd-repart.service \
"$systemdsystemconfdir/systemd-repart.service.d/*.conf"
fi
}

View File

@ -0,0 +1,56 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed
require_binaries \
resolvectl \
"$systemdutildir"/systemd-resolved \
|| return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo dbus systemd-sysusers
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_simple "$moddir/resolved-tmpfile-dracut.conf" "$tmpfilesdir/resolved-tmpfile-dracut.conf"
inst_multiple -o \
"$dbussystem"/org.freedesktop.resolve1.conf \
"$dbussystemservices"/org.freedesktop.resolve1.service \
"$systemdutildir"/resolv.conf \
"$systemdutildir"/resolved.conf \
"$systemdutildir/resolved.conf.d/*.conf" \
"$systemdutildir"/systemd-resolved \
"$systemdsystemunitdir"/systemd-resolved.service \
"$systemdsystemunitdir/systemd-resolved.service.d/*.conf" \
resolvectl
# Enable systemd type unit(s)
$SYSTEMCTL -q --root "$initdir" enable systemd-resolved.service
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"$systemdutilconfdir"/resolved.conf \
"$systemdutilconfdir/resolved.conf.d/*.conf" \
"$systemdsystemconfdir"/systemd-resolved.service \
"$systemdsystemconfdir/systemd-resolved.service/*.conf"
fi
}

View File

@ -0,0 +1,2 @@
# This file is part of dracut systemd-resolved module.
L! /etc/resolv.conf - - - - ../run/systemd/resolve/stub-resolv.conf

View File

@ -0,0 +1,43 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries "$systemdutildir"/systemd-rfkill || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo systemd
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_multiple -o \
"$systemdutildir"/systemd-rfkill \
"$systemdsystemunitdir"/systemd-rfkill.service \
"$systemdsystemunitdir"/systemd-rfkill.socket
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"$systemdsystemconfdir"/systemd-rfkill.service \
"$systemdsystemconfdir/systemd-rfkill.service.d/*.conf" \
"$systemdsystemconfdir"/systemd-rfkill.socket \
"$systemdsystemconfdir/systemd-rfkill.socket.d/*.conf"
fi
}

View File

@ -0,0 +1,47 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed
require_binaries "$systemdutildir"/systemd-sysctl || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo systemd-modules-load
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) for the module in the initramfs.
install() {
inst_multiple -o \
"$sysctld/*.conf" \
"$systemdsystemunitdir"/systemd-sysctl.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-sysctl.service \
"$systemdutildir"/systemd-sysctl
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
/etc/sysctl.conf \
"$sysctlconfdir/*.conf" \
"$systemdsystemconfdir"/systemd-sysctl.service \
"$systemdsystemconfdir/systemd-sysctl.service.d/*.conf"
fi
# Enable the systemd type service unit for sysctl.
$SYSTEMCTL -q --root "$initdir" enable systemd-sysctl.service
}

View File

@ -0,0 +1,47 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries systemd-sysext || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo systemd
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_multiple -o \
"/usr/lib/extensions/*" \
"/usr/lib/extension-release.d/extension-release.*" \
"$systemdsystemunitdir"/systemd-sysext.service \
"$systemdsystemunitdir/systemd-sysext.service.d/*.conf" \
systemd-sysext
# Enable systemd type unit(s)
$SYSTEMCTL -q --root "$initdir" enable systemd-sysext.service
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"/etc/extensions/*" \
"$systemdsystemconfdir"/systemd-sysext.service \
"$systemdsystemconfdir/systemd-sysext.service.d/*.conf"
fi
}

View File

@ -0,0 +1,43 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries systemd-sysusers || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_multiple -o \
"$sysusers"/basic.conf \
"$sysusers"/systemd.conf \
"$systemdsystemunitdir"/systemd-sysusers.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-sysusers.service \
systemd-sysusers
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"$sysusersconfdir"/basic.conf \
"$sysusersconfdir"/systemd.conf \
"$systemdsystemconfdir"/systemd-sysusers.service \
"$systemdsystemconfdir/systemd-sysusers.service.d/*.conf"
fi
}

View File

@ -0,0 +1,45 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed
require_binaries \
timedatectl \
"$systemdutildir"/systemd-timedated \
|| return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo dbus
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_multiple -o \
"$dbussystem"/org.freedesktop.timedate1.conf \
"$dbussystemservices"/org.freedesktop.timedate1.service \
"$systemdutildir"/systemd-timedated \
"$systemdsystemunitdir"/systemd-timedated.service \
timedatectl
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"$systemdsystemconfdir"/systemd-timedated.service \
"$systemdsystemconfdir/systemd-timedated.service/*.conf"
fi
}

View File

@ -0,0 +1,65 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed
require_binaries \
"$systemdutildir"/systemd-timesyncd \
"$systemdutildir"/systemd-time-wait-sync \
|| return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo dbus systemd-timedated
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
# Enable this if networkd ( not the module ) is disabled at build time and you want to use timesyncd
# inst_simple "$moddir/timesyncd-tmpfile-dracut.conf" "$tmpfilesdir/timesyncd-tmpfile-dracut.conf"
inst_multiple -o \
"$dbussystem"/org.freedesktop.timesync1.conf \
"$dbussystemservices"/org.freedesktop.timesync1.service \
"$systemdutildir/ntp-units.d/*.list" \
"$systemdutildir"/systemd-timesyncd \
"$systemdutildir"/systemd-time-wait-sync \
"$systemdutildir/timesyncd.conf.d/*.conf" \
"$systemdsystemunitdir"/systemd-timesyncd.service \
"$systemdsystemunitdir/systemd-timesyncd.service.d/*.conf" \
"$systemdsystemunitdir"/systemd-time-wait-sync.service \
"$systemdsystemunitdir/systemd-time-wait-sync.service.d/*.conf"
# Enable systemd type unit(s)
for i in \
systemd-timesyncd.service \
systemd-time-wait-sync.service; do
$SYSTEMCTL -q --root "$initdir" enable "$i"
done
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"$systemdutilconfdir/ntp-units.d/*.list" \
"$systemdutilconfdir"/timesyncd.conf \
"$systemdutilconfdir/timesyncd.conf.d/*.conf" \
"$systemdsystemconfdir"/systemd-timesyncd.service \
"$systemdsystemconfdir/systemd-timesyncd.service.d/*.conf" \
"$systemdsystemunitdir"/systemd-time-wait-sync.service \
"$systemdsystemunitdir/systemd-time-wait-sync.service.d/*.conf"
fi
}

View File

@ -0,0 +1,2 @@
# This file is part of dracut systemd-timesyncd module.
d /run/systemd/netif/links 0755 root root -

View File

@ -0,0 +1,70 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries systemd-tmpfiles || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
# Excluding "$tmpfilesdir/home.conf", sets up /home /srv
# Excluding "$tmpfilesdir/portables.conf", belongs in seperated portables module
# Excluding "$tmpfilesdir/journal-nocow.conf", requires spesific btrfs setup
# Excluding "$tmpfilesdir/legacy.conf", belongs in seperated legacy module
# Excluding "$tmpfilesdir/systemd-nologin.conf", belongs in seperated pam module
# Excluding "$tmpfilesdir/systemd-nspawn.conf", belongs in seperated machined module
# Excluding "$tmpfilesdir/systemd-pstore.conf", belongs in seperated pstore module
# Excluding "$tmpfilesdir/x11.conf", belongs in seperated x11 module
inst_multiple -o \
/usr/lib/group \
/usr/lib/passwd \
"$tmpfilesdir/etc.conf" \
"$tmpfilesdir/static-nodes-permissions.conf" \
"$tmpfilesdir/systemd-tmp.conf" \
"$tmpfilesdir/systemd.conf" \
"$tmpfilesdir/var.conf" \
"$systemdsystemunitdir"/systemd-tmpfiles-clean.service \
"$systemdsystemunitdir/systemd-tmpfiles-clean.service.d/*.conf" \
"$systemdsystemunitdir"/systemd-tmpfiles-setup.service \
"$systemdsystemunitdir/systemd-tmpfiles-setup.service.d/*.conf" \
"$systemdsystemunitdir"/systemd-tmpfiles-setup-dev.service \
"$systemdsystemunitdir/systemd-tmpfiles-setup-dev.service.d/*.conf" \
"$systemdsystemunitdir"/systemd-tmpfiles-clean.timer \
"$systemdsystemunitdir"/timers.target.wants/systemd-tmpfiles-clean.timer \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup.service \
systemd-tmpfiles
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
/etc/group \
/etc/passwd \
"$tmpfilesconfdir/*.conf" \
"$systemdsystemconfdir"/systemd-tmpfiles-clean.service \
"$systemdsystemconfdir/systemd-tmpfiles-clean.service.d/*.conf" \
"$systemdsystemconfdir"/systemd-tmpfiles-setup.service \
"$systemdsystemconfdir/systemd-tmpfiles-setup.service.d/*.conf" \
"$systemdsystemconfdir"/systemd-tmpfiles-setup-dev.service \
"$systemdsystemconfdir/systemd-tmpfiles-setup-dev.service.d/*.conf"
fi
}

View File

@ -0,0 +1,110 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries \
udevadm \
"$systemdutildir"/systemd-udevd \
|| return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo systemd
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_multiple -o \
"$udevdir"/hwdb.bin \
"$udevdir"/udev.conf \
"$udevdir"/ata_id \
"$udevdir"/cdrom_id \
"$udevdir"/dmi_memory_id \
"$udevdir"/fido_id \
"$udevdir"/mtd_probe \
"$udevdir"/mtp-probe \
"$udevdir"/scsi_id \
"$udevdir"/v4l_id \
"$udevrulesdir"/50-udev-default.rules \
"$udevrulesdir"/60-autosuspend.rules \
"$udevrulesdir"/60-block.rules \
"$udevrulesdir"/60-cdrom_id.rules \
"$udevrulesdir"/60-drm.rules \
"$udevrulesdir"/60-evdev.rules \
"$udevrulesdir"/60-fido-id.rules \
"$udevrulesdir"/60-input-id.rules \
"$udevrulesdir"/60-persistent-alsa.rules \
"$udevrulesdir"/60-persistent-input.rules \
"$udevrulesdir"/60-persistent-storage-tape.rules \
"$udevrulesdir"/60-persistent-storage.rules \
"$udevrulesdir"/60-persistent-v4l.rules \
"$udevrulesdir"/60-sensor.rules \
"$udevrulesdir"/60-serial.rules \
"$udevrulesdir"/64-btrfs.rules \
"$udevrulesdir"/70-joystick.rules \
"$udevrulesdir"/70-memory.rules \
"$udevrulesdir"/70-mouse.rules \
"$udevrulesdir"/70-touchpad.rules \
"$udevrulesdir"/75-net-description.rules \
"$udevrulesdir"/75-probe_mtd.rules \
"$udevrulesdir"/78-sound-card.rules \
"$udevrulesdir"/80-drivers.rules \
"$udevrulesdir"/80-net-setup-link.rules \
"$udevrulesdir"/81-net-dhcp.rules \
"$udevrulesdir"/99-systemd.rules \
"$systemdutildir"/systemd-udevd \
"$systemdsystemunitdir"/systemd-udevd.service \
"$systemdsystemunitdir/systemd-udevd.service.d/*.conf" \
"$systemdsystemunitdir"/systemd-udev-trigger.service \
"$systemdsystemunitdir/systemd-udev-trigger.service.d/*.conf" \
"$systemdsystemunitdir"/systemd-udev-settle.service \
"$systemdsystemunitdir/systemd-udev-settle.service.d/*.conf" \
"$systemdsystemunitdir"/systemd-udevd-control.socket \
"$systemdsystemunitdir"/systemd-udevd-kernel.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-control.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-kernel.socket \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-udevd.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-udev-trigger.service \
udevadm
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
"$udevconfdir"/hwdb.bin \
"$udevconfdir"/udev.conf \
"$udevrulesconfdir/*.rules" \
"$systemdutilconfdir"/hwdb/hwdb.bin \
"$systemdsystemconfdir"/systemd-udevd.service \
"$systemdsystemconfdir/systemd-udevd.service.d/*.conf" \
"$systemdsystemconfdir"/systemd-udev-trigger.service \
"$systemdsystemconfdir/systemd-udev-trigger.service.d/*.conf" \
"$systemdsystemconfdir"/systemd-udev-settle.service \
"$systemdsystemconfdir/systemd-udev-settle.service.d/*.conf" \
"$systemdsystemconfdir"/systemd-udevd-control.socket \
"$systemdsystemconfdir"/systemd-udevd-kernel.socket \
"$systemdsystemconfdir"/sockets.target.wants/systemd-udevd-control.socket \
"$systemdsystemconfdir"/sockets.target.wants/systemd-udevd-kernel.socket \
"$systemdsystemconfdir"/sysinit.target.wants/systemd-udevd.service \
"$systemdsystemconfdir"/sysinit.target.wants/systemd-udev-trigger.service
fi
# Install required libraries.
_arch=${DRACUT_ARCH:-$(uname -m)}
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libudev.so.*"
}

View File

@ -0,0 +1,60 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries \
"$systemdutildir"/systemd-veritysetup \
"$systemdutildir"/system-generators/systemd-veritysetup-generator \
|| return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo systemd dm
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst_multiple -o \
"$systemdutildir"/systemd-veritysetup \
"$systemdutildir"/system-generators/systemd-veritysetup-generator \
"$systemdsystemunitdir"/remote-veritysetup.target \
"$systemdsystemunitdir"/veritysetup-pre.target \
"$systemdsystemunitdir"/veritysetup.target \
"$systemdsystemunitdir"/sysinit.target.wants/veritysetup.target \
"$systemdsystemunitdir"/initrd-root-device.target.wants/remote-veritysetup.target
# Install the hosts local user configurations if enabled.
if [[ $hostonly ]]; then
inst_multiple -H -o \
/etc/veritytab \
"$systemdsystemconfdir"/veritysetup.target \
"$systemdsystemconfdir/veritysetup.target.wants/*.target" \
"$systemdsystemconfdir"/veritysetup-pre.target \
"$systemdsystemconfdir/veritysetup-pre.target.wants/*.target" \
"$systemdsystemconfdir"/remote-veritysetup.target \
"$systemdsystemconfdir/remote-veritysetup.target.wants/*.target" \
"$systemdsystemconfdir"/sysinit.target.wants/veritysetup.target \
"$systemdsystemconfdir/sysinit.target.wants/veritysetup.target.wants/*.target" \
"$systemdsystemconfdir"/initrd-root-device.target.wants/remote-veritysetup.target
fi
# Install required libraries.
_arch=${DRACUT_ARCH:-$(uname -m)}
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libcryptsetup.so.*"
}

View File

@ -0,0 +1,33 @@
This adds the following parameters:
rd.caps=1
turn the caps module on/off
rd.caps.initdrop=cap_sys_module,cap_sys_rawio
drop the specified comma separated capabilities
rd.caps.disablemodules=1
turn off module loading
rd.caps.disablekexec=1
turn off the kexec functionality
If module loading is turned off, all modules have to be loaded in the
initramfs, which are used later on. This can be done with
"rd.driver.pre="
rd.driver.pre=autofs4,sunrpc,ipt_REJECT,nf_conntrack_ipv4,....
Because the kernel command line would get huge with all those drivers, I
recommend to make use of $initramfs/etc/cmdline.
So, all rd.caps.* and rd.driver.pre arguments are in caps.conf can be
copied to $initramfs/etc/cmdline with "-i caps.conf /etc/cmdline".
Also all modules have to be loaded in the initramfs via "--add-drivers".
The resulting initramfs creation would look like this:
--add-drivers "autofs4 sunrpc ipt_REJECT nf_conntrack_ipv4 \
nf_defrag_ipv4 iptable_filter ip_tables
ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack
ip6table_filter ip6_tables dm_mirror dm_region_hash dm_log uinput ppdev
parport_pc parport ipv6 sg 8139too 8139cp mii i2c_piix4 i2c_core ext3
jbd mbcache sd_mod crc_t10dif sr_mod cdrom ata_generic pata_acpi ata_piix
dm_mod" \
/boot/initramfs-caps.img

View File

@ -0,0 +1,34 @@
#!/bin/bash
capsmode=$(getarg rd.caps)
if [ "$capsmode" = "1" ]; then
CAPS_INIT_DROP=$(getarg rd.caps.initdrop=)
# shellcheck disable=SC2016
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b || [ -n "$a" ]; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
CAPS_MODULES_DISABLED=$(getarg rd.caps.disablemodules=)
CAPS_KEXEC_DISABLED=$(getarg rd.caps.disablekexec=)
info "Loading CAPS_MODULES $CAPS_MODULES"
for i in $CAPS_MODULES; do modprobe "$i" 2>&1 > /dev/null | vinfo; done
if [ "$CAPS_MODULES_DISABLED" = "1" -a -e /proc/sys/kernel/modules_disabled ]; then
info "Disabling module loading."
echo "$CAPS_MODULES_DISABLED" > /proc/sys/kernel/modules_disabled
fi
if [ "$CAPS_KEXEC_DISABLED" = "1" -a -e /proc/sys/kernel/kexec_disabled ]; then
info "Disabling kexec."
echo "$CAPS_KEXEC_DISABLED" > /proc/sys/kernel/kexec_disabled
fi
info "CAPS_USERMODEHELPER_BSET=$CAPS_USERMODEHELPER_BSET"
if [ -e /proc/sys/kernel/usermodehelper/bset ]; then
info "Setting usermode helper bounding set."
echo "$CAPS_USERMODEHELPER_BSET" > /proc/sys/kernel/usermodehelper/bset
echo "$CAPS_USERMODEHELPER_BSET" > /proc/sys/kernel/usermodehelper/inheritable
fi
echo "CAPS_INIT_DROP=\"$CAPS_INIT_DROP\"" > /etc/capsdrop
info "Will drop capabilities $CAPS_INIT_DROP from init."
fi

View File

@ -0,0 +1,25 @@
#!/bin/bash
# called by dracut
check() {
require_binaries capsh
return 255
}
# called by dracut
depends() {
echo bash
return 0
}
# called by dracut
install() {
if ! dracut_module_included "systemd"; then
inst_hook pre-pivot 00 "$moddir/caps.sh"
inst "$(find_binary capsh 2> /dev/null)" /usr/sbin/capsh
# capsh wants bash and we need bash also
inst /bin/bash
else
dwarning "caps: does not work with systemd in the initramfs"
fi
}

View File

@ -0,0 +1,11 @@
#!/bin/sh
#
# Licensed under the GPLv2
#
# Copyright 2013 Red Hat, Inc.
# Peter Jones <pjones@redhat.com>
for x in /lib/modules/keys/*; do
[ "${x}" = "/lib/modules/keys/*" ] && break
keyctl padd asymmetric "" @s < "${x}"
done

View File

@ -0,0 +1,38 @@
#!/bin/bash
#
# Licensed under the GPLv2
#
# Copyright 2013 Red Hat, Inc.
# Peter Jones <pjones@redhat.com>
# called by dracut
check() {
require_binaries keyctl || return 1
# do not include module in hostonly mode,
# if no keys are present
if [[ $hostonly ]]; then
x=$(echo "$dracutsysrootdir"/lib/modules/keys/*)
[[ ${x} == "$dracutsysrootdir/lib/modules/keys/*" ]] && return 255
fi
return 0
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
inst_dir /lib/modules/keys
inst_binary keyctl
inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
for x in "$dracutsysrootdir"/lib/modules/keys/*; do
[[ ${x} == "$dracutsysrootdir/lib/modules/keys/*" ]] && break
inst_simple "${x#$dracutsysrootdir}"
done
}

Some files were not shown because too many files have changed in this diff Show More