Monday, June 6, 2011

LOAD "*" ,8,1

For those that are unaware... I am a geek... Some even would say "Dork" (as in my wife would say) that's fine by me...

WARNING**** UberGeekSpeek Beyond This point ****

In case anyone that would care is wondering hat the title means to this post.... It is the load/run command for the first file on a disk for a commadore 64 .... ahhhhhhh good times....

I put that as the title because... well, first off I am kind of strange like that... and second, because THAT was my first entry into the world of computers WAAAAAYYYYYY Back when I was in first grade.... and YES I remember those days well.

As noted in my last post I am attempting to build my own linux distro from scratch. I won't go into the why in this post as I covered that in my last. I wanted to make some notes on this process JUST in case someone out there decides to do the same and runs into some of the issues I have faced...

Couple of notes about my UberGeekness....
I did initially learn, and had lots of fun on a commadore, after that came the tandy and the apple 2.... following that was the apple IIe and the Apple Classic and then onto the wonderfull world of windows 3.1 95,98,(skipped me because it really stunk) 2000,xp,2000 server, 2k3 server, (skipped vista cause it was just like ME),linux (all flavors) and Win7

When I jumped into the apple and windows world I pretty much avoided the command line i.e. cli

When I started working in and with linux, in order to truly acomplish what I wanted I was forced to use and learn some basic syntax...

I did not start from scratch, in fact I think my first run in the linux world was with either fedora or ubuntu...

On to today... Under MOST typical circumstances in any given day I am interacting with multiple linux systems as well as the broad majority of usable windows systems.... That said, there are plenty of things I need to learn, and am learning.... The following are some notes while following through the process of building "Linux From Scratch"

-- Learned Lessons:

1. Extracting tar/compressed files
MOST of the files needed come in a bz2 formatted compressed archive. I have never encountered this type of file before and was confused when I tried to run
"tar -xvzf filename.bz2" .... This only works for Gzipped files ".gz"
In order to extract .bz2 files you need to do "tar -xvjf filename.bz2" "tar -xvf filename.bz2" [NOTE: Apparently -xvf works for both and auto-checks the file type unless you specify via 'j',or 'z']

2. The Process....

The linuxfromscratch process should be viewed NOT as a tutorial, but as a collection of cut/paste scripts that need to be run with info on some key points. This is VERY important, as the process leaves a lot of questions if the process doesn't go according to plan. IF something does go wrong... google is your friend. Just sayin.

PROCESS NOTES:
Every page you go to that is working with a package whether install/edit/modify etc, expects 2 things...
a. It expects that you have extracted that package to $LFS/sources/{packagename}
b. It expects you to have "cd"'d into that new dir
so before you beging anything related to a package do this from the $LFS/sources dir (and you can get there by calling "cd $LFS/sources" (no quotes)

tar -xvf packagename.ext
...and when it is done extracting the files...
cd packagename

When you are complete with the instructions on that package then call "cd $LFS/sources" and delete that dir by calling "rm -rfv packageNameYouWereWorkingOn/"

then extract the files for the next package and cd into that dir to start the next one


Little hint here, when dealing with a "bash" shell, tab-completion is your best friend...

If you have never used it, it is quite simple... while typing the name of a file/dir just hit tab when you have typed a couple of letters of the name (no extra space) IF there are more than one file/dir with the same char's you have already typed, it won't show anything... if you immidiately hit tab again it will come up with a list of all that match... i.e. IF you are trying to open a file named "thisismyfilename.txt" with vi
you can type "vi this" and assuming your system is setup to use this feature and it is the only file that begins with "this"(if not just hit tab again to see all files/dir's that match ) it will autofill in the name.... HUGE help when dealing with compressed packages as I really don't want to type something like "tar -xvf util-linux-2.19.tar.bz2" when "tar -xvf ut" works just as well [;o)


3. the /tools dir and the glibc !!!VERY IMPORTANT!!!
Before you begin chapter 6, the actual build process... BACKUP the tools dir...
I did this simply by executing this command (no quotes) "cp -R /tools /tools.fresh "
-R means recursive so it copies everything in all subdirectories
:: The issue I ran into was, I overlooked a mount location in a previous step (proc to be exact) and when glibc ran it caused some errors... The problem is that IF you try to run the make process again, it will get stuck in a loop as some of the dependant files for make have been overwritten... for this I had to log out of chroot, delete the tools dir, and repopulate from fresh and go back through the build steps in ch. 6 up to glibc... after that NO Problem... UNFORTUNATELY this took me 4 hours to figure out!

4. Rebooting your computer

IF you ever need to reboot your computer (it will take days to complete the process so I encourage you to stop at some point and at least take a shower)... IF past chapter 6 you will need to remount your system before chrooting back in to the build...
Here are my one line mounts needed and the chroot command I use to copy/paste for convience (I also have mount points for boot/opt/usr/home... so if you don't have those... ignore)
AFTER REBOOT

export LFS=/mnt/lfs
mount -v /dev/sda8 $LFS
mount -v /dev/sda7 $LFS/boot
mount -v /dev/sda9 $LFS/home
mount -v /dev/sda10 $LFS/opt
mount -v /dev/sda11 $LFS/usr

mount -v --bind /dev $LFS/dev
mount -vt tmpfs shm $LFS/dev/shm
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys

chroot "$LFS" /tools/bin/env -i HOME=/root TERM="$TERM" PS1='\u ($(date +%r)):\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h

That's it for now... I am up to ch 6.35 AutoMake so still have a ways to go... Will update later

No comments: