{"id":1329,"date":"2015-07-03T14:11:10","date_gmt":"2015-07-03T14:11:10","guid":{"rendered":"http:\/\/www.dnclabs.com\/?p=1329"},"modified":"2015-07-03T14:11:10","modified_gmt":"2015-07-03T14:11:10","slug":"step-4-build-uboot-hlk-rm04","status":"publish","type":"post","link":"http:\/\/www.dnclabs.com\/?p=1329","title":{"rendered":"Step 4 Build Uboot HLK-RM04"},"content":{"rendered":"<style>\n<!--\n \/* Font Definitions *\/\n @font-face\n\t{font-family:\"Cambria Math\";\n\tpanose-1:2 4 5 3 5 4 6 3 2 4;}\n@font-face\n\t{font-family:Cambria;\n\tpanose-1:2 4 5 3 5 4 6 3 2 4;}\n@font-face\n\t{font-family:Calibri;\n\tpanose-1:2 15 5 2 2 2 4 3 2 4;}\n@font-face\n\t{font-family:Tahoma;\n\tpanose-1:2 11 6 4 3 5 4 4 2 4;}\n@font-face\n\t{font-family:Courier New;\n\tpanose-1:2 11 6 4 3 5 4 4 2 4;}\n \/* Style Definitions *\/\nfixed\n\t{margin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:10.0pt;\n\tmargin-left:0in;\n\tline-height:115%;\n\tfont-size:11.0pt;\n\tfont-family:\"Courier New\",\"monospace\";}\n p.MsoNormal, li.MsoNormal, div.MsoNormal\n\t{margin-top:0in;\n\tmargin-right:0in;\n\tmargin-bottom:10.0pt;\n\tmargin-left:0in;\n\tline-height:115%;\n\tfont-size:11.0pt;\n\tfont-family:\"Calibri\",\"sans-serif\";}\nh1\n\t{mso-style-link:\"Heading 1 Char\";\n\tmargin-top:24.0pt;\n\tmargin-right:0in;\n\tmargin-bottom:0in;\n\tmargin-left:0in;\n\tmargin-bottom:.0001pt;\n\tline-height:115%;\n\tpage-break-after:avoid;\n\tfont-size:14.0pt;\n\tfont-family:\"Cambria\",\"serif\";\n\tcolor:#365F91;}\nh2\n\t{mso-style-link:\"Heading 2 Char\";\n\tmargin-top:10.0pt;\n\tmargin-right:0in;\n\tmargin-bottom:0in;\n\tmargin-left:0in;\n\tmargin-bottom:.0001pt;\n\tline-height:115%;\n\tpage-break-after:avoid;\n\tfont-size:13.0pt;\n\tfont-family:\"Cambria\",\"serif\";\n\tcolor:#4F81BD;}\n-->\n<\/style>\n<p>In this step we install a set of tools that allow you to build the Uboot loader. This is not generally required because I have created two Uboot images for your use. However if you want to change Uboot this tool path installation will let you customize your Linux install. It is also possible to run C code directly from the Uboot loader without even installing Linux.<\/p>\n<h2>Install the Uboot SDK 4.0 source directory<\/h2>\n<p>We need a copy of Uboot so I downloaded the source code from <a href=\"https:\/github.com\/stevenylai\/ralink_sdk\">stevenylai\/ralink_sdk<\/a><br \/>\nThe Uboot version is 1.1.3 while the Ralink SDK version is 4.0.1.0. From a terminal window execute the following commands to create two Uboot images; one for each of the two modules (16M or 32M).<br \/>\n<strong><br \/>\ncp ralink_sdk-master.zip to your desktop<br \/>\ncd Desktop<br \/>\nunzip ralink_sdk-master.zip<br \/>\ncp -r ralink_sdk-master\/Uboot Uboot1.1.3<br \/>\ncd Uboot1.1.3<br \/>\n<\/strong><\/p>\n<h2>Additions to Uboot <\/h2>\n<p>I included the SPI flash definition for the SPI flash used on the Hi-Link module. Edit the \/Uboot1.1.3\/drivers\/spi_flash.c file and add the following line of code (at line 288).<br \/>\n<strong>\t{ &#8220;Pm25LQ032C&#8221;,\t\t0x7f, 0x9D467F9D, 64 * 1024,  64, 0 },<\/strong><\/p>\n<h2>Make Uboot<\/h2>\n<p>On your Linux computer desktop you will have a Uboot4.0 directory after following the Ubuntu installation procedure from the previous step. Using these steps I was able to build the Uboot.img file that was loaded over the factory default module.<\/p>\n<p><strong>Caution: <\/strong>While it is easy to build and modify Uboot it can cause grief if you overwrite the working bootloader. If you want to play in this area make sure you use a system like my test bed (the one with the Flashrom loader in an LPC1343) that allows you to re-flash the SPI no matter what the content is. You absolutely need a way to reprogram the SPI flash to recover from bootloader crashes. <\/p>\n<p>The procedure to build a new Uboot image on a Linux computer or virtual machine is as follows. We start by opening a terminal window and enter the Uboot4.0 directory. For a fresh install you can use the &#8220;make distclean&#8221; option which will compile everything from scratch. It also erases your configuration file so you will need to reset that to your required configuration. To define the specific features of the Uboot build use &#8220;make menuconfig&#8221; and select the following features. Make sure you build for your modules memory size. I recommend only buying the 32M modules because it allows for more complex features without hitting any memory limits. The 16M system is marginal for anything but light weight applications.<\/p>\n<h2>UART WIFI Module (16Mbyte)<\/h2>\n<p><a href=\"http:\/\/www.dnclabs.com\/wp-content\/uploads\/2015\/07\/HLK_RM04-16M.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.dnclabs.com\/wp-content\/uploads\/2015\/07\/HLK_RM04-16M-150x150.jpg\" alt=\"HLK_RM04 16M\" width=\"150\" height=\"150\" class=\"alignleft size-thumbnail wp-image-1333\" \/><\/a><br \/>\n<a href=\"http:\/\/www.hlktech.net\/product_detail.php?ProId=39\">16M HLK-RM04 supplier<\/a><\/p>\n<p>(ASIC) Chip Type<br \/>\n(RT5350) Chip ID<br \/>\n(128Mb) DRAM Component<br \/>\n4Mbyte SPI FLASH<br \/>\n16Mbyte DRAM<br \/>\n2 UART<\/p>\n<h2>UART WIFI Module-B (32Mbyte)<\/h2>\n<p><a href=\"http:\/\/www.dnclabs.com\/wp-content\/uploads\/2015\/07\/HLK_RM04-32M.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.dnclabs.com\/wp-content\/uploads\/2015\/07\/HLK_RM04-32M-150x150.jpg\" alt=\"HLK_RM04 32M\" width=\"150\" height=\"150\" class=\"alignleft size-thumbnail wp-image-1334\" \/><\/a><br \/>\n<a href=\"http:\/\/www.hlktech.net\/product_detail.php?ProId=49\">32M HLK-RM04<\/a><\/p>\n<p>(ASIC) Chip Type<br \/>\n(RT5350) Chip ID<br \/>\n(256Mb) DRAM Component<br \/>\n8Mbyte SPI FLASH<br \/>\n32Mbyte DRAM<br \/>\n2 UART<\/p>\n<p>Then you can exit and save these options. Follow this with the &#8220;make&#8221; instruction to build Uboot.<br \/>\n<a href=\"http:\/\/www.dnclabs.com\/wp-content\/uploads\/2015\/07\/Uboot_menuconfig.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.dnclabs.com\/wp-content\/uploads\/2015\/07\/Uboot_menuconfig-300x173.png\" alt=\"Uboot_menuconfig\" width=\"300\" height=\"173\" class=\"aligncenter size-medium wp-image-1335\" srcset=\"http:\/\/www.dnclabs.com\/wp-content\/uploads\/2015\/07\/Uboot_menuconfig-300x173.png 300w, http:\/\/www.dnclabs.com\/wp-content\/uploads\/2015\/07\/Uboot_menuconfig.png 706w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n<strong><br \/>\ncd \/ Uboot1.1.3<br \/>\nmake distclean<br \/>\nmake menuconfig (use these ASIC,RT5350,128Mb)<br \/>\nmake<br \/>\ncp uboot.img uboot16M.img<\/p>\n<p>make menuconfig (use these ASIC,RT5350,256Mb)<br \/>\nmake<br \/>\ncp uboot.img uboot32M.img<br \/>\n<\/strong><br \/>\nThe final uboot.img file is located in the <strong>\/Uboot1.1.3<\/strong> directory.<\/p>\n<p><a href=\"http:\/\/www.dnclabs.com\/wp-content\/uploads\/2015\/07\/uboot32M.txt\">uboot32M<\/a>(rename <strong>.txt<\/strong> to <strong>.img<\/strong>)<br \/>\n<a href=\"http:\/\/www.dnclabs.com\/wp-content\/uploads\/2015\/07\/uboot16M.txt\">uboot16M<\/a>(rename <strong>.txt<\/strong> to <strong>.img<\/strong>)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this step we install a set of tools that allow you to build the Uboot loader. This is not generally required because I have created two Uboot images for your use. However if you want to change Uboot this&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/www.dnclabs.com\/?p=1329\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1329","post","type-post","status-publish","format-standard","hentry","category-embedded-linux"],"_links":{"self":[{"href":"http:\/\/www.dnclabs.com\/index.php?rest_route=\/wp\/v2\/posts\/1329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.dnclabs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.dnclabs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.dnclabs.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.dnclabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1329"}],"version-history":[{"count":10,"href":"http:\/\/www.dnclabs.com\/index.php?rest_route=\/wp\/v2\/posts\/1329\/revisions"}],"predecessor-version":[{"id":1347,"href":"http:\/\/www.dnclabs.com\/index.php?rest_route=\/wp\/v2\/posts\/1329\/revisions\/1347"}],"wp:attachment":[{"href":"http:\/\/www.dnclabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.dnclabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1329"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.dnclabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}