qLinux
… a distribution study
        
Next >> Build the Cross-Toolchain
These are just notes to develop lfs with musl.
Preparations
Conventions
Through the instructions some naming conventions are used. These are not a standard and could be freely chosen too, however:
- the core (operating) system will be installed in $LFS/qlnx
- the (cross-)tools will be in $LFS/_tools
- the downloads will be in $LFS/_sources (including patches from the book)
- The sources will be extracted under
 /data/src 
Temporary required directories in  / 
(of $LFS) will be prefixed with  _ 
(underscore), afterwards symlink'd (e.g.  /_usr → /usr 
. This makes it easier to identify directories which are not part of the final qLinux. The installation of musl requires a symlink  $LFS/qlnx → /qlnx 
. For historical compatibility reasons a symlink  $LFS/_tools → /tools 
is recommended. If not stated otherwise each section starts in $LFS.
General Build Instructions
The build instructions are similar to the book.
Privileges
Some steps requires root privileges. Against the book it is highly recommended to use  sudo 
and do not login as the root user. An example of an sudoers file (change it to your needs):
Defaults: LFS env_keep += "LFS" User_Alias LFS = lfs Cmnd_Alias X = /bin/ln -s, \ /bin/chown LFS ALL=(root) NOPASSWD: /home/users/lfs/dochroot lfs ALL=(root) NOPASSWD: X
Add more commands to the  Cmnd_Alias 
if required. From now on everything should be done with the lfs user.
Directories
By default we do not create a lot of directories like in the book but the real required ones at time. Right now there are two directories only:
mkdir -p $LFS/{qlnx,tmp}
Commonly directories will be created by make install of the packages. At some point it have to be done by hand. This will explicitly mentioned.
Environment
Before the chroot'ed environment will be entered an unprivileged user will be used. Create the lfs user. Make sure the the environment is clean, put the following into the user's shell start files:
set +h umask 022 LFS=/mnt/LFS LC_ALL=POSIX LFS_TGT=$(uname -m)-linux-musl PATH=/usr/bin # add /bin to the path if it's not a symlink if [ ! -L /bin ]; then PATH=$PATH:/bin; fi PATH=$LFS/_tools/bin:$PATH export LFS LC_ALL LFS_TGT PATH
With bash as shell put it into a file  ~./bashrc-lfs 
and source it in  ~.bashrc 
and/or  ~/.bash_profile 
.
<< Prev Introduction
        
Next >> Build the Cross-Toolchain