Changes

Jump to: navigation, search

Armv6hl bootstrap

7,683 bytes added, 10:19, 19 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=vfparch_canon: armv6hl: armv6hl 12buildarchtranslate: armv6hl: armv6hlarch_compat: armv6hl: armv7hnlbuildarch_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=vfpbuildarchtranslate: 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()  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'])...</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>#!/bin/bash#Repo var is the path to a repo folder#root var is the path to the chroot folder if [ "$repo" == "" -o "$root" == "" ] ; then exit 1 ; fi setenforce 0 # search through repo folder for all files chooses which files and places those files in a list text filefor pkgn in 'acl' 'attr' 'audit' 'authconfig' 'basesystem' 'bash' 'binutil' 'bzip' 'ca-certificate' 'chkconfig' 'cpio' 'coreutil' 'cracklib' 'cryptsetup' 'curl' '.*curses' 'cyrus-sasl' 'db4' 'dbus' 'dbus-glib' 'diffutil' 'dracut' 'e2fsprog' 'elfutil' 'expat' 'fedora-release' '/file' 'findutil' 'fipscheck' 'gamin' 'gawk' 'gcc' 'gdbm' 'generic-release' 'glib' 'gmp' 'gnupg2' 'gpgme' 'grep' 'gzip' 'hardlink' 'hostname' 'hwdata' 'initscript' 'iproute' 'iptable' 'iputil' '.*kernel' 'keyutil' 'kmod' 'krb5' 'libassuan' 'libcap.*' 'libdb' 'libedit' 'libffi' 'libgcrypt' 'libgpg-error' 'libidn' 'libpwquality' 'libse' 'libssh2' 'libus' 'libut' 'libxml2' 'linux-atm' 'logrotate' 'lua' 'lvm2' 'mingetty' 'net-tool' 'newt' 'nspr' '/nss.*' '/openss' 'openldap' 'pam' 'passwd' 'pcre' 'pinentry' 'pkgconfig' 'popt' 'procps' 'psmisc' 'pth' 'pygpgme' 'python' 'python-chardet' 'python-iniparse' 'python-kitchen' 'python-pycurl' 'python-urlgrabber' 'readline' '/rpm' 'sed' '/setup' 'shadow-util' 'shared-mime-info' 'slang' 'sqlite' 'syslog' 'systemd' 'sysvinit' 'tcp_wrapper' 'texinfo' 'tzdata' 'udev' 'ustr' 'util-linux' 'xz' 'yum' 'yum-metadata-parser' 'yum-util' 'zlib' ; do fill=`find $repo -type f | grep -i "/[^/-]*$pkgn[^/-]*-[^/-]*-[^/-]*/[^/]*.rpm$" | grep -Eiv '(-debuginfo-|.src.rpm)'` ; if [ "$fill" == "" ] ; then echo "FOF $pkgn" 1>&2 ; continue ; fi ; echo "$fill" ; done | sort | uniq | grep -Eiv '/(audispd-plugins|audit-libs-devel|audit-libs-static|cmirror|cpp|cryptsetup-devel|cryptsetup-python|cyrus-sasl-sql|dbus-glib-devel|dracut-fips|emacs-libidn|gcc|glib2-devel|glib2-static|glibc-devel|glibc-headers|glibc-static|glibc-utils|gnupg2-smime|krb5-server|libcap-ng-devel|libgcrypt-devel|libgcj|libgfortran|libgudev1-devel|libitm|libmudflap|libselinux-python|libsemanage-python|libuser-devel|linux-atm-libs-devel|lvm2-cluster|newt-devel|newt-static|openldap-devel|openldap-servers|openldap-servers-sql|openssh-askpass|openssh-ldap|openssl-devel|openssl-perl|openssl-static|pam_|passwdqc|policycoreutils-python|policycoreutils-sandbox|python[0-9]*-debug|python[0-9]*-devel|python[0-9]*-test|python[0-9]*-tkinter|python[0-9]*-tools|rpm-build-[0-9]|rpm-cron|rpm-devel|rpm-sign|rpmdevtools|rpmlint|rsyslog-gnutls|rsyslog-libdbi|rsyslog-mysql|rsyslog-pgsql|rsyslog-relp|rsyslog-snmp|rsyslog-udpspoof|setuptool|slang-slsh|sqlite-tcl|systemd-analyze|texinfo-tex|tkinter|yum-cron|yum-plugin-changelog|yum-plugin-local|yum-plugin-puppetverify|yum-plugin-refresh-updatesd|yum-plugin-tmprepo)[^/-]*-[^/]*$' > pkglist.txt #for p in $(rpm --force --ignorearch --root $root/ -i $(cat pkglist.txt | grep -Eiv '(gtk|gui|qt|x11)') 2>&1 | awk '{ print $1","$NF }' | sort | uniq) ; do a=$(echo "$p" | cut -d ',' -f 1) ; b=$(echo "$p" | cut -d ',' -f 2) ; q=$(repoquery --whatprovides "$a" | head -n 1) ; r=$(repoquery -qi "$q" | grep -i '^source') ; echo "[$b] -> [$a] -> [$q] -> [$r]" ; donerpm --force --ignorearch --nodeps --root $root/ -i $(cat pkglist.txt | grep -Eiv '(gtk|gui|qt|x11)') x2 rm -frv $root/usr/share/*doc* cat << EOF > $root/etc/fstabLABEL="rootfs" / ext4 defaults,noatime 1 1LABEL="boot" /boot vfat noauto,comment=systemd.automount 1 2EOF cat << EOF > $root/etc/sysconfig/networkHOSTNAME=raspiv6hl.localEOF cat << EOF > $root/etc/resolv.confnameserver 4.2.2.1EOF echo 'utmp:x:22:' >> $root/etc/groupecho 'PS1="[\u@\h: \w]# "' > $root/root/.bashrcchmod 755 $root/root/.bashrcln -s .bashrc $root/root/.profile #raspberrypised -i 's|root:.*:|root:$6$KW0GGbE5$zlEB9.PbHVh8kmXj1WMFGLJGwwthhU4oXn2oNxHZllbUSzTsVhTZ9jts8RC7uicuUCWyrsZ1e2yEj4ErDLOHQ/:15525:0:99999:7:::|' $root/etc/shadow rm -fv $root/etc/systemd/system/default.target && ln -s /usr/lib/systemd/system/multi-user.target $root/etc/systemd/system/default.target</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