Changes

Jump to: navigation, search

Armv6hl bootstrap

55 bytes removed, 11:05, 8 July 2013
no edit summary
* Most of my major changes were documented here: http://fossjon.wordpress.com/2012/09/18/bootstrapping-fedora-arm-for-a-new-arch-v6hl/
 
 
<p><b>Note:</b> These steps assume you have a <code>gcc</code> compiler capable of producing the correct assembly instructions for the intended new arch</p>
 
<p><b>Step 1:</b> Add the necessary architecture definitions</p>
 
<p><code>/usr/lib/rpm/platform/armv6hl-linux/macros</code></p>
 
<pre>
 
...
 
%optflags -O2 -g -march=armv6 -mfloat-abi=hard -mfpu=vfp
 
%__isa_name armv6hl
 
...
 
</pre>
 
<p><code>/usr/lib/rpm/{,redhat}/{rpmrc,macros}</code></p>
 
<pre>
 
...
 
optflags: armv6hl -O2 -g -march=armv6 -mfloat-abi=hard -mfpu=vfp
 
arch_canon: armv6hl: armv6hl 12
 
buildarchtranslate: armv6hl: armv6hl
 
arch_compat: armv6hl: armv7hnl
 
buildarch_compat: armv6hl: armv7hnl
 
...
 
%arm armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv6hl armv7l armv7hl armv7hnl
 
...
 
optflags: armv6hl %{__global_cflags} -march=armv6 -mfloat-abi=hard -mfpu=vfp
 
buildarchtranslate: armv6hl: armv7hnl
 
...
 
</pre>
 
<p><code>/usr/lib/python2.7/site-packages/rpmUtils/arch.py</code></p>
 
<pre>
 
...
 
"armv6hl": "armv7hnl",
 
...
 
</pre>
 
<p><b>Step 2:</b> Compile the latest version of gcc for your related arch using rpmbuild (&#045;&#045;target armv6hl)</p>
 
<p><b>Step 3:</b> Modify mock to hijack &amp;&amp; inject these new files into all future build roots</p>
 
<p><code>/usr/sbin/mock</code></p>
 
<pre>
 
...
 
def do_rebuild(config_opts, chroot, srpms):
 
...
chroot.init()
chroot.init()  ldst = (chroot.basedir+"/root"+"/usr/lib/rpm/platform")  import shutil  shutil.copytree("/usr/lib/rpm/platform/armv6hl-linux",ldst+"/armv6hl-linux")  os.system("for f in /usr/lib/rpm/{,redhat}/{rpmrc,macros} ; do cp -fv \"$f\" \""+chroot.basedir+"/root/$f\" ; done")  lcmd = ("/bin/rpm --force --ignorearch --nodeps --root "+chroot.basedir+"/root/ -i /repo/gcc-4.7.0-5.fc17/*.rpm")  os.system(lcmd) chroot.build(srpm, timeout=config_opts['rpmbuild_timeout'])
chroot.build(srpm, timeout=config_opts['rpmbuild_timeout'])
...
 
</pre>
 
<p><b>Step 4:</b> Build glibc and all other needed packages using mock (use a helper shell script loop &amp;&amp; make sure to patch rpm/yum/redhat-rpm-config later)</p>
 
<p><code>/etc/mock/f17v6.cfg</code></p>
 
<pre>
 
...
 
config_opts['target_arch'] = 'armv6hl'
 
...
 
</pre>
 
<p><b>Step 4.5.0:</b> rpm C code (unified diff patch)</p>
 
<p><code>rpm-x.x/lib/rpmrc.c</code></p>
 
<pre>
 
...
 
+# if defined(__linux__) &amp;&amp; defined(__arm__)
 
+ {
 
+ if (strcmp(un.machine, "armv7l") == 0 ) {
 
+ if (has_neon() &amp;&amp; has_hfp())
 
+ strcpy(un.machine, "armv7hnl");
 
+ else if (has_hfp())
 
+ strcpy(un.machine, "armv7hl");
 
+ }
 
+ if (strcmp(un.machine, "armv6l") == 0 ) {
 
+ if (has_neon() &amp;&amp; has_hfp())
 
+ strcpy(un.machine, "armv6hnl");
 
+ else if (has_hfp())
 
+ strcpy(un.machine, "armv6hl");
 
+ strcpy(un.machine, "armv6hl");
 
+ }
 
+ }
 
+# endif /* arm*-linux */
 
+
 
...
 
</pre>
 
<p><b>Step 4.5.1:</b> yum Python script (mod)</p>
 
<p><code>yum-x.x/{yum/misc.py,rpmUtils/arch.py}</code></p>
 
<pre>
 
...
 
os.uname().replace("armv6l","armv6hl").replace("armv7l","armv6hl").replace("armv7hl","armv6hl")
 
...
 
</pre>
 
<p><b>Step 5:</b> Install a core set of packages needed for a minimal boot (use a capable host/arch)</p>
 
<p><code>compose.sh</code></p>
 
<pre>
 
&#035;&#033;&#047;bin&#047;bash&#010;&#010;if&#032;&#091;&#032;&#034;&#036;repo&#034;&#032;&#061;&#061;&#032;&#034;&#034;&#032;&#045;o&#032;&#034;&#036;root&#034;&#032;&#061;&#061;&#032;&#034;&#034;&#032;&#093;&#032;&#059;&#032;then&#032;exit&#032;1&#032;&#059;&#032;fi&#010;&#010;setenforce&#032;0&#010;&#010;for&#032;pkgn&#032;in&#032;&#039;acl&#039;&#032;&#039;attr&#039;&#032;&#039;audit&#039;&#032;&#039;authconfig&#039;&#032;&#039;basesystem&#039;&#032;&#039;bash&#039;&#032;&#039;binutil&#039;&#032;&#039;bzip&#039;&#032;&#039;ca&#045;certificate&#039;&#032;&#039;chkconfig&#039;&#032;&#039;cpio&#039;&#032;&#039;coreutil&#039;&#032;&#039;cracklib&#039;&#032;&#039;cryptsetup&#039;&#032;&#039;curl&#039;&#032;&#039;&#046;&#042;curses&#039;&#032;&#039;cyrus&#045;sasl&#039;&#032;&#039;db4&#039;&#032;&#039;dbus&#039;&#032;&#039;dbus&#045;glib&#039;&#032;&#039;diffutil&#039;&#032;&#039;dracut&#039;&#032;&#039;e2fsprog&#039;&#032;&#039;elfutil&#039;&#032;&#039;expat&#039;&#032;&#039;fedora&#045;release&#039;&#032;&#039;&#047;file&#039;&#032;&#039;findutil&#039;&#032;&#039;fipscheck&#039;&#032;&#039;gamin&#039;&#032;&#039;gawk&#039;&#032;&#039;gcc&#039;&#032;&#039;gdbm&#039;&#032;&#039;generic&#045;release&#039;&#032;&#039;glib&#039;&#032;&#039;gmp&#039;&#032;&#039;gnupg2&#039;&#032;&#039;gpgme&#039;&#032;&#039;grep&#039;&#032;&#039;gzip&#039;&#032;&#039;hardlink&#039;&#032;&#039;hostname&#039;&#032;&#039;hwdata&#039;&#032;&#039;initscript&#039;&#032;&#039;iproute&#039;&#032;&#039;iptable&#039;&#032;&#039;iputil&#039;&#032;&#039;&#046;&#042;kernel&#039;&#032;&#039;keyutil&#039;&#032;&#039;kmod&#039;&#032;&#039;krb5&#039;&#032;&#039;libassuan&#039;&#032;&#039;libcap&#046;&#042;&#039;&#032;&#039;libdb&#039;&#032;&#039;libedit&#039;&#032;&#039;libffi&#039;&#032;&#039;libgcrypt&#039;&#032;&#039;libgpg&#045;error&#039;&#032;&#039;libidn&#039;&#032;&#039;libpwquality&#039;&#032;&#039;libse&#039;&#032;&#039;libssh2&#039;&#032;&#039;libus&#039;&#032;&#039;libut&#039;&#032;&#039;libxml2&#039;&#032;&#039;linux&#045;atm&#039;&#032;&#039;logrotate&#039;&#032;&#039;lua&#039;&#032;&#039;lvm2&#039;&#032;&#039;mingetty&#039;&#032;&#039;net&#045;tool&#039;&#032;&#039;newt&#039;&#032;&#039;nspr&#039;&#032;&#039;&#047;nss&#046;&#042;&#039;&#032;&#039;&#047;openss&#039;&#032;&#039;openldap&#039;&#032;&#039;pam&#039;&#032;&#039;passwd&#039;&#032;&#039;pcre&#039;&#032;&#039;pinentry&#039;&#032;&#039;pkgconfig&#039;&#032;&#039;popt&#039;&#032;&#039;procps&#039;&#032;&#039;psmisc&#039;&#032;&#039;pth&#039;&#032;&#039;pygpgme&#039;&#032;&#039;python&#039;&#032;&#039;python&#045;chardet&#039;&#032;&#039;python&#045;iniparse&#039;&#032;&#039;python&#045;kitchen&#039;&#032;&#039;python&#045;pycurl&#039;&#032;&#039;python&#045;urlgrabber&#039;&#032;&#039;readline&#039;&#032;&#039;&#047;rpm&#039;&#032;&#039;sed&#039;&#032;&#039;&#047;setup&#039;&#032;&#039;shadow&#045;util&#039;&#032;&#039;shared&#045;mime&#045;info&#039;&#032;&#039;slang&#039;&#032;&#039;sqlite&#039;&#032;&#039;syslog&#039;&#032;&#039;systemd&#039;&#032;&#039;sysvinit&#039;&#032;&#039;tcp&#095;wrapper&#039;&#032;&#039;texinfo&#039;&#032;&#039;tzdata&#039;&#032;&#039;udev&#039;&#032;&#039;ustr&#039;&#032;&#039;util&#045;linux&#039;&#032;&#039;xz&#039;&#032;&#039;yum&#039;&#032;&#039;yum&#045;metadata&#045;parser&#039;&#032;&#039;yum&#045;util&#039;&#032;&#039;zlib&#039;&#032;&#059;&#032;do&#032;fill&#061;&#096;find&#032;&#036;repo&#032;&#045;type&#032;f&#032;&#124;&#032;grep&#032;&#045;i&#032;&#034;&#047;&#091;&#094;&#047;&#045;&#093;&#042;&#036;pkgn&#091;&#094;&#047;&#045;&#093;&#042;&#045;&#091;&#094;&#047;&#045;&#093;&#042;&#045;&#091;&#094;&#047;&#045;&#093;&#042;&#047;&#091;&#094;&#047;&#093;&#042;&#046;rpm&#036;&#034;&#032;&#124;&#032;grep&#032;&#045;Eiv&#032;&#039;&#040;&#045;debuginfo&#045;&#124;&#046;src&#046;rpm&#041;&#039;&#096;&#032;&#059;&#032;if&#032;&#091;&#032;&#034;&#036;fill&#034;&#032;&#061;&#061;&#032;&#034;&#034;&#032;&#093;&#032;&#059;&#032;then&#032;echo&#032;&#034;FOF&#032;&#036;pkgn&#034;&#032;1&#062;&#038;2&#032;&#059;&#032;continue&#032;&#059;&#032;fi&#032;&#059;&#032;echo&#032;&#034;&#036;fill&#034;&#032;&#059;&#032;done&#032;&#124;&#032;sort&#032;&#124;&#032;uniq&#032;&#124;&#032;grep&#032;&#045;Eiv&#032;&#039;&#047;&#040;audispd&#045;plugins&#124;audit&#045;libs&#045;devel&#124;audit&#045;libs&#045;static&#124;cmirror&#124;cpp&#124;cryptsetup&#045;devel&#124;cryptsetup&#045;python&#124;cyrus&#045;sasl&#045;sql&#124;dbus&#045;glib&#045;devel&#124;dracut&#045;fips&#124;emacs&#045;libidn&#124;gcc&#124;glib2&#045;devel&#124;glib2&#045;static&#124;glibc&#045;devel&#124;glibc&#045;headers&#124;glibc&#045;static&#124;glibc&#045;utils&#124;gnupg2&#045;smime&#124;krb5&#045;server&#124;libcap&#045;ng&#045;devel&#124;libgcrypt&#045;devel&#124;libgcj&#124;libgfortran&#124;libgudev1&#045;devel&#124;libitm&#124;libmudflap&#124;libselinux&#045;python&#124;libsemanage&#045;python&#124;libuser&#045;devel&#124;linux&#045;atm&#045;libs&#045;devel&#124;lvm2&#045;cluster&#124;newt&#045;devel&#124;newt&#045;static&#124;openldap&#045;devel&#124;openldap&#045;servers&#124;openldap&#045;servers&#045;sql&#124;openssh&#045;askpass&#124;openssh&#045;ldap&#124;openssl&#045;devel&#124;openssl&#045;perl&#124;openssl&#045;static&#124;pam&#095;&#124;passwdqc&#124;policycoreutils&#045;python&#124;policycoreutils&#045;sandbox&#124;python&#091;0&#045;9&#093;&#042;&#045;debug&#124;python&#091;0&#045;9&#093;&#042;&#045;devel&#124;python&#091;0&#045;9&#093;&#042;&#045;test&#124;python&#091;0&#045;9&#093;&#042;&#045;tkinter&#124;python&#091;0&#045;9&#093;&#042;&#045;tools&#124;rpm&#045;build&#045;&#091;0&#045;9&#093;&#124;rpm&#045;cron&#124;rpm&#045;devel&#124;rpm&#045;sign&#124;rpmdevtools&#124;rpmlint&#124;rsyslog&#045;gnutls&#124;rsyslog&#045;libdbi&#124;rsyslog&#045;mysql&#124;rsyslog&#045;pgsql&#124;rsyslog&#045;relp&#124;rsyslog&#045;snmp&#124;rsyslog&#045;udpspoof&#124;setuptool&#124;slang&#045;slsh&#124;sqlite&#045;tcl&#124;systemd&#045;analyze&#124;texinfo&#045;tex&#124;tkinter&#124;yum&#045;cron&#124;yum&#045;plugin&#045;changelog&#124;yum&#045;plugin&#045;local&#124;yum&#045;plugin&#045;puppetverify&#124;yum&#045;plugin&#045;refresh&#045;updatesd&#124;yum&#045;plugin&#045;tmprepo&#041;&#091;&#094;&#047;&#045;&#093;&#042;&#045;&#091;&#094;&#047;&#093;&#042;&#036;&#039;&#032;&#062;&#032;pkglist&#046;txt&#010;&#010;&#035;for&#032;p&#032;in&#032;&#036;&#040;rpm&#032;&#045;&#045;force&#032;&#045;&#045;ignorearch&#032;&#045;&#045;root&#032;&#036;root&#047;&#032;&#045;i&#032;&#036;&#040;cat&#032;pkglist&#046;txt&#032;&#124;&#032;grep&#032;&#045;Eiv&#032;&#039;&#040;gtk&#124;gui&#124;qt&#124;x11&#041;&#039;&#041;&#032;2&#062;&#038;1&#032;&#124;&#032;awk&#032;&#039;&#123;&#032;print&#032;&#036;1&#034;&#044;&#034;&#036;NF&#032;&#125;&#039;&#032;&#124;&#032;sort&#032;&#124;&#032;uniq&#041;&#032;&#059;&#032;do&#032;a&#061;&#036;&#040;echo&#032;&#034;&#036;p&#034;&#032;&#124;&#032;cut&#032;&#045;d&#032;&#039;&#044;&#039;&#032;&#045;f&#032;1&#041;&#032;&#059;&#032;b&#061;&#036;&#040;echo&#032;&#034;&#036;p&#034;&#032;&#124;&#032;cut&#032;&#045;d&#032;&#039;&#044;&#039;&#032;&#045;f&#032;2&#041;&#032;&#059;&#032;q&#061;&#036;&#040;repoquery&#032;&#045;&#045;whatprovides&#032;&#034;&#036;a&#034;&#032;&#124;&#032;head&#032;&#045;n&#032;1&#041;&#032;&#059;&#032;r&#061;&#036;&#040;repoquery&#032;&#045;qi&#032;&#034;&#036;q&#034;&#032;&#124;&#032;grep&#032;&#045;i&#032;&#039;&#094;source&#039;&#041;&#032;&#059;&#032;echo&#032;&#034;&#091;&#036;b&#093;&#032;&#045;&#062;&#032;&#091;&#036;a&#093;&#032;&#045;&#062;&#032;&#091;&#036;q&#093;&#032;&#045;&#062;&#032;&#091;&#036;r&#093;&#034;&#032;&#059;&#032;done&#010;rpm&#032;&#045;&#045;force&#032;&#045;&#045;ignorearch&#032;&#045;&#045;nodeps&#032;&#045;&#045;root&#032;&#036;root&#047;&#032;&#045;i&#032;&#036;&#040;cat&#032;pkglist&#046;txt&#032;&#124;&#032;grep&#032;&#045;Eiv&#032;&#039;&#040;gtk&#124;gui&#124;qt&#124;x11&#041;&#039;&#041;&#032;x2&#010;&#010;rm&#032;&#045;frv&#032;&#036;root&#047;usr&#047;share&#047;&#042;doc&#042;&#010;&#010;cat&#032;&#060;&#060;&#032;EOF&#032;&#062;&#032;&#036;root&#047;etc&#047;fstab&#010;LABEL&#061;&#034;rootfs&#034;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#047;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;ext4&#032;&#032;&#032;&#032;defaults&#044;noatime&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;1&#032;1&#010;LABEL&#061;&#034;boot&#034;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#047;boot&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;&#032;vfat&#032;&#032;&#032;&#032;noauto&#044;comment&#061;systemd&#046;automount&#032;1&#032;2&#010;EOF&#010;&#010;cat&#032;&#060;&#060;&#032;EOF&#032;&#062;&#032;&#036;root&#047;etc&#047;sysconfig&#047;network&#010;HOSTNAME&#061;raspiv6hl&#046;local&#010;EOF&#010;&#010;cat&#032;&#060;&#060;&#032;EOF&#032;&#062;&#032;&#036;root&#047;etc&#047;resolv&#046;conf&#010;nameserver&#032;4&#046;2&#046;2&#046;1&#010;EOF&#010;&#010;echo&#032;&#039;utmp&#058;x&#058;22&#058;&#039;&#032;&#062;&#062;&#032;&#036;root&#047;etc&#047;group&#010;echo&#032;&#039;PS1&#061;&#034;&#091;&#092;u&#064;&#092;h&#058;&#032;&#092;w&#093;&#035;&#032;&#034;&#039;&#032;&#062;&#032;&#036;root&#047;root&#047;&#046;bashrc&#010;chmod&#032;755&#032;&#036;root&#047;root&#047;&#046;bashrc&#010;ln&#032;&#045;s&#032;&#046;bashrc&#032;&#036;root&#047;root&#047;&#046;profile&#010;&#010;&#035;raspberrypi&#010;sed&#032;&#045;i&#032;&#039;s&#124;root&#058;&#046;&#042;&#058;&#124;root&#058;&#036;6&#036;KW0GGbE5&#036;zlEB9&#046;PbHVh8kmXj1WMFGLJGwwthhU4oXn2oNxHZllbUSzTsVhTZ9jts8RC7uicuUCWyrsZ1e2yEj4ErDLOHQ&#047;&#058;15525&#058;0&#058;99999&#058;7&#058;&#058;&#058;&#124;&#039;&#032;&#036;root&#047;etc&#047;shadow&#010;&#010;rm&#032;&#045;fv&#032;&#036;root&#047;etc&#047;systemd&#047;system&#047;default&#046;target&#032;&#038;&#038;&#032;ln&#032;&#045;s&#032;&#047;usr&#047;lib&#047;systemd&#047;system&#047;multi&#045;user&#046;target&#032;&#036;root&#047;etc&#047;systemd&#047;system&#047;default&#046;target&#010;
 
</pre>
 
<p><b>Step 6:</b> Boot the new Fedora ARM Linux system</p>
 
<p><a href="http://fossjon.files.wordpress.com/2012/09/photo.jpg"><img src="http://fossjon.files.wordpress.com/2012/09/photo.jpg?w=630" alt="" /></a></p>
1
edit

Navigation menu