<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>codemonkey.org.uk &#187; early-init</title>
	<atom:link href="http://www.codemonkey.org.uk/tag/early-init/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codemonkey.org.uk</link>
	<description>Dave Jones' Linux &#38; opensource stuff.</description>
	<lastBuildDate>Sat, 03 Jul 2010 23:33:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Dracut status</title>
		<link>http://www.codemonkey.org.uk/2009/02/02/dracut-status/</link>
		<comments>http://www.codemonkey.org.uk/2009/02/02/dracut-status/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 18:59:13 +0000</pubDate>
		<dc:creator>davej</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dracut]]></category>
		<category><![CDATA[early-init]]></category>
		<category><![CDATA[initramfs]]></category>
		<category><![CDATA[initrd]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[mkinitrd]]></category>

		<guid isPermaLink="false">http://www.codemonkey.org.uk/?p=133</guid>
		<description><![CDATA[I figured I&#8217;d drop a quick &#8216;howto&#8217; to get up and running with dracut, the shiny new initramfs creation tool. Right now, it&#8217;s still very Fedora-centric, with a few hardcoded assumptions in there, so it&#8217;ll likely fall over on other distros, but most of those are silly things like pathnames, which I&#8217;m sure we&#8217;ll eventually [...]<p><a href="http://www.codemonkey.org.uk/2009/02/02/dracut-status/">Dracut status</a> is a post from: <a href="http://www.codemonkey.org.uk">codemonkey.org.uk</a></p>



Related posts:<ol><li><a href='http://www.codemonkey.org.uk/2009/12/10/annoying-kernel-packaging-bug/' rel='bookmark' title='Permanent Link: An annoying kernel packaging bug.'>An annoying kernel packaging bug.</a> <small>The kernel rpm package creates an initramfs file that gets...</small></li>
<li><a href='http://www.codemonkey.org.uk/2010/03/29/spot-shell-bug/' rel='bookmark' title='Permanent Link: Spot the shell bug.'>Spot the shell bug.</a> <small>This is bugging me. I&#8217;m missing something obvious here, and...</small></li>
<li><a href='http://www.codemonkey.org.uk/2009/09/16/bootinit-miniconf-plumbers-week/' rel='bookmark' title='Permanent Link: boot/init miniconf at plumbers next week.'>boot/init miniconf at plumbers next week.</a> <small>I&#8217;m MC&#8217;ing the boot/init miniconf next week at the Linux...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I figured I&#8217;d drop a quick &#8216;howto&#8217; to get up and running with dracut, the shiny new initramfs creation tool. Right now, it&#8217;s still very Fedora-centric, with a few hardcoded assumptions in there, so it&#8217;ll likely fall over on other distros, but most of those are silly things like pathnames, which I&#8217;m sure we&#8217;ll eventually come to some agreement over.</p>
<p>So to begin with, clone the git repo from git://fedorapeople.org/~katzj/dracut.git   (This will move soon, as Jeremy asked me to take over the lead on dracut, but until there&#8217;s additional changes, go there).</p>
<p>After a brief cloning, you&#8217;ll be left with a dracut directory containing a bunch of interesting files..</p>
<p>&#8216;dracut&#8217; is the shell script that will actually generate an initramfs image.  It sources the &#8216;dracut-functions&#8217; script to do some of the trickier things like working out module dependancies.  This script will eventually get called by the kernel during its build process as part of &#8216;make initramfs&#8217;.</p>
<p>dracut.spec is an RPM spec file, handy for testing on Fedora systems until we get the kernel bits hooked up.</p>
<p>&#8216;init&#8217; is the actual init script that ends up in the initramfs.<br />
It achieves quite a lot in its 119 lines.</p>
<ul>
<li>Sets up device nodes</p>
<li>starts up udev
<li>figures out from the command line what kind of root device we&#8217;re expecting
<li>waits for it to show up in /dev, and mounts it
<li>mounts /proc and /sys
<li>If anything goes wrong at all during mounting of the root filesystem, it drops you to a shell.
<li>If plymouth is present, it starts it, so it can show splash screens, or prompt for an encrypted disk password etc.
<li>Right now it&#8217;s also loading the default selinux policy, though there seems to be agreement that the right place for this to happen is in the real rootfs, in /sbin/init.
</ul>
<p>There&#8217;s a makefile that will install things in the right places if you&#8217;re on a Fedora system. (libexec, ugh).  If you don&#8217;t do this, you can still run dracut directly from the checked out tree, by passing it the option -l</p>
<p>rules.d contains two udev rules. One which scans for LVM volumes when it gets a notification that a new block device has been added to the system, and another which handles encrypted block devices should one show up.  Both of these rules are not shining examples of how this should be done, and could use improving.</p>
<p>&#8216;switch_root&#8217; is the sole surviving piece of &#8216;nash&#8217;. Its job is fairly simple. Switch to new root directory and start init from that new root.  Right now, we&#8217;re calling the nash tool from the existing mkinitrd implementation.  The code for the replacement of this currently lives at http://pjones.fedorapeople.org/mkstart/usr/lib/mkstart/switchroot.c  It is hoped that this will get included as a util-linux utility soon, so that nash can finally be put to rest.</p>
<p>Finally there&#8217;s all the usual things you&#8217;d expect to see in a project, COPYING, HACKING, README and a healthy looking TODO.</p>
<p>The interesting parts (the shell scripts) are currently only just over 600 lines, making it a fairly easy to understand project.   Removing some of the redhat&#8217;isms is definitely one of the things that needs to happen before it can be headed upstream.  I hope to get around to trying it out on some other distros later this week.</p>
<p>So with the overview out of the way..  Run the generator directly, with a target filename as a parameter. (Remember to specify -l unless you&#8217;ve done &#8216;make install&#8217;), and you should get a compressed cpio archive created in the name you chose.</p>
<p>Currently, dracut supports root on raw disks (/dev/sda), lvm (/dev/mapper&#8230;), and mounting root by label or uuid.<br />
If you have a more esoteric rootfs setup, such as root-on-nfs, right now it&#8217;ll fail horribly.</p>
<p>That&#8217;s the quick braindump that should be enough to get people playing with it.  There is a very low traffic mailing list initramfs at vger.kernel.org,  (send &#8216;subscribe initramfs&#8217; to majordomo@vger to get subscribed).</p>
<p><a href="http://www.codemonkey.org.uk/2009/02/02/dracut-status/">Dracut status</a> is a post from: <a href="http://www.codemonkey.org.uk">codemonkey.org.uk</a></p>


<p>Related posts:<ol><li><a href='http://www.codemonkey.org.uk/2009/12/10/annoying-kernel-packaging-bug/' rel='bookmark' title='Permanent Link: An annoying kernel packaging bug.'>An annoying kernel packaging bug.</a> <small>The kernel rpm package creates an initramfs file that gets...</small></li>
<li><a href='http://www.codemonkey.org.uk/2010/03/29/spot-shell-bug/' rel='bookmark' title='Permanent Link: Spot the shell bug.'>Spot the shell bug.</a> <small>This is bugging me. I&#8217;m missing something obvious here, and...</small></li>
<li><a href='http://www.codemonkey.org.uk/2009/09/16/bootinit-miniconf-plumbers-week/' rel='bookmark' title='Permanent Link: boot/init miniconf at plumbers next week.'>boot/init miniconf at plumbers next week.</a> <small>I&#8217;m MC&#8217;ing the boot/init miniconf next week at the Linux...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codemonkey.org.uk/2009/02/02/dracut-status/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Boot tracing.</title>
		<link>http://www.codemonkey.org.uk/2008/12/25/boot-tracing/</link>
		<comments>http://www.codemonkey.org.uk/2008/12/25/boot-tracing/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 03:28:09 +0000</pubDate>
		<dc:creator>davej</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[early-init]]></category>
		<category><![CDATA[fastboot]]></category>
		<category><![CDATA[kernel]]></category>

		<guid isPermaLink="false">http://www.codemonkey.org.uk/?p=21</guid>
		<description><![CDATA[I&#8217;m on vacation, but I can&#8217;t resist playing with new toys, seeing as Santa didn&#8217;t bring me anything fun this year. In my previous post, I mentioned that 2.6.28 was for the most part, dull. Reading the excellent changelog summary at kernelnewbies, I noticed a new feature I had until now overlooked. 1.6. Boot tracer [...]<p><a href="http://www.codemonkey.org.uk/2008/12/25/boot-tracing/">Boot tracing.</a> is a post from: <a href="http://www.codemonkey.org.uk">codemonkey.org.uk</a></p>



Related posts:<ol><li><a href='http://www.codemonkey.org.uk/2009/09/16/bootinit-miniconf-plumbers-week/' rel='bookmark' title='Permanent Link: boot/init miniconf at plumbers next week.'>boot/init miniconf at plumbers next week.</a> <small>I&#8217;m MC&#8217;ing the boot/init miniconf next week at the Linux...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m on vacation, but I can&#8217;t resist playing with new toys, seeing as Santa didn&#8217;t bring me anything fun this year. In <a href="http://www.codemonkey.org.uk/2008/12/24/linux-kernel-2628/">my previous post</a>, I mentioned that 2.6.28 was for the most part, dull.  Reading the <a href="http://kernelnewbies.org/Linux_2_6_28">excellent changelog summary at kernelnewbies</a>, I noticed a new feature I had until now overlooked.</p>
<blockquote><p>1.6. Boot tracer</p>
<p>The purpose of this tracer is to helps developers to optimize boot times: it records the timings of the initcalls. Its aim is to be parsed by the scripts/bootgraph.pl tool to produce graphics about boot inefficiencies, giving a visual representation of the delays during initcalls. Users need to enable CONFIG_BOOT_TRACER, boot with the &#8220;initcall_debug&#8221; and &#8220;printk.time=1&#8243; parameters, and run &#8220;dmesg | perl scripts/bootgraph.pl > output.svg&#8221; to generate the final data.</p></blockquote>
<p>Very interesting.</p>
<p>Here&#8217;s what it looks like when I ran it on my eeepc ..</p>
<p><a href="http://www.codemonkey.org.uk/wp-content/uploads/2008/12/bootprofile.png"><br />
<div id="attachment_25" class="wp-caption aligncenter" style="width: 310px"><img src="http://www.codemonkey.org.uk/wp-content/uploads/2008/12/bootprofile-300x133.png" alt="boot tracing output. (click to enlarge)" title="boot tracing output." width="300" height="133" class="size-medium wp-image-25" /><p class="wp-caption-text">boot tracing output.</p></div></a></p>
<p>Looks pretty. Though something isn&#8217;t quite right.<br />
If you look at <a href="/projects/eeepc/eeepc.dmesg">the dmesg output</a>, there are over 400 initcalls.  Even if we ignore all the uninteresting ones that return in 0 usecs, there&#8217;s still over 300 in the log.  What gives?<br />
The script stops parsing once the kernel hands off to the early userspace scripts in initramfs.  So everything from the &#8216;Write protecting the kernel&#8217; message at 8 seconds into the bootup is ignored. (Sidenote: The fact that we&#8217;re taking 8 seconds just to get to this stage _sucks_, more on that another time).  So all the later modules that get loaded aren&#8217;t part of this picture.</p>
<p>My perl is a little rusty so I didn&#8217;t spot how it does it, but it seems there&#8217;s a threshold at which it ignores the initcalls that return quickly. Of those reported in the graph, the &#8216;fastest&#8217; was ehci_hcd_init at 126837.  acpi_init was almost in the same ballpark at 106445, but didn&#8217;t get picked up.</p>
<p>Whilst these big hitters are no doubt damaging to the boot time, it&#8217;s important to note the cumulative effect of all those five-figure initcalls.</p>
<p><a href="http://www.codemonkey.org.uk/2008/12/25/boot-tracing/">Boot tracing.</a> is a post from: <a href="http://www.codemonkey.org.uk">codemonkey.org.uk</a></p>


<p>Related posts:<ol><li><a href='http://www.codemonkey.org.uk/2009/09/16/bootinit-miniconf-plumbers-week/' rel='bookmark' title='Permanent Link: boot/init miniconf at plumbers next week.'>boot/init miniconf at plumbers next week.</a> <small>I&#8217;m MC&#8217;ing the boot/init miniconf next week at the Linux...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.codemonkey.org.uk/2008/12/25/boot-tracing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
