{"id":704,"date":"2013-04-23T17:40:31","date_gmt":"2013-04-23T15:40:31","guid":{"rendered":"\/\/www.mcgill.org.za\/stuff\/?p=704"},"modified":"2013-04-23T17:46:44","modified_gmt":"2013-04-23T15:46:44","slug":"compiling-netgear-firmware","status":"publish","type":"post","link":"https:\/\/www.mcgill.org.za\/stuff\/archives\/704","title":{"rendered":"Compiling Netgear Firmware"},"content":{"rendered":"<p>Having ranted about Netgear&#8217;s terrible support for their old stuff, I have finally managed after many moons to recompile the software they provide, so that I can brick my router.\u00a0 The trick is to do the compiling as <strong>root<\/strong> on an <strong>old system<\/strong> &#8211; and lacking an old system, a virtual machine, installed with old software.<\/p>\n<p>Netgear made supplied source code for a stack of their firmware for download in terms of the GPL &#8211; <a title=\"Netgear GPL open source firmware\" href=\"http:\/\/kb.netgear.com\/app\/answers\/detail\/a_id\/2649\" target=\"_blank\">link<\/a>.\u00a0 Compiling this proved to be difficult, nay, impossible on my system, since the compiler and build environment have moved on, and now detect buffer overflows in the source code.<\/p>\n<p>Here&#8217;s how it&#8217;s done:<\/p>\n<ol>\n<li>Download a copy of CentOS 4 &#8211; <a title=\"CentOS 4 ISO download\" href=\"http:\/\/vault.centos.org\/4.9\/isos\/i386\/\">http:\/\/vault.centos.org\/4.9\/isos\/i386\/ <\/a>&#8211; the i386 DVD works &#8211; YMMV with others.\u00a0 You might be able to do this on Debian 4, but I could <em>not <\/em>obtain a copy of Debian 4 &#8211; there&#8217;s a torrent, but it&#8217;s mostly unseeded, and there&#8217;s an archive, but it&#8217;s empty in a few important parts.<\/li>\n<li>Run virt-manager, and create a new machine with the installation DVD.\u00a0 Configure the virtual machine with 1Gb of RAM, 8GB of disk (although if you&#8217;re sloppy and install too much junk, then you won&#8217;t have space for the build system).<\/li>\n<li>For the software selection, select &#8220;Workstation&#8221; so that you get the software development tools, and deselect Gnome and Office so that your virtual disk is not filled with junk.<\/li>\n<\/ol>\n<p>Once you have a working virtual machine, you have support for gcc-3.4.6 and some relatively ancient version of make that the Netgear developers used.<\/p>\n<p>Since this is a virtual machine, you can do junk as root, and only cry a little if it breaks. Here&#8217;s how to download a particular firmware image:<\/p>\n<pre>\r\nwget http:\/\/www.downloads.netgear.com\/files\/GPL\/DGN1000_V1.1.00.45_WW_src.tar.bz2.zip\r\nunzip DGN1000_V1.1.00.45_WW_src.tar.bz2.zip\r\ntar -xjf DGN1000_V1.1.00.45_WW_src.tar.bz2\r\n<\/pre>\n<p>And to rebuild the toolchain and firmware without modifications:<\/p>\n<pre>\r\nNETGEAR=\/root\/DGN1000_V1.1.00.45_WW_src\r\ncd $NETGEAR\r\ntar -zxf bootloader_src.tgz\r\ntar -zxf toolchain_uclibc_src.tgz\r\ntar -zxf target.tgz\r\ncd $NETGEAR\/Toolchain\/uclibc_toolchain\/ifx-lxdb26-1.0.2\r\n.\/setup.sh all redo\r\ncd $NETGEAR\/Toolchain\/uclibc_toolchain\/ifx-lxdb26-1.0.2\/source\/hostutils\/sqlzma\/sq3.2-r2-lzma443\r\nmake ;\r\n.\/build.sh ..\/..\/..\/..\/hostutils\r\ncd $NETGEAR\/uclibc_toolchain_src\/buildroot\r\ncp config .config &amp;&amp;\r\nmake oldconfig\r\nmake\r\ncd $NETGEAR\/\r\nmake\r\n<\/pre>\n<p>That gives you newimage.img which is hopefully 4Mb large, or something supported by your device&#8217;s hardware. If it&#8217;s bigger, you have a problem, which you fix.\u00a0 Wish me yuck as I download it to my <strong>ECONNREFUSED: no route to host<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Having ranted about Netgear&#8217;s terrible support for their old stuff, I have finally managed after many moons to recompile the software they provide, so that I can brick my router.\u00a0 The trick is to do the compiling as root on &hellip; <a href=\"https:\/\/www.mcgill.org.za\/stuff\/archives\/704\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[98,53,58,73,33,190],"class_list":["post-704","post","type-post","status-publish","format-standard","hentry","category-stuff","tag-centos","tag-debian","tag-hacks","tag-netgear","tag-networking","tag-stuff"],"_links":{"self":[{"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/posts\/704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/comments?post=704"}],"version-history":[{"count":7,"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/posts\/704\/revisions"}],"predecessor-version":[{"id":711,"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/posts\/704\/revisions\/711"}],"wp:attachment":[{"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/media?parent=704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/categories?post=704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/tags?post=704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}