Woke up, jazzercised, ate half a mellon.
Okay, I am awake for real this time. I have coffee. And I'm ready to hit Chapter 4.
And... most of my work from last night appears to have disappeared. Nothing is mounted and I can't find the damn sources
directory. Crap.
A disaster over my morning coffee.
Okay, so I had to re-mount the stupid $LFS
partition and swap space and everything is fine:
$ sudo mount -v -t ext4 /dev/mmcblk0p3 $LFS
$ sudo /sbin/swapon -v /dev/mmcblk0p4
I am pretty sure that stuff needs to get put into the /etc/fstab
file. But... syntax.
OKAY, NOW I am ready to start Chapter 4. First, we create some working directories:
$ sudo mkdir $LFS/usr
$ sudo mkdir $LFS/tools
$ sudo ln -sv $LFS/tools /
And now we create a dummy user and group so that we can do this build process a bit more safely:
$ sudo groupadd lfs
$ useradd -s /bin/bash -g lfs -m -k /dev/null lfs
It is not in the guide, but I had to give my lfs
user a password before I could switch users:
$ sudo passwd lfs
Now I can move forward with giving my new lfs
user permissions to work on the build:
$ sudo chown -v lfs $LFS/tools
$ sudo chown -v lfs $LFS/sources
And, finally, I log in as lfs
:
$ su - lfs
It is impossible to type a quote (
#
) or a backslash (\
) on that keyboard! Ugh.
I am going to go out and buy a new keyboard.
Oh no! The new keyboard is also broken!
Okay, so this is clearly a software problem. Looking online I find out that the Raspberry Pi come localized for the United Kingdom. What weird keyboards they must have. I was able to fix that with the NCURSES menu under:
$ sudo raspi-config
Setting up the Environment
I pretty much just followed the commands in Section 4.4 to create a .bash_profile
and .bashrc
file for the new lfs
user.
Taken from Chapter 5 - Constructing a Temporary System.
First things first, I opened up the binutils
source and tried to find the target triple for my build:
$ ./config.guess
arm71-unknown-linux-gnueabihf
So, that's a mouthfull. I hope it's supported.
And the book says I need to know what glibc linker I have on my current system:
$ readelf -l /bin/ping | grep interpreter
/lib/ld-linux-armhf.so.3
Okay, so I am reading through the next few stages.
Do you want live-streaming videos of me reading?!? Oh, the excitment.
Okay, that reading did lead to some system reconfiguration.
First off, I needed to install bison
, which is some sort of compiler-compiler for parsing language syntaxes. I cheated and used apt-get
:
$ sudo apt-get install bison
$ sudo unlink /usr/bin/yacc
$ sudo ln -s /usr/bin/bison /usr/bin/yacc
And for reasons I can't possibly imagine, they want me to use gawk
instead of awk
, fine:
$ sudo apt-get install gawk
$ sudo unlink /usr/bin/awk
$ sudo ln -s /usr/bin/gawk /usr/bin/awk
Finally, they want sh
to just be a symlink to bash
, but the RPi comes default with dash
. Easy fix:
$ sudo unlink /bin/sh
$ sudo ln -s /bin/bash /bin/sh
We start by compiling binutils
in Section 5.4.
Success!
It took 11m33.499s to compile Binutils on my Raspberry Pi 3. So that is my 1 SBU.
Now onto GCC.
After more than two hours compiling, GCC failed to compile "all". So, let's hope I can figure out why and it works the second time. Otherwise this will be the longest debug turn-around time in history.
Okay, I have no idea if this will fix the problem, but I did find two errors in my config statement. I used --disable-multi-lib
instead of --disable-multilib
, and I misspelled --disable-libatmoic
. I guess my only clear option is to fix that and run this two-hour test again.
Sigh.
Trying to make GCC again.
It is occurring to me just now that there is now way for me to compile this entire OS this weekend. The little ARM processor in this Raspberry Pi just won't be fast enough to get it done in 48 hours. So... that's a thing I'm learning.
GCC finally finished compiling! 109 minutes. Whew. Now let's try installing it...
Okay, GCC is in. Time to work on the Linux kernel.
Okay, time to build GLIBC. Apparently, this won't take as long as GCC. But it sounds like this is a point where stuff starts to fall apart for people. Fingers crossed.
Also, I downloaded a patch for GLIBC, but it took me ages to figure out that that patch probably isn't necessary until the second build phase.
So, the GLIBC make
and make install
seemed to go fine. And I can now use my compiled version of GLIBC to build little C programs. BUT. The book says that if I do this:
echo 'int main(){}' > dummy.c
$LFS_TGT-gcc dummy.c
readelf -l a.out | grep ': /tools'
Then I should get something like this:
[Requesting program interpreter: /tools/lib/ld-linux.so.2]
But I get nothing. There is no reference to my /tools/
directory in the compiled file.
Damn.
At this point the book just says "look around for the problem". But I am looking through my logs and there are no logs or errors anywhere. I am at a debugging empass. Now I just hope someone online has had the EXACT same problem before.
Okay, so, apparently I missed a requirement when installing my system. I think.
I think the problem is that I did not have "TexInfo" installed. See this post here for someone with a similar problem.
I guess I should have run this version-check.sh script at the start, and I wouldn't have had this problem.
Sadly, this means that I have to start my build from scratch.
Or, really, it means I have to start over at BinUtils
There is just no way I will be able to finish this build on a Raspberry Pi in the next 36 hours. Ain't gonna happen.
Okay, I am starting back over here with compiling BinUtils.
Also, it looks like I for something from the PiLFS guide. I need this line in my ~/.bashrc
:
LFS_TGT=$(uname -m)-lfs-linux-gnueabihf
And let's make sure we have the PiLFS version of all the packages:
wget http://intestinate.com/pilfs/scripts/wget-list
wget -i wget-list -P $LFS/sources
Okay, I am going to start the long GCC compile and go to bed. Fingers crossed.