website

website.git
git clone git://git.lenczewski.org/website.git
Log | Files | Refs

clfs.html (2718B)


      1 <h3>I did a thing!</h3>
      2 <p>
      3   Today I finished a semi-long-term project. I managed to complete the 
      4   <span><a href="http://clfs.org/view/clfs-embedded/arm/index.html">CLFS guide</a></span>
      5   and produce a working "distro" of linux for my raspberry pi. It is rather
      6   barebones at the moment and is not configured for even networking out of the
      7   box, but the fact that nothing segfaults immediately after booting makes this
      8   a great success! <i>My version also contains updated packages, as the ones on
      9   the guide were all outdated</i>.
     10 </p>
     11 
     12 <h3>Compiling a (cross-)compiler</h3>
     13 <p>
     14   For the longest time I was trying to properly configure the toolchain. Turns 
     15   out that building a toolchain is rather simple, as long as you stick to the 
     16   correct sequence of operations:
     17 </p>
     18 
     19 <pre><code class="language-text">
     20 1)   Build barebones binutils for your chosen arch [no libc]
     21 2)   Build barebones gcc for your chosen arch      [no libc]
     22 3)   Compile your libc for your chosen arch
     23 3.1) Compile your libc++ for your chosen arch
     24 4)   Recompile binutils for your chosen arch
     25 5)   Recompile gcc for your chosen arch
     26 </code></pre>
     27 
     28 <aside>Step 3.1 is optional if you don't want to support C++ in your cross-gcc</aside>
     29 
     30 <h3>Compiling the base</h3>
     31 <p>
     32   After compiling the toolchain, I was able to start compiling the basic packages 
     33   that are required for a working OS (that is the system libc, libstdc++, kernel, 
     34   and bootloader). Since the libc and libstdcxx we compiled in the previous step 
     35   are for the xbinutils and xgcc, we need to recompile (I placed the sysroot for 
     36   the xgcc in the root of the clfs system, instead of the cross-toolchain root). 
     37   This allows us to compile whichever packages we want in the sysroot, and be 
     38   able to link to them afterwards, instead of having to compile in the toolchain 
     39   sysroot and copy libraries to the clfs sysroot later.
     40 </p>
     41 
     42 <h3>Compiling more packages</h3>
     43 <p>
     44   In addition to the base packages in the system, we compile busybox to provide 
     45   a basic unix environment, and zlib to provide compression. We also compile
     46   dropbear, netplug, and wireless tools to provide a ssh server and a few
     47   convenience net utilities. Some configuration is also done via files placed
     48   in <code>/etc/</code>.
     49 </p>
     50 
     51 <h3>Conclusions</h3>
     52 <p>
     53   This was both a very fun and a very frustrating project. At multiple points
     54   my builds were failing mysteriously, and I ended up banging my head against
     55   a wall. After hopping onto irc and asking for help, these issues were
     56   eventually resolved and I managed to continue with the project. The source
     57   code for the build script can be found
     58   <span><a href="https://git.lenczewski.org/clfs/log.html">here</a></span>.
     59 </p>