{"id":305,"date":"2018-01-12T22:19:07","date_gmt":"2018-01-12T21:19:07","guid":{"rendered":"http:\/\/blog.le-vert.net\/?p=305"},"modified":"2020-09-09T13:43:04","modified_gmt":"2020-09-09T11:43:04","slug":"pxe-boot-debian-installer-with-firmwares","status":"publish","type":"post","link":"https:\/\/blog.le-vert.net\/?p=305","title":{"rendered":"PXE boot Debian installer with firmwares"},"content":{"rendered":"<div class=\"twttr_buttons\"><div class=\"twttr_twitter\">\n\t\t\t\t\t<a href=\"http:\/\/twitter.com\/share?text=PXE+boot+Debian+installer+with+firmwares\" class=\"twitter-share-button\" data-via=\"\" data-hashtags=\"\"  data-size=\"default\" data-url=\"https:\/\/blog.le-vert.net\/?p=305\"  data-related=\"\" target=\"_blank\">Tweet<\/a>\n\t\t\t\t<\/div><\/div><p>This article is mostly a reminder for me but might be useful to others.<\/p>\n<h1>1. Install\/prepare TFTP server<\/h1>\n<p>First we need a tftp server (with symlink support is better) and a network bootloader (pxelinux)<\/p>\n<pre class=\"crayon:false\">apt install tftpd syslinux-common pxelinux\n<\/pre>\n<p>Then will link the minimum files required to display a text menu for our PXE entries<\/p>\n<pre class=\"crayon:false\">ln -s \/usr\/lib\/PXELINUX\/pxelinux.0                \/srv\/tftp\/\nln -s \/usr\/lib\/syslinux\/modules\/bios\/ldlinux.c32  \/srv\/tftp\/\nln -s \/usr\/lib\/syslinux\/modules\/bios\/libutil.c32  \/srv\/tftp\/\nln -s \/usr\/lib\/syslinux\/modules\/bios\/menu.c32     \/srv\/tftp\/\n<\/pre>\n<p>And a default menu booting normally after a 5 seconds timeout<\/p>\n<pre class=\"crayon:false crayon-selected\">mkdir \/srv\/tftp\/pxelinux.cfg\n\ncat &lt;&lt; 'EOF' &gt; \/srv\/tftp\/pxelinux.cfg\/default\nDEFAULT menu.c32\n\nLABEL Normal boot\nLOCALBOOT 0\n\nPROMPT 0\nTIMEOUT 50\nEOF\n<\/pre>\n<h1>Additional keymaps<\/h1>\n<p>For luxembourgish, swiss people or whoever may use different keyboard layouts, will add ability to select a keymap (in case you want to edit an existing boot entry):<\/p>\n<p>We need lilo here because it includes a (broken) tool to create syslinux compatible keymaps.<\/p>\n<pre class=\"crayon:false\">apt install kbd console-data lilo\n<\/pre>\n<p>Patch the broken keytab-lilo tool using the following diff (found at <a href=\"https:\/\/bugzilla.syslinux.org\/show_bug.cgi?id=68\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/bugzilla.syslinux.org\/show_bug.cgi?id=68<\/a>)<\/p>\n<pre class=\"crayon:false\">--- orig\t2016-07-15 22:14:28.000000000 +0200\n+++ new\t\t2018-01-12 21:37:16.349203039 +0100\n@@ -44,9 +44,9 @@\n     $empty = 1;\n     while () {\n \tchop;\n-\tif (\/^(static\\s+)?u_short\\s+(\\S+)_map\\[\\S*\\]\\s+=\\s+{\\s*$\/) {\n+\tif (\/^(static\\s+)?(u_|unsigned )short\\s+(\\S+)_map\\[\\S*\\]\\s+=\\s+{\\s*$\/) {\n \t    die \"active at beginning of  map\" if defined $current;\n-\t    $current = $pfx.\":\".$2;\n+\t    $current = $pfx.\":\".$3;\n \t    next;\n \t}\n \tundef $current if \/^};\\s*$\/;\nEOF\n<\/pre>\n<p>Create the keymap you want (french azerty here and swiss qwertz with french variant).<br \/>\nFor then french azerty I found a few additional remaping here: <a href=\"https:\/\/forums.archlinux.fr\/viewtopic.php?t=11953\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/forums.archlinux.fr\/viewtopic.php?t=11953<\/a><\/p>\n<pre class=\"crayon:false\">mkdir \/srv\/tftp\/keymaps\nkeytab-lilo -p 60=46 -p 92=60 -p 124=62 \\\n            \/usr\/share\/keymaps\/i386\/qwerty\/us.kmap.gz \\\n            \/usr\/share\/keymaps\/i386\/azerty\/fr-latin1.kmap.gz \\\n            &gt; \/srv\/tftp\/keymaps\/fr.ktl\nkeytab-lilo \/usr\/share\/keymaps\/i386\/qwerty\/us.kmap.gz \\\n            \/usr\/share\/keymaps\/i386\/qwertz\/fr_CH-latin1.kmap.gz \\\n            &gt; \/srv\/tftp\/keymaps\/fr-ch.ktl\n<\/pre>\n<p>Uninstall lilo:<\/p>\n<pre class=\"crayon:false\">apt purge lilo<\/pre>\n<p>And add entry in the menu to select an alternative keymap<\/p>\n<pre class=\"crayon:false\">ln -s \/usr\/lib\/syslinux\/modules\/bios\/kbdmap.c32  \/srv\/tftp\/\nln -s \/usr\/lib\/syslinux\/modules\/bios\/libcom32.c32  \/srv\/tftp\/\ncat &lt;&lt; 'EOF' &gt;&gt; \/srv\/tftp\/pxelinux.cfg\/default\n\nLABEL Switch to french AZERTY\nKERNEL kbdmap.c32\nAPPEND keymaps\/fr.ktl\n\nLABEL Switch to swiss french QWERTZ\nKERNEL kbdmap.c32\nAPPEND keymaps\/fr-ch.ktl\nEOF\n<\/pre>\n<h1>Debian installer with non-free firmware<\/h1>\n<p>Extract kernel and initrd from the Debian netboot archive:<\/p>\n<pre class=\"crayon:false\">mkdir \/srv\/tftp\/debian-stretch-amd64-netinstall\nwget -q -O- http:\/\/ftp.fr.debian.org\/debian\/dists\/stretch\/main\/installer-amd64\/current\/images\/netboot\/netboot.tar.gz \\\n  | tar xvz -C \/srv\/tftp\/debian-stretch-amd64-netinstall\/ \\\n            .\/debian-installer\/amd64\/initrd.gz \\\n            .\/debian-installer\/amd64\/linux \\\n            --strip-components=3\n<\/pre>\n<p>Download firmware file and append to original initrd:<\/p>\n<pre class=\"crayon:false\">wget -q -O \/srv\/tftp\/debian-stretch-amd64-netinstall\/firmware.cpio.gz \\\n  http:\/\/cdimage.debian.org\/cdimage\/unofficial\/non-free\/firmware\/stretch\/current\/firmware.cpio.gz\n\ncat \/srv\/tftp\/debian-stretch-amd64-netinstall\/initrd.gz \\\n    \/srv\/tftp\/debian-stretch-amd64-netinstall\/firmware.cpio.gz \\\n    &gt; \/srv\/tftp\/debian-stretch-amd64-netinstall\/initrd_firmware.gz\n<\/pre>\n<p>And add it to the boot menu:<\/p>\n<pre class=\"crayon:false\">cat &lt;&lt; 'EOF' &gt;&gt; \/srv\/tftp\/pxelinux.cfg\/default\n\nLABEL Debian Stretch NetInstall (firmware) amd64\nKERNEL debian-stretch-amd64-netinstall\/linux\nAPPEND initrd=debian-stretch-amd64-netinstall\/initrd_firmware.gz\nEOF\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This article is mostly a reminder for me but might be useful to others. 1. Install\/prepare TFTP server First we need a tftp server (with symlink support is better) and a network bootloader (pxelinux) apt install tftpd syslinux-common pxelinux Then &hellip; <a href=\"https:\/\/blog.le-vert.net\/?p=305\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.le-vert.net\/index.php?rest_route=\/wp\/v2\/posts\/305"}],"collection":[{"href":"https:\/\/blog.le-vert.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.le-vert.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.le-vert.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.le-vert.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=305"}],"version-history":[{"count":14,"href":"https:\/\/blog.le-vert.net\/index.php?rest_route=\/wp\/v2\/posts\/305\/revisions"}],"predecessor-version":[{"id":364,"href":"https:\/\/blog.le-vert.net\/index.php?rest_route=\/wp\/v2\/posts\/305\/revisions\/364"}],"wp:attachment":[{"href":"https:\/\/blog.le-vert.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.le-vert.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.le-vert.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}