{"id":1350,"date":"2014-01-23T09:32:24","date_gmt":"2014-01-23T14:32:24","guid":{"rendered":"http:\/\/yuguangzhang.com\/blog\/?p=1350"},"modified":"2015-11-19T09:51:43","modified_gmt":"2015-11-19T14:51:43","slug":"gentoo-on-sabre-lite","status":"publish","type":"post","link":"http:\/\/yuguangzhang.com\/blog\/gentoo-on-sabre-lite\/","title":{"rendered":"Gentoo on SABRE Lite"},"content":{"rendered":"<p>I recently received several <a href=\"http:\/\/boundarydevices.com\/products\/sabre-lite-imx6-sbc\/\">SABRE Lite BD-SL-i.MX6 boards<\/a> for running ARM benchmarks on <a href=\"https:\/\/datamill.uwaterloo.ca\/\">DataMill<\/a>. To install Gentoo on it, you need a USB-to-serial cable converter. It came with a 4GB SD card, which is large enough to get you started.<br \/>\nOverview of the installation:<\/p>\n<ul>\n<li>Reset board and format SD card (optional)<\/li>\n<li>Compile kernel with btrfs support (optional)<\/li>\n<li>Copy boot script and kernel<\/li>\n<li>Extract stage3 and portage snapshot<\/li>\n<li>Configure the install<\/li>\n<li>Backup and clone (optional)<\/li>\n<\/ul>\n<h3>Reset board and format SD card<\/h3>\n<p>When I first tried to boot images extracted to the SD card on the board, it always got stuck at the U-Boot prompt. It turned out that there were environment variables left over from previous uses for these boards. Here is the way to reset board variables:<br \/>\n<code><br \/>\nU-Boot > run clearenv<br \/>\nU-Boot > reset<br \/>\n<\/code><br \/>\nAfter I managed to boot Linux images on it, I went onto formatting the card for a Gentoo install. I used sfdisk so that formatting can be scripted with a file which I saved as <tt>mmc_partitions<\/tt>:<br \/>\n<code><br \/>\n# partition table of \/dev\/sdd<br \/>\nunit: sectors<\/p>\n<p>\/dev\/sdd1 : start=     2048, size=   102400, Id=83<br \/>\n\/dev\/sdd2 : start=   104448, size=  7669760, Id=83<br \/>\n\/dev\/sdd3 : start=        0, size=        0, Id= 0<br \/>\n\/dev\/sdd4 : start=        0, size=        0, Id= 0<br \/>\n<\/code><br \/>\nI formatted the second partition as btrfs so that compression could be used on the small SD card. You may want to format it as ext3 to save time. If you have problems getting it to boot, check to make sure your btrfs-progs are not newer than the btrfs version the kernel is built to support. <tt>sys-fs\/btrfs-progs-0.20_rc1<\/tt> worked for the January 2014 kernel source.<br \/>\n<code><br \/>\n# sfdisk -f \/dev\/sdd < mmc_partitions\n# mkfs.btrfs -f \/dev\/sdd2 &#038;&#038; mkfs.ext2 \/dev\/sdd1\n<\/code><\/p>\n<h3>Compile kernel with btrfs support<\/h3>\n<p>The git tree for the kernel is available at <a href=\"https:\/\/github.com\/boundarydevices\/linux-imx6\/\">https:\/\/github.com\/boundarydevices\/linux-imx6\/<\/a>. There are two main branches, one for Android and one for non-Android. Use the most recent one for non-Android.<br \/>\n<code><br \/>\n# wget https:\/\/github.com\/boundarydevices\/linux-imx6\/archive\/boundary-imx_3.0.35_4.1.0.zip<br \/>\n# unzip boundary-imx_3.0.35_4.1.0.zip<br \/>\n# cd linux-imx6-boundary-imx_3.0.35_4.0.0<br \/>\n# make ARCH=arm imx6_defconfig<br \/>\n# vim .config<br \/>\n<\/code><br \/>\nMake the following changes to the kernel config:<br \/>\n<code><br \/>\nCONFIG_DEVTMPFS=y<br \/>\nCONFIG_BTRFS_FS=y<br \/>\nCONFIG_CRYPTO_CRC32C=y<br \/>\nCONFIG_LIBCRC32C=y<br \/>\n<\/code><br \/>\nGentoo requires a devtmpfs filesystem to mount at \/dev while selecting btrfs also selects LIBCRC32C. The CRC32c CRC algorithm is used by btrfs for checksums.<br \/>\nNow cross compile the kernel<br \/>\n<code><br \/>\n# make -j9 ARCH=arm CROSS_COMPILE=armv7a-unknown-linux-gnueabi- uImage<br \/>\n<\/code><\/p>\n<h3>Copy boot script and kernel<\/h3>\n<p>Download <tt>6x_bootscript-20121110<\/tt> available from a <a href=\"http:\/\/boundarydevices.com\/boot-scripts-for-main-line-u-boot-on-i-mx6\/\">blog post<\/a> and rename it <tt>6x_bootscript<\/tt>. Get the kernel from one of the <a href=\"http:\/\/boundarydevices.com\/imx6-builds\/\">i.MX6 builds<\/a> if you decided to skip building it.<br \/>\n<code><br \/>\n# mount -o compress=zlib \/dev\/sdd2 \/mnt\/p1 && mkdir \/mnt\/p1\/boot && mount \/dev\/sdd1 \/mnt\/p1\/boot<br \/>\n# cp 6x_bootscript \/mnt\/p1\/boot<br \/>\n# cp uImage \/mnt\/p1\/boot<br \/>\n<\/code><br \/>\nuImage is located in <tt>\/usr\/src\/linux\/arch\/arm\/boot<\/tt> if you compiled the kernel. <\/p>\n<h3>Extract stage3 and portage snapshot<\/h3>\n<p>Download the latest stage3 tarball and extract it<br \/>\n<code>tar xjpf stage3-armv7a*.tar.bz2 -C \/mnt\/p1<\/code><br \/>\n<a href=\"http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2014\/01\/P1010881-e1390445702217.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1348\" alt=\"BD-SL-i.MX6 with serial cable\" src=\"http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2014\/01\/P1010881-e1390445702217-168x300.jpg\" width=\"168\" height=\"300\" srcset=\"http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2014\/01\/P1010881-e1390445702217-168x300.jpg 168w, http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2014\/01\/P1010881-e1390445702217-576x1024.jpg 576w, http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2014\/01\/P1010881-e1390445702217.jpg 1728w\" sizes=\"auto, (max-width: 168px) 100vw, 168px\" \/><\/a><br \/>\nIf you get errors trying to run <tt>emerge --sync<\/tt>, it is because downloading the portage tree is not optional unlike other guides indicate. Simply download it from your nearest mirror and extract it<br \/>\n<code><br \/>\n# tar xjpf portage-latest.tar.bz2 -C \/mnt\/p1\/usr<\/code><\/p>\n<h3>Configure the install<\/h3>\n<p>If you compiled the kernel with btrfs, edit <tt>\/mnt\/p1\/etc\/fstab<\/tt> file so that zlib compression is enabled<br \/>\n<code><br \/>\n\/dev\/mmcblk0p1          \/boot           ext2            noatime         0 1<br \/>\n\/dev\/mmcblk0p2          \/               btrfs            noatime,compress=zlib<br \/>\n       0 1<br \/>\n<\/code><br \/>\nSet kernel boot argument in <tt>\/mnt\/p1\/etc\/inittab<\/tt>. Change the <tt>console=<\/tt> argument to <tt>ttymxc1<\/tt>. eg <tt>\"$bootargs console=ttymxc1,115200 vmalloc=400M consoleblank=0 rootwait\"<\/tt><br \/>\nThe rest of the process is the same as for other ARM boards, such as the Trimslice. The guide for it is available at <a href=\"http:\/\/dev.gentoo.org\/~armin76\/arm\/trimslice\/install.xml\">http:\/\/dev.gentoo.org\/~armin76\/arm\/trimslice\/install.xml<\/a>.<br \/>\n<a href=\"http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2014\/01\/P1010882-e1390445725644.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1349\" alt=\"4 SABRE Lite i.mx6 Development Boards on the benchmark rack\" src=\"http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2014\/01\/P1010882-e1390445725644-168x300.jpg\" width=\"168\" height=\"300\" srcset=\"http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2014\/01\/P1010882-e1390445725644-168x300.jpg 168w, http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2014\/01\/P1010882-e1390445725644-576x1024.jpg 576w, http:\/\/yuguangzhang.com\/blog\/wp-content\/uploads\/2014\/01\/P1010882-e1390445725644.jpg 1728w\" sizes=\"auto, (max-width: 168px) 100vw, 168px\" \/><\/a><\/p>\n<h3>Backup and clone<\/h3>\n<p>First make the backup in a folder<br \/>\n<code>cd \/backups<br \/>\ntar -cvpzf backup.tar.gz \/mnt\/p1\/<\/code><br \/>\nAfter unmounting the SD card and testing it on the device, put in a new one and clone it with the following commands<br \/>\n<code><br \/>\nsfdisk -f \/dev\/sdd < mmc_partitions\nmkfs.btrfs -f \/dev\/sdd2 &#038;&#038; mkfs.ext2 -FF \/dev\/sdd1\nmount -o compress=zlib \/dev\/sdd2 \/mnt\/p1 &#038;&#038; mkdir \/mnt\/p1\/boot &#038;&#038; mount \/dev\/sdd1 \/mnt\/p1\/boot\ntar xzpf backup.tar.gz -C \/mnt\/p1\nvim \/mnt\/p1\/etc\/conf.d\/hostname\n\numount \/mnt\/p1\/boot &#038;&#038; umount \/mnt\/p1\n<\/code><br \/>\nThe <a href=\"http:\/\/www.funtoo.org\/Funtoo_Linux_Installation_on_ARM\">Funtoo ARM Guide<\/a> has up to date sections on setting the root password and using swclock. If you decide to use swclock, update the last shutdown time to set the clock with <tt>touch \/tmp\/mnt\/p1\/lib\/rc\/cache\/shutdowntime<\/tt> after extracting the tarball. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently received several SABRE Lite BD-SL-i.MX6 boards for running ARM benchmarks on DataMill. To install Gentoo on it, you need a USB-to-serial cable converter. It came with a 4GB SD card, which is large enough to get you started. Overview of the installation: Reset board and format SD card (optional) Compile kernel with btrfs [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[5],"tags":[208,104,216],"class_list":["post-1350","post","type-post","status-publish","format-standard","hentry","category-linux","tag-arm","tag-gentoo","tag-linux"],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/posts\/1350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/comments?post=1350"}],"version-history":[{"count":4,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/posts\/1350\/revisions"}],"predecessor-version":[{"id":1430,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/posts\/1350\/revisions\/1430"}],"wp:attachment":[{"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/media?parent=1350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/categories?post=1350"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/tags?post=1350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}