]> pere.pagekite.me Git - homepage.git/blobdiff - blog/index.rss
Generated.
[homepage.git] / blog / index.rss
index 37e7be10ed7b24c69486add91768fc143d2be2f3..023ed5c10b4d4a4193b8d343a676afe9b6a01c7a 100644 (file)
@@ -6,6 +6,119 @@
                 <link>http://people.skolelinux.org/pere/blog/</link>
                 <atom:link href="http://people.skolelinux.org/pere/blog/index.rss" rel="self" type="application/rss+xml" />
        
+       <item>
+               <title>Teaching vmdebootstrap to create Raspberry Pi SD card images</title>
+               <link>http://people.skolelinux.org/pere/blog/Teaching_vmdebootstrap_to_create_Raspberry_Pi_SD_card_images.html</link>
+               <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Teaching_vmdebootstrap_to_create_Raspberry_Pi_SD_card_images.html</guid>
+                <pubDate>Sun, 27 Oct 2013 17:00:00 +0100</pubDate>
+               <description>&lt;p&gt;The
+&lt;a href=&quot;http://packages.qa.debian.org/v/vmdebootstrap.html&quot;&gt;vmdebootstrap&lt;/a&gt;
+program is a a very nice system to create virtual machine images.  It
+create a image file, add a partition table, mount it and run
+debootstrap in the mounted directory to create a Debian system on a
+stick.  Yesterday, I decided to try to teach it how to make images for
+&lt;a href=&quot;https://wiki.debian.org/RaspberryPi&quot;&gt;Raspberry Pi&lt;/a&gt;, as part
+of a plan to simplify the build system for the FreedomBox project.
+The FreedomBox project already uses vmdebootstrap for the virtualbox
+images, but its home made multistrap based system for Dreamplug
+images, and it is lacking support for Raspberry Pi.&lt;/p&gt;
+
+&lt;p&gt;Armed with the knowledge on how to build &quot;foreign&quot; (aka non-native
+architecture) chroots for Raspberry Pi, I dived into the vmdebootstrap
+code and adjusted it to be able to build armel images on my amd64
+Debian laptop.  I ended up giving vmdebootstrap five new options,
+allowing me to replicate the image creation process I use to make
+&lt;a href=http://people.skolelinux.org/pere/blog/A_Raspberry_Pi_based_batman_adv_Mesh_network_node.html&quot;&quot;&gt;Debian
+Jessie based mesh node images for the Raspberry Pi&lt;/a&gt;.  First, the
+&lt;tt&gt;--foreign /path/to/binfm_handler&lt;/tt&gt; option tell vmdebootstrap to
+call debootstrap with --foreign and to copy the handler into the
+generated chroot before running the second stage.  This allow
+vmdebootstrap to create armel images on an amd64 host.  Next I added
+two new options &lt;tt&gt;--bootsize size&lt;/tt&gt; and &lt;tt&gt;--boottype
+fstype&lt;/tt&gt; to teach it to create a separate /boot/ partition with the
+given file system type, allowing me to create an image with a vfat
+partition for the /boot/ stuff.  I also added a &lt;tt&gt;--variant
+variant&lt;/tt&gt; option to allow me to create smaller images without the
+Debian base system packages installed.  Finally, I added an option
+&lt;tt&gt;--no-extlinux&lt;/tt&gt; to tell vmdebootstrap to not install extlinux
+as a boot loader.  It is not needed on the Raspberry Pi and probably
+most other non-x86 architectures.  The changes were accepted by the
+upstream author of vmdebootstrap yesterday and today, and is now
+available from
+&lt;a href=&quot;http://git.liw.fi/cgi-bin/cgit/cgit.cgi/vmdebootstrap/&quot;&gt;the
+upstream project page&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;To use it to build a Raspberry Pi image using Debian Jessie, first
+create a small script (the customize script) to add the non-free
+binary blob needed to boot the Raspberry Pi and the APT source
+list:&lt;/p&gt;
+
+&lt;p&gt;&lt;pre&gt;
+#!/bin/sh
+set -e # Exit on first error
+rootdir=&quot;$1&quot;
+cd &quot;$rootdir&quot;
+cat &lt;&lt;EOF &gt; etc/apt/sources.list
+deb http://http.debian.net/debian/ jessie main contrib non-free
+EOF
+# Install non-free binary blob needed to boot Raspberry Pi.  This
+# install a kernel somewhere too.
+wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update \
+    -O $rootdir/usr/bin/rpi-update
+chmod a+x $rootdir/usr/bin/rpi-update
+mkdir -p $rootdir/lib/modules
+touch $rootdir/boot/start.elf
+chroot $rootdir rpi-update
+&lt;/pre&gt;&lt;/p&gt;
+
+&lt;p&gt;Next, fetch the latest vmdebootstrap script and call it like this
+to build the image:&lt;/p&gt;
+
+&lt;pre&gt;
+sudo ./vmdebootstrap \
+    --variant minbase \
+    --arch armel \
+    --distribution jessie \
+    --mirror http://http.debian.net/debian \
+    --image test.img \
+    --size 600M \
+    --bootsize 64M \
+    --boottype vfat \
+    --log-level debug \
+    --verbose \
+    --no-kernel \
+    --no-extlinux \
+    --root-password raspberry \
+    --hostname raspberrypi \
+    --foreign /usr/bin/qemu-arm-static \
+    --customize `pwd`/customize \
+    --package netbase \
+    --package git-core \
+    --package binutils \
+    --package ca-certificates \
+    --package wget \
+    --package kmod
+&lt;/pre&gt;&lt;/p&gt;
+
+&lt;p&gt;The list of packages being installed are the ones needed by
+rpi-update to make the image bootable on the Raspberry Pi, with the
+exception of netbase, which is needed by debootstrap to find
+/etc/hosts with the minbase variant.  I really wish there was a way to
+set up an Raspberry Pi using only packages in the Debian archive, but
+that is not possible as far as I know, because it boots from the GPU
+using a non-free binary blob.&lt;/p&gt;
+
+&lt;p&gt;The build host need debootstrap, kpartx and qemu-user-static and
+probably a few others installed.  I have not checked the complete
+build dependency list.&lt;/p&gt;
+
+&lt;p&gt;The resulting image will not use the hardware floating point unit
+on the Raspberry PI, because the armel architecture in Debian is not
+optimized for that use.  So the images created will be a bit slower
+than &lt;a href=&quot;http://www.raspbian.org/&quot;&gt;Raspbian&lt;/a&gt; based images.&lt;/p&gt;
+</description>
+       </item>
+       
        <item>
                <title>Det er jo makta som er mest sårbar ved massiv overvåkning av Internett</title>
                <link>http://people.skolelinux.org/pere/blog/Det_er_jo_makta_som_er_mest_s_rbar_ved_massiv_overv_kning_av_Internett.html</link>
@@ -557,135 +670,5 @@ directory.&lt;/p&gt;
 </description>
        </item>
        
-       <item>
-               <title>Recipe to test the Freedombox project on amd64 or Raspberry Pi</title>
-               <link>http://people.skolelinux.org/pere/blog/Recipe_to_test_the_Freedombox_project_on_amd64_or_Raspberry_Pi.html</link>
-               <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Recipe_to_test_the_Freedombox_project_on_amd64_or_Raspberry_Pi.html</guid>
-                <pubDate>Tue, 10 Sep 2013 14:20:00 +0200</pubDate>
-               <description>&lt;p&gt;I was introduced to the
-&lt;a href=&quot;http://www.freedomboxfoundation.org/&quot;&gt;Freedombox project&lt;/a&gt;
-in 2010, when Eben Moglen presented his vision about serving the need
-of non-technical people to keep their personal information private and
-within the legal protection of their own homes.  The idea is to give
-people back the power over their network and machines, and return
-Internet back to its intended peer-to-peer architecture.  Instead of
-depending on a central service, the Freedombox will give everyone
-control over their own basic infrastructure.&lt;/p&gt;
-
-&lt;p&gt;I&#39;ve intended to join the effort since then, but other tasks have
-taken priority.  But this summers nasty news about the misuse of trust
-and privilege exercised by the &quot;western&quot; intelligence gathering
-communities increased my eagerness to contribute to a point where I
-actually started working on the project a while back.&lt;/p&gt;
-
-&lt;p&gt;The &lt;a href=&quot;https://alioth.debian.org/projects/freedombox/&quot;&gt;initial
-Debian initiative&lt;/a&gt; based on the vision from Eben Moglen, is to
-create a simple and cheap Debian based appliance that anyone can hook
-up in their home and get access to secure and private services and
-communication.  The initial deployment platform have been the
-&lt;a href=&quot;http://www.globalscaletechnologies.com/t-dreamplugdetails.aspx&quot;&gt;Dreamplug&lt;/a&gt;,
-which is a piece of hardware I do not own.  So to be able to test what
-the current Freedombox setup look like, I had to come up with a way to install
-it on some hardware I do have access to.  I have rewritten the
-&lt;a href=&quot;https://github.com/NickDaly/freedom-maker&quot;&gt;freedom-maker&lt;/a&gt;
-image build framework to use .deb packages instead of only copying
-setup into the boot images, and thanks to this rewrite I am able to
-set up any machine supported by Debian Wheezy as a Freedombox, using
-the previously mentioned deb (and a few support debs for packages
-missing in Debian).&lt;/p&gt;
-
-&lt;p&gt;The current Freedombox setup consist of a set of bootstrapping
-scripts
-(&lt;a href=&quot;https://github.com/petterreinholdtsen/freedombox-setup&quot;&gt;freedombox-setup&lt;/a&gt;),
-and a administrative web interface
-(&lt;a href=&quot;https://github.com/NickDaly/Plinth&quot;&gt;plinth&lt;/a&gt; + exmachina +
-withsqlite), as well as a privacy enhancing proxy based on
-&lt;a href=&quot;http://packages.qa.debian.org/privoxy&quot;&gt;privoxy&lt;/a&gt;
-(freedombox-privoxy).  There is also a web/javascript based XMPP
-client (&lt;a href=&quot;http://packages.qa.debian.org/jwchat&quot;&gt;jwchat&lt;/a&gt;)
-trying (unsuccessfully so far) to talk to the XMPP server
-(&lt;a href=&quot;http://packages.qa.debian.org/ejabberd&quot;&gt;ejabberd&lt;/a&gt;).  The
-web interface is pluggable, and the goal is to use it to enable OpenID
-services, mesh network connectivity, use of TOR, etc, etc.  Not much of
-this is really working yet, see
-&lt;a href=&quot;https://github.com/NickDaly/freedombox-todos/blob/master/TODO&quot;&gt;the
-project TODO&lt;/a&gt; for links to GIT repositories.  Most of the code is
-on github at the moment.  The HTTP proxy is operational out of the
-box, and the admin web interface can be used to add/remove plinth
-users.  I&#39;ve not been able to do anything else with it so far, but
-know there are several branches spread around github and other places
-with lots of half baked features.&lt;/p&gt;
-
-&lt;p&gt;Anyway, if you want to have a look at the current state, the
-following recipes should work to give you a test machine to poke
-at.&lt;/p&gt;
-
-&lt;p&gt;&lt;strong&gt;Debian Wheezy amd64&lt;/strong&gt;&lt;/p&gt;
-
-&lt;ol&gt;
-
-&lt;li&gt;Fetch normal Debian Wheezy installation ISO.&lt;/li&gt;
-&lt;li&gt;Boot from it, either as CD or USB stick.&lt;/li&gt;
-&lt;li&gt;&lt;p&gt;Press [tab] on the boot prompt and add this as a boot argument
-to the Debian installer:&lt;p&gt;
-&lt;pre&gt;url=&lt;a href=&quot;http://www.reinholdtsen.name/freedombox/preseed-wheezy.dat&quot;&gt;http://www.reinholdtsen.name/freedombox/preseed-wheezy.dat&lt;/a&gt;&lt;/pre&gt;&lt;/li&gt;
-
-&lt;li&gt;Answer the few language/region/password questions and pick disk to
-install on.&lt;/li&gt;
-
-&lt;li&gt;When the installation is finished and the machine have rebooted a
-few times, your Freedombox is ready for testing.&lt;/li&gt;
-
-&lt;/ol&gt;
-
-&lt;p&gt;&lt;strong&gt;Raspberry Pi Raspbian&lt;/strong&gt;&lt;/p&gt;
-
-&lt;ol&gt;
-
-&lt;li&gt;Fetch a Raspbian SD card image, create SD card.&lt;/li&gt;
-&lt;li&gt;Boot from SD card, extend file system to fill the card completely.&lt;/li&gt;
-&lt;li&gt;&lt;p&gt;Log in and add this to /etc/sources.list:&lt;/p&gt;
-&lt;pre&gt;
-deb &lt;a href=&quot;http://www.reinholdtsen.name/freedombox/&quot;&gt;http://www.reinholdtsen.name/freedombox&lt;/a&gt; wheezy main
-&lt;/pre&gt;&lt;/li&gt;
-&lt;li&gt;&lt;p&gt;Run this as root:&lt;/p&gt;
-&lt;pre&gt;
-wget -O - http://www.reinholdtsen.name/freedombox/BE1A583D.asc | \
-   apt-key add -
-apt-get update
-apt-get install freedombox-setup
-/usr/lib/freedombox/setup
-&lt;/pre&gt;&lt;/li&gt;
-&lt;li&gt;Reboot into your freshly created Freedombox.&lt;/li&gt;
-
-&lt;/ol&gt;
-
-&lt;p&gt;You can test it on other architectures too, but because the
-freedombox-privoxy package is binary, it will only work as intended on
-the architectures where I have had time to build the binary and put it
-in my APT repository.  But do not let this stop you.  It is only a
-short &quot;&lt;tt&gt;apt-get source -b freedombox-privoxy&lt;/tt&gt;&quot; away. :)&lt;/p&gt;
-
-&lt;p&gt;Note that by default Freedombox is a DHCP server on the
-192.168.1.0/24 subnet, so if this is your subnet be careful and turn
-off the DHCP server by running &quot;&lt;tt&gt;update-rc.d isc-dhcp-server
-disable&lt;/tt&gt;&quot; as root.&lt;/p&gt;
-
-&lt;p&gt;Please let me know if this works for you, or if you have any
-problems.  We gather on the IRC channel
-&lt;a href=&quot;irc://irc.debian.org:6667/%23freedombox&quot;&gt;#freedombox&lt;/a&gt; on
-irc.debian.org and the
-&lt;a href=&quot;http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/freedombox-discuss&quot;&gt;project
-mailing list&lt;/a&gt;.&lt;/p&gt;
-
-&lt;p&gt;Once you get your freedombox operational, you can visit
-&lt;tt&gt;http://your-host-name:8001/&lt;/tt&gt; to see the state of the plint
-welcome screen (dead end - do not be surprised if you are unable to
-get past it), and next visit &lt;tt&gt;http://your-host-name:8001/help/&lt;/tt&gt;
-to look at the rest of plinth.  The default user is &#39;admin&#39; and the
-default password is &#39;secret&#39;.&lt;/p&gt;
-</description>
-       </item>
-       
         </channel>
 </rss>