{"id":221,"date":"2014-07-31T16:12:06","date_gmt":"2014-07-31T16:12:06","guid":{"rendered":"http:\/\/blog.ignoranthack.me\/?p=221"},"modified":"2014-07-31T16:15:41","modified_gmt":"2014-07-31T16:15:41","slug":"using-the-xdev-target-with-qemu-user-static-on-freebsd","status":"publish","type":"post","link":"http:\/\/blog.ignoranthack.me\/?p=221","title":{"rendered":"Using the xdev target with qemu-user-static on #FreeBSD"},"content":{"rendered":"<p>I&#8217;ve been playing with building ports for ARM on an AMD64 machine via a bunch of tools.\u00a0 The duct tape and bailing wire is a bit thick with this method, but if you keep at it, this should work.<\/p>\n<p><strong>1. build armv6 chroot:<\/strong><br \/>\nmake buildworld TARGET=arm TARGET_ARCH=armv6<br \/>\nmake installworld TARGET=arm TARGET_ARCH=armv6 DESTDIR=\/armv6<br \/>\nmake distribution TARGET=arm TARGET_ARCH=armv6 DESTDIR=\/armv6<\/p>\n<p><strong>2. build xdev<\/strong><br \/>\nmake xdev TARGET=arm TARGET_ARCH=armv6 NOSHARED=y<\/p>\n<p><strong>3. move xdev into chroot<\/strong><br \/>\nmv \/usr\/armv6-freebsd \/armv6\/usr\/<\/p>\n<p><strong>4. add toolchain to make.conf:<\/strong><br \/>\nCFLAGS+=-integrated-as<br \/>\nCC=\/usr\/armv6-freebsd\/usr\/bin\/cc<br \/>\nCPP=\/usr\/armv6-freebsd\/usr\/bin\/cpp<br \/>\nCXX=\/usr\/armv6-freebsd\/usr\/bin\/c++<br \/>\nAS=\/usr\/armv6-freebsd\/usr\/bin\/as<br \/>\nNM=\/usr\/armv6-freebsd\/usr\/bin\/nm<br \/>\nLD=\/usr\/armv6-freebsd\/usr\/bin\/ld<br \/>\nOBJCOPY=\/usr\/armv6-freebsd\/usr\/bin\/objcopy<br \/>\nSIZE=\/usr\/armv6-freebsd\/usr\/bin\/size<br \/>\nSTRIPBIN=\/usr\/armv6-freebsd\/usr\/bin\/strip<br \/>\n<strong>5. Install qemu-static-user from ports and copy into jail:<\/strong><br \/>\npkg instlal qemu-static-user<br \/>\nmkdir -p \/armv6\/usr\/local\/bin<br \/>\ncp \/usr\/local\/bin\/qemu-arm \/armv6\/usr\/local\/bin\/<\/p>\n<p><strong>6. setup binmiscctl to handle armv6 translations:<\/strong><br \/>\nbinmiscctl add armv6 &#8211;interpreter &#8220;\/usr\/local\/bin\/qemu-arm&#8221; &#8211;magic &#8220;x7fx45x4cx46x01x01x01x00x00x00x00x00x00x00x00x00x02x00x28x00&#8221; &#8211;mask &#8220;xffxffxffxffxffxffxffx00xffxffxffxffxffxffxffxffxfexffxffxff&#8221; &#8211;size 20 &#8211;set-enabled<\/p>\n<p><strong>7. mount devfs and ports if needed<\/strong><br \/>\nmount -t devfs devfs \/armv6\/dev<br \/>\nmount -t nullfs \/usr\/ports \/armv6\/usr\/ports<\/p>\n<p><strong>8. chroot<\/strong><br \/>\nchroot \/armv6<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been playing with building ports for ARM on an AMD64 machine via a bunch of tools.\u00a0 The duct tape and bailing wire is a bit thick with this method, but if you keep at it, this should work. 1. build armv6 chroot: make buildworld TARGET=arm TARGET_ARCH=armv6 make installworld TARGET=arm TARGET_ARCH=armv6 DESTDIR=\/armv6 make distribution TARGET=arm [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"_share_on_mastodon":"0"},"categories":[2],"tags":[],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"http:\/\/blog.ignoranthack.me\/index.php?rest_route=\/wp\/v2\/posts\/221"}],"collection":[{"href":"http:\/\/blog.ignoranthack.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.ignoranthack.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.ignoranthack.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.ignoranthack.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=221"}],"version-history":[{"count":1,"href":"http:\/\/blog.ignoranthack.me\/index.php?rest_route=\/wp\/v2\/posts\/221\/revisions"}],"predecessor-version":[{"id":222,"href":"http:\/\/blog.ignoranthack.me\/index.php?rest_route=\/wp\/v2\/posts\/221\/revisions\/222"}],"wp:attachment":[{"href":"http:\/\/blog.ignoranthack.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.ignoranthack.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=221"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.ignoranthack.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}