{"id":535,"date":"2010-07-27T05:08:09","date_gmt":"2010-07-26T23:38:09","guid":{"rendered":"http:\/\/judepereira.com\/blog\/?p=535"},"modified":"2012-01-14T07:21:48","modified_gmt":"2012-01-14T01:51:48","slug":"going-embedded-with-mgentoo","status":"publish","type":"post","link":"https:\/\/judepereira.com\/blog\/going-embedded-with-mgentoo\/","title":{"rendered":"embedded gentoo [uclibc] | nothing beats this"},"content":{"rendered":"<p>A few uclibc embedded gentoo facts:<\/p>\n<ul>\n<li>the compilation of the box takes around 15 minutes<\/li>\n<li>at boot up, takes less than 3 megabytes of RAM<\/li>\n<li>disk space: 17 megabytes<\/li>\n<li>boots in under 8 seconds on a pentium3<\/li>\n<\/ul>\n<p><em><a href=\"http:\/\/judepereira.com\/blog\/gentoo-linux-uclibc-stage3-2010-for-embedded\/\">link to stage3 tarballs archive<\/a><\/em><br \/>\n<a href=\"https:\/\/i0.wp.com\/judepereira.com\/blog\/wp-content\/uploads\/booted-htop.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/judepereira.com\/blog\/wp-content\/uploads\/booted-htop.png\" alt=\"HTOP - Displaying System Statistics\" title=\"HTOP - Displaying System Statistics\"\/><\/a><br \/>\n# this is my make.conf, it should be the same in the stage3, if installing anything in the stage3, and even before updating, comment the line INSTALL_MASK=&#8221;*.h HACKING.gz TODO.gz&#8221;<\/p>\n<p>[sourcecode lang=&#8221;bash&#8221;]<br \/>\nCFLAGS=&#8221;-Os -mtune=i386 -pipe&#8221;<br \/>\nCXXFLAGS=&#8221;-Os -mtune=i386 -pipe&#8221;<br \/>\nCHOST=&#8221;i386-gentoo-linux-uclibc&#8221;<\/p>\n<p>FEATURES=&#8221;strip&#8221;<br \/>\nMAKEOPTS=&#8221;-j3&#8243;<br \/>\nGENTOO_MIRRORS=&#8221;http:\/\/mirror.bytemark.co.uk\/gentoo\/ http:\/\/www.ibiblio.org\/pub\/Linux\/distributions\/gentoo&#8221;<\/p>\n<p>USE=&#8221;-ipv6 -python3 -cracklib -minimal&#8221;<\/p>\n<p>LINGUAS=&#8221;en&#8221;<br \/>\nVIDEO_CARDS=&#8221;&#8221;<br \/>\nACCEPT_KEYWORDS=&#8221;~x86&#8243;<br \/>\nINSTALL_MASK=&#8221;*.h HACKING.gz TODO.gz&#8221;<br \/>\n[\/sourcecode]<\/p>\n<p># download my stage3, from the previous post links, and then prepare to chroot<br \/>\n[sourcecode lang=&#8221;bash&#8221;]<br \/>\nmount -o bind \/dev stage3-*\/dev<br \/>\nmount -o bind \/proc stage3-*\/proc<br \/>\nchroot stage3-*<br \/>\n[\/sourcecode]<br \/>\n# update the system, and create the necessary path, if you come across any errors, post them here, and expect a reply soon<br \/>\n[sourcecode lang=&#8221;bash&#8221;]<br \/>\nemerge -avuDN world<br \/>\nmkdir \/mounted<br \/>\n[\/sourcecode]<br \/>\n# begin the installation<br \/>\n# install necessary packages<br \/>\n[sourcecode lang=&#8221;bash&#8221;]ROOT=\/mounted\/ emerge -auvND baselayout uclibc bash dropbear pam udev iptables coreutils nano util-linux shadow kbd net-tools grep procps gzip sed findutils mawk htop<br \/>\nmkdir \/mounted\/proc<br \/>\nmkdir \/mounted\/dev<br \/>\n[\/sourcecode]<br \/>\n<!--more--><br \/>\n# exit the chroot, and then unmount the dev and proc<br \/>\n[sourcecode lang=&#8221;bash&#8221;]<br \/>\numount stage3-*\/dev<br \/>\numount stage3-*\/proc<br \/>\n[\/sourcecode]<br \/>\n# chroot again and continue stripping<br \/>\n[sourcecode lang=&#8221;bash&#8221;]<br \/>\nchroot stage3-*\/<br \/>\n[\/sourcecode]<br \/>\n# you&#8217;ll need to copy what&#8217;s already in my stage3 dev\/ to the target dev\/<br \/>\n[sourcecode lang=&#8221;bash&#8221;]<br \/>\ncp -r \/dev\/* \/mounted\/dev\/<br \/>\n[\/sourcecode]<br \/>\n# begin unmercilessly throwing out things<br \/>\n[sourcecode lang=&#8221;bash&#8221;]<br \/>\nrm -rf \/mounted\/var\/db\/*<br \/>\nrm -rf \/mounted\/var\/log\/*<br \/>\nrm -rf \/mounted\/usr\/include\/<br \/>\nrm -rf \/mounted\/usr\/lib\/pkgconfig\/<br \/>\ncp -pr \/mounted\/usr\/share\/keymaps\/i386\/qwerty\/ .\/<br \/>\nrm -rf \/mounted\/usr\/share\/keymaps\/*<br \/>\nmkdir \/mounted\/usr\/share\/keymaps\/i386\/<br \/>\nmv .\/qwerty\/ \/mounted\/usr\/share\/keymaps\/i386\/<br \/>\nrm -rf \/mounted\/usr\/share\/nano\/<br \/>\nrm -rf \/mounted\/var\/lib\/portage\/<br \/>\nrm -rf \/mounted\/var\/lib\/gentoo\/<br \/>\nrm -rf \/mounted\/var\/lib\/misc\/<br \/>\nrm -rf \/mounted\/var\/cache\/*<br \/>\nrm -rf \/mounted\/usr\/share\/terminfo\/<br \/>\nrm -rf \/mounted\/usr\/share\/baselayout\/<br \/>\nrm -rf \/mounted\/usr\/share\/consoletrans\/<br \/>\nrm -rf \/mounted\/usr\/share\/openrc<br \/>\nrm -rf \/mounted\/usr\/sbin\/fdformat<br \/>\nrm -rf \/mounted\/var\/lib\/misc\/<br \/>\nrm -rf \/mounted\/etc\/logrotate.d\/<br \/>\nrm -rf \/mounted\/etc\/portage\/<br \/>\n[\/sourcecode]<br \/>\n# i got the necessary libs for ext4 by doing ldd \/sbin\/fsck.ext4, if you use another filesystem, do the needful<br \/>\n# installing e2fsprogs hogs too much of valuable space<br \/>\n[sourcecode lang=&#8221;bash&#8221;]<br \/>\ncp \/sbin\/fsck.ext4 \/mounted\/sbin\/<br \/>\ncp \/lib\/libext2fs.so.2* \/mounted\/lib\/<br \/>\ncp \/lib\/libcom_err.so.2* \/mounted\/lib\/<br \/>\ncp \/lib\/libblkid.so.1* \/mounted\/lib\/<br \/>\ncp \/lib\/libuuid.so.1* \/mounted\/lib\/<br \/>\ncp \/lib\/libe2p.so.2* \/mounted\/lib\/<br \/>\ncp \/lib\/libpthread* \/mounted\/lib\/<br \/>\ncp \/lib\/ld-uClibc* \/mounted\/lib\/<br \/>\n[\/sourcecode]<br \/>\n# copy, remove and then place the needed stuff for terminal fonts, etc.<br \/>\n[sourcecode lang=&#8221;bash&#8221;]<br \/>\ncp \/mounted\/usr\/share\/unimaps\/iso01.uni .\/<br \/>\ncp \/mounted\/usr\/share\/consolefonts\/default8x16.psfu.gz .\/<br \/>\nrm -rf \/mounted\/usr\/share\/unimaps\/*<br \/>\nrm -rf \/mounted\/usr\/share\/consolefonts\/*<br \/>\nmv .\/default8x16.psfu.gz \/mounted\/usr\/share\/consolefonts\/<br \/>\nmv .\/iso01.uni \/mounted\/usr\/share\/unimaps\/<br \/>\n[\/sourcecode]<br \/>\n# all done<\/p>\n<p># I&#8217;m done, what now?<br \/>\n# Most importantly, get your kernel configured correctly, if anyone would want to use my kernel config as a base, comment, and I will upload it<br \/>\n# chroot into the target system(in this example, chroot \/mounted), and run passwd, set the system root password, modify your \/etc\/fstab, here&#8217;s an example:<br \/>\n[sourcecode lang=&#8221;bash&#8221;]<br \/>\n# <fs>   <mountpoint>  <type>  <opts>  <dump\/pass><br \/>\n\/dev\/hda1 \/ ext4 noatime,nodelalloc 0 1<br \/>\nnone \/dev\/pts devpts mode=0620 0 0<br \/>\nshm \/dev\/shm tmpfs nodev,nosuid,noexec 0 0<br \/>\n[\/sourcecode]<br \/>\n# now follow the gentoo handbook, and setup your network configuration, and whatever was missed out here<\/p>\n<p><em><sup>My kernel configuration for the Intel Pentium family is <a href=\"http:\/\/judepereira.com\/blog\/wp-content\/uploads\/stage3-uclibc-x86-2010\/kernel-config-2.6.34\"><strong>here<\/strong><\/a> :)<\/sup><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few uclibc embedded gentoo facts: the compilation of the box takes around 15 minutes at boot up, takes less than 3 megabytes of RAM disk space: 17 megabytes boots in under 8 seconds on a pentium3 link to stage3 tarballs archive # this is my make.conf, it should be the same in the stage3, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[52,11,10],"tags":[111,118,114,117,116,115],"class_list":["post-535","post","type-post","status-publish","format-standard","hentry","category-code","category-gen-sab-fed","category-linux","tag-embedded-gentoo","tag-gentoo-for-routers","tag-gentoo-under-20mb","tag-mgentoo","tag-mini-gentoo","tag-tiny-gentoo"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pqtyx-8D","jetpack-related-posts":[{"id":289,"url":"https:\/\/judepereira.com\/blog\/sabayon-four-oh\/","url_meta":{"origin":535,"position":0},"title":"Sabayon fOuR oH","author":"Jude Pereira","date":"June 16, 2009","format":false,"excerpt":"Based on Gentoo, Sabayon 4.1, tells me: Great performance with less RAM(though you need like 1GB RAM for it to work well enough). Package Management System is absolutely fantastic, with it's new \"Entropy\". Totally the perfect distribution. A fine distribution for the newbie or the expert. This is what a\u2026","rel":"","context":"In &quot;gnu linux&quot;","block_context":{"text":"gnu linux","link":"https:\/\/judepereira.com\/blog\/category\/linux\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":893,"url":"https:\/\/judepereira.com\/blog\/coloured-varlogmessages-at-tty12\/","url_meta":{"origin":535,"position":1},"title":"Coloured \/var\/log\/messages at tty12","author":"Jude Pereira","date":"April 26, 2011","format":false,"excerpt":"Reading logs could never become any more easier, at just a keystroke, you have your logs displayed where you want, in some fancy colour. They look great too. TTY's can be accessed by pressing Alt + Ctrl + F[1 - 12] simultaneously. In the following, you'll get a decent, colourized\u2026","rel":"","context":"In &quot;another snippet | code&quot;","block_context":{"text":"another snippet | code","link":"https:\/\/judepereira.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":694,"url":"https:\/\/judepereira.com\/blog\/visual-basic-6-revisited-linux-wine\/","url_meta":{"origin":535,"position":2},"title":"visual basic 6 revisited &#8211; linux &#8211; wine","author":"Jude Pereira","date":"August 5, 2010","format":false,"excerpt":"Earlier this year, I had written an article on running Visual Basic 6 on linux under wine, this is an update for it, the prior one is deprecated Getting Visual Basic 6 to work on linux is pretty easy, not much trouble, all the basic things work, as of what\u2026","rel":"","context":"In &quot;another snippet | code&quot;","block_context":{"text":"another snippet | code","link":"https:\/\/judepereira.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/posts\/535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/comments?post=535"}],"version-history":[{"count":31,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/posts\/535\/revisions"}],"predecessor-version":[{"id":1230,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/posts\/535\/revisions\/1230"}],"wp:attachment":[{"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/media?parent=535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/categories?post=535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/tags?post=535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}