lorax/mkksiso.html
2021-10-11 16:33:12 -07:00

251 lines
19 KiB
HTML

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>mkksiso &mdash; Lorax 36.0 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Product and Updates Images" href="product-images.html" />
<link rel="prev" title="livemedia-creator" href="livemedia-creator.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> Lorax
</a>
<div class="version">
36.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction to Lorax</a></li>
<li class="toctree-l1"><a class="reference internal" href="intro.html#before-lorax">Before Lorax</a></li>
<li class="toctree-l1"><a class="reference internal" href="lorax.html">Lorax</a></li>
<li class="toctree-l1"><a class="reference internal" href="livemedia-creator.html">livemedia-creator</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">mkksiso</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#mkksiso-cmdline-arguments">mkksiso cmdline arguments</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#optional-arguments">Optional arguments</a></li>
<li class="toctree-l3"><a class="reference internal" href="#positional-arguments">Positional arguments</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#create-a-kickstart-boot-iso-or-dvd">Create a kickstart boot.iso or DVD</a></li>
<li class="toctree-l2"><a class="reference internal" href="#adding-package-repos-to-a-boot-iso">Adding package repos to a boot.iso</a></li>
<li class="toctree-l2"><a class="reference internal" href="#create-a-liveimg-boot-iso">Create a liveimg boot.iso</a></li>
<li class="toctree-l2"><a class="reference internal" href="#how-it-works">How it works</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="product-images.html">Product and Updates Images</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">src</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Lorax</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
<li>mkksiso</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/mkksiso.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="mkksiso">
<h1>mkksiso<a class="headerlink" href="#mkksiso" title="Permalink to this headline"></a></h1>
<dl class="field-list simple">
<dt class="field-odd">Authors</dt>
<dd class="field-odd"><p>Brian C. Lane &lt;<a class="reference external" href="mailto:bcl&#37;&#52;&#48;redhat&#46;com">bcl<span>&#64;</span>redhat<span>&#46;</span>com</a>&gt;</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">mkksiso</span></code> is a tool for creating kickstart boot isos. In it's simplest form
you can add a kickstart to a boot.iso and the kickstart will be executed when
the iso is booted. If the original iso was created with EFI and Mac support the
kickstart boot.iso will include this support as well.</p>
<p><code class="docutils literal notranslate"><span class="pre">mkksiso</span></code> needs to be run as root, it depends on mounting the original iso
and you need to be root to be able to do that.</p>
<section id="mkksiso-cmdline-arguments">
<h2>mkksiso cmdline arguments<a class="headerlink" href="#mkksiso-cmdline-arguments" title="Permalink to this headline"></a></h2>
<p>Add a kickstart and files to an iso</p>
<blockquote>
<div><p><code class="docutils literal notranslate"><span class="pre">usage:</span> <span class="pre">mkksiso</span> <span class="pre">[-h]</span> <span class="pre">[-a</span> <span class="pre">ADD_PATHS]</span> <span class="pre">[-c</span> <span class="pre">CMDLINE]</span> <span class="pre">[--debug]</span> <span class="pre">ks</span> <span class="pre">input_iso</span> <span class="pre">output_iso</span></code></p>
</div></blockquote>
<section id="optional-arguments">
<h3>Optional arguments<a class="headerlink" href="#optional-arguments" title="Permalink to this headline"></a></h3>
<blockquote>
<div><dl class="option-list">
<dt><kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></dt>
<dd><p>show this help message and exit</p>
</dd>
<dt><kbd><span class="option">-a <var>ADD_PATHS</var></span>, <span class="option">--add <var>ADD_PATHS</var></span></kbd></dt>
<dd><p>File or directory to add to ISO (may be used multiple
times)</p>
</dd>
<dt><kbd><span class="option">-c <var>CMDLINE</var></span>, <span class="option">--cmdline <var>CMDLINE</var></span></kbd></dt>
<dd><p>Arguments to add to kernel cmdline</p>
</dd>
<dt><kbd><span class="option">--debug</span></kbd></dt>
<dd><p>print debugging info</p>
</dd>
<dt><kbd><span class="option">-V <var>VOLID</var></span>, <span class="option">--volid <var>VOLID</var></span></kbd></dt>
<dd><p>Set the ISO volume id, defaults to input's</p>
</dd>
</dl>
</div></blockquote>
</section>
<section id="positional-arguments">
<h3>Positional arguments<a class="headerlink" href="#positional-arguments" title="Permalink to this headline"></a></h3>
<blockquote>
<div><dl class="field-list simple">
<dt class="field-odd">ks</dt>
<dd class="field-odd"><p>Kickstart to add to the ISO</p>
</dd>
<dt class="field-even">input_iso</dt>
<dd class="field-even"><p>ISO to modify</p>
</dd>
<dt class="field-odd">output_iso</dt>
<dd class="field-odd"><p>Full pathname of iso to be created</p>
</dd>
</dl>
</div></blockquote>
</section>
</section>
<section id="create-a-kickstart-boot-iso-or-dvd">
<h2>Create a kickstart boot.iso or DVD<a class="headerlink" href="#create-a-kickstart-boot-iso-or-dvd" title="Permalink to this headline"></a></h2>
<p>Create a kickstart like you normally would, kickstart documentation can be
<a class="reference external" href="https://pykickstart.readthedocs.io/en/latest/">found here</a>, including the
<code class="docutils literal notranslate"><span class="pre">url</span></code> and <code class="docutils literal notranslate"><span class="pre">repo</span></code> commands. If you are creating a DVD and only need the
content on the DVD you can use the <code class="docutils literal notranslate"><span class="pre">cdrom</span></code> command to install without a
network connection. Then run <code class="docutils literal notranslate"><span class="pre">mkksiso</span></code> like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mkksiso</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">KICKSTART</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">ISO</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">NEW</span><span class="o">-</span><span class="n">ISO</span>
</pre></div>
</div>
<p>This will create a new iso with the kickstart in the root directory, and the
kernel cmdline will have <code class="docutils literal notranslate"><span class="pre">inst.ks=...</span></code> added to it so that it will be
executed when the iso is booted (be careful not to boot on a system you don't
want to wipe out! There will be no prompting).</p>
<p>By default the volume id of the iso is preserved. You can set a custom volid
by passing <code class="docutils literal notranslate"><span class="pre">-V</span></code> and the string to set. The kernel cmdline will be changes, and the iso will have th custom volume id.
eg.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mkksiso</span> <span class="o">-</span><span class="n">V</span> <span class="s2">&quot;Test Only&quot;</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">KICKSTART</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">ISO</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">NEW</span><span class="o">-</span><span class="n">ISO</span>
</pre></div>
</div>
</section>
<section id="adding-package-repos-to-a-boot-iso">
<h2>Adding package repos to a boot.iso<a class="headerlink" href="#adding-package-repos-to-a-boot-iso" title="Permalink to this headline"></a></h2>
<p>You can add repo directories to the iso using <code class="docutils literal notranslate"><span class="pre">--add</span> <span class="pre">/PATH/TO/REPO/</span></code>, make
sure it contains the <code class="docutils literal notranslate"><span class="pre">repodata</span></code> directory by running <code class="docutils literal notranslate"><span class="pre">createrepo_c</span></code> on it
first. In the kickstart you can refer to the directories (and files) on the iso
using <code class="docutils literal notranslate"><span class="pre">file:///run/install/repo/DIRECTORY/</span></code>. You can then use these repos in
the kickstart like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">repo</span> <span class="o">--</span><span class="n">name</span><span class="o">=</span><span class="n">extra</span><span class="o">-</span><span class="n">repo</span> <span class="o">--</span><span class="n">baseurl</span><span class="o">=</span><span class="n">file</span><span class="p">:</span><span class="o">///</span><span class="n">run</span><span class="o">/</span><span class="n">install</span><span class="o">/</span><span class="n">repo</span><span class="o">/</span><span class="n">extra</span><span class="o">-</span><span class="n">repo</span><span class="o">/</span>
</pre></div>
</div>
<p>Run <code class="docutils literal notranslate"><span class="pre">mkksiso</span></code> like so:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mkksiso</span> <span class="o">--</span><span class="n">add</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">REPO</span><span class="o">/</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">KICKSTART</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">ISO</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">NEW</span><span class="o">-</span><span class="n">ISO</span>
</pre></div>
</div>
</section>
<section id="create-a-liveimg-boot-iso">
<h2>Create a liveimg boot.iso<a class="headerlink" href="#create-a-liveimg-boot-iso" title="Permalink to this headline"></a></h2>
<p>You can use the kickstart <a class="reference external" href="https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#liveimg">liveimg command</a>,
to install a pre-generated disk image or tar to the system the iso is booting
on.</p>
<p>Create a disk image or tar with <code class="docutils literal notranslate"><span class="pre">osbuild-composer</span></code> or <code class="docutils literal notranslate"><span class="pre">livemedia-creator</span></code>,
make sure the image includes tools expected by <code class="docutils literal notranslate"><span class="pre">anaconda</span></code>, as well as the
kernel and bootloader support. In <code class="docutils literal notranslate"><span class="pre">osbuild-composer</span></code> use the <code class="docutils literal notranslate"><span class="pre">tar</span></code> image
type and make sure to include the <code class="docutils literal notranslate"><span class="pre">kernel</span></code>, <code class="docutils literal notranslate"><span class="pre">grub2</span></code>, and <code class="docutils literal notranslate"><span class="pre">grub2-tools</span></code>
packages. If you plan to install it to a UEFI machine make sure to include
<code class="docutils literal notranslate"><span class="pre">grub2-efi</span></code> and <code class="docutils literal notranslate"><span class="pre">efibootmgr</span></code> in the blueprint.</p>
<p>Add the <code class="docutils literal notranslate"><span class="pre">root.tar.xz</span></code> file to the iso using <code class="docutils literal notranslate"><span class="pre">--add</span> <span class="pre">/PATH/TO/ROOT.TAR.XZ</span></code>,
and in the kickstart reference it with the <code class="docutils literal notranslate"><span class="pre">liveimg</span></code> command like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">liveimg</span> <span class="o">--</span><span class="n">url</span><span class="o">=</span><span class="n">file</span><span class="p">:</span><span class="o">///</span><span class="n">run</span><span class="o">/</span><span class="n">install</span><span class="o">/</span><span class="n">repo</span><span class="o">/</span><span class="n">root</span><span class="o">.</span><span class="n">tar</span><span class="o">.</span><span class="n">xz</span>
</pre></div>
</div>
<p>It is also a good idea to use the <code class="docutils literal notranslate"><span class="pre">--checksum</span></code> argument to <code class="docutils literal notranslate"><span class="pre">liveimg</span></code> to be
sure the file hasn't been corrupted:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mkksiso</span> <span class="o">--</span><span class="n">add</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">root</span><span class="o">.</span><span class="n">tar</span><span class="o">.</span><span class="n">xz</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">KICKSTART</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">ISO</span> <span class="o">/</span><span class="n">PATH</span><span class="o">/</span><span class="n">TO</span><span class="o">/</span><span class="n">NEW</span><span class="o">-</span><span class="n">ISO</span>
</pre></div>
</div>
<p>When this iso is booted it will execute the kickstart and install the liveimg
contents to the system without any prompting.</p>
</section>
<section id="how-it-works">
<h2>How it works<a class="headerlink" href="#how-it-works" title="Permalink to this headline"></a></h2>
<p><code class="docutils literal notranslate"><span class="pre">mkksiso</span></code> first examines the system to make sure the tools it needs are installed,
it will work with <code class="docutils literal notranslate"><span class="pre">xorrisofs</span></code> or <code class="docutils literal notranslate"><span class="pre">mkisofs</span></code> installed. It mounts the source iso,
and copies the directories that need to be modified to a temporary directory.</p>
<p>It then modifies the boot configuration files to include the <code class="docutils literal notranslate"><span class="pre">inst.ks</span></code> command,
and checks to see if the original iso supports EFI. If it does it regenerates the
EFI boot images with the new configuration, and then runs the available iso creation
tool to add the new files and directories to the new iso. If the architecture is
<code class="docutils literal notranslate"><span class="pre">x86_64</span></code> it will also make sure the iso can be booted as an iso or from a USB
stick (hybridiso).</p>
<p>The last step is to update the iso checksums so that booting with test enabled
will pass.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="livemedia-creator.html" class="btn btn-neutral float-left" title="livemedia-creator" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="product-images.html" class="btn btn-neutral float-right" title="Product and Updates Images" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2018, Red Hat, Inc..</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>