{"id":1515,"date":"2015-07-16T01:41:30","date_gmt":"2015-07-16T00:41:30","guid":{"rendered":"http:\/\/rglinuxtech.com\/?p=1515"},"modified":"2015-07-16T01:41:30","modified_gmt":"2015-07-16T00:41:30","slug":"arm-pi2-to-u-boot","status":"publish","type":"post","link":"https:\/\/rglinuxtech.com\/?p=1515","title":{"rendered":"ARM &#8211; Pi2 to U-Boot.."},"content":{"rendered":"<p>I decided to try <strong>U-Boot<\/strong> on the Raspberry Pi 2, and the process has been fairly well documented in several places..<\/p>\n<p>I used the latest U-Boot, with &#8216;patch&#8217; info from here, as I needed <em>Device Tree<\/em> support:\u00a0 <a href=\"https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?f=29&amp;t=108217.\" target=\"_blank\">https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?f=29&amp;t=108217. <\/a><\/p>\n<p>Actual &#8216;installation&#8217; is simple, as I just copied the u-boot binary to the boot directory on the SD Card, and edited<strong><em> config.txt<\/em> <\/strong>to &#8216;boot&#8217; U-Boot instead of the actual kernel, by changing <strong>kernel=kernel7.img<\/strong> to <strong>kernel=u-boot.bin<\/strong>.<\/p>\n<p>On first boot, the uart\/console output looked like this:<\/p>\n<pre><strong><span style=\"font-family: courier new,courier,monospace;\">U-Boot 2015.07-rc3 (Jul 14 2015 - 13:49:19 -0700)\r\n\r\nDRAM: 880 MiB<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">WARNING: Caches not enabled<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">RPI 2 Model B<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">MMC: bcm2835_sdhci: 0<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">reading uboot.env\r\n\r\n** Unable to read \"uboot.env\" from mmc0:1 **<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">Using default environment\r\n\r\nIn: serial<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">Out: lcd<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">Err: lcd<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">Net: Net Initialization Skipped<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">No ethernet found.<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">Hit any key to stop autoboot: 0<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">U-Boot&gt;\r\n<\/span><\/strong><\/pre>\n<p>After this, I added definitions to set up the necessary boot parameters, etc.:<\/p>\n<pre><strong><span style=\"font-family: courier new,courier,monospace;\">setenv machid 0x00000c42<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">setenv bootargs 'earlyprintk console=tty0 console=ttyAMA0,115200n8 root=\/dev\/mmcblk0p2 rootfstype=ext4 rootwait noinitrd'<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">setenv x_bootcmd_kernel fatload mmc 0:1 ${kernel_addr_r} zImage<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">setenv x_bootcmd_fdt fatload mmc 0:1 ${fdt_addr_r} bcm2709-rpi-2-b.dtb<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">setenv bootcmd '${x_bootcmd_kernel}; ${x_bootcmd_fdt}; bootz ${kernel_addr_r} - ${fdt_addr_r};'\r\n\r\nsaveenv <\/span><\/strong><span style=\"font-family: courier new,courier,monospace;\">(to save the parameter info to <strong><em>uboot.env<\/em><\/strong> on the SD Card)<\/span><\/pre>\n<p>Note that you do not need to explicitly state the kernel and device tree file load addresses, as &#8211; with the patch &#8211; these are already defined in the compiled U-Boot executable (as <strong>kernel_addr_r <\/strong>and <strong>fdt_addr_r <\/strong>respectively).<br \/>\nOf course, there are alternative ways of doing this, but this is a format I have used before with other devices..<\/p>\n<p>I had been booting kernel7.img as an &#8216;uncompressed&#8217; <em>Image<\/em>, but U-Boot expects <em>zImage<\/em> or <em>uImage<\/em> formats, so I changed my compile workflow on the Pi2 accordingly:<\/p>\n<pre><strong><span style=\"font-family: courier new,courier,monospace;\">make -j5 zImage<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">make dtbs<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">make -j5 modules<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">make modules_install<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">make firmware_install<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">cp System.map \/boot<\/span><\/strong>\r\n<strong><span style=\"font-family: courier new,courier,monospace;\">cp arch\/arm\/boot\/dts\/bcm2709-rpi-2-b.dtb \/boot\r\ncp arch\/arm\/boot\/zImage \/boot<\/span><\/strong><\/pre>\n<p>My next project will probably be to see if I can get U-Boot running on the ARM64 HiKey, but that might be a bit premature&#8230;<\/p>\n<p><em>Robert Gadsdon.\u00a0\u00a0 July 15, 2015.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I decided to try U-Boot on the Raspberry Pi 2, and the process has been fairly well documented in several places.. I used the latest U-Boot, with &#8216;patch&#8217; info from here, as I needed Device Tree support:\u00a0 https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?f=29&amp;t=108217. Actual &#8216;installation&#8217; is simple, as I just copied the u-boot binary to the boot directory on the SD Card, <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/rglinuxtech.com\/?p=1515\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[11,16,937],"tags":[1155,120,1154,468,296,1153,1175,372],"class_list":["post-1515","post","type-post","status-publish","format-standard","hentry","category-hacks","category-linux-arm","category-u-boot-2","tag-boot-parameters","tag-compile","tag-device-tree-support","tag-install","tag-patch","tag-rasperry-pi-2","tag-success","tag-u-boot"],"_links":{"self":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/1515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1515"}],"version-history":[{"count":2,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/1515\/revisions"}],"predecessor-version":[{"id":1517,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/1515\/revisions\/1517"}],"wp:attachment":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}