User Tools

Site Tools


cucumber_linux_from_scratch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
cucumber_linux_from_scratch [2018/09/15 13:52]
z5t1 [Chapter 1 - Introduction]
cucumber_linux_from_scratch [2018/11/07 19:10]
z5t1 [Create Essential Directories]
Line 51: Line 51:
 ===== Downloading the Cucumber Linux Source Tree ===== ===== Downloading the Cucumber Linux Source Tree =====
  
-Clone the Git repository for the official Cucumber Linux source tree:+Add the privilege separation user ''​portuser''​. This user will be the only user with write access the ports tree, as well as the user account used to download all of the sources. It is important that this is an unprivileged account, as it will be connecting to several untrusted servers. 
 + 
 +  useradd -m portuser 
 + 
 +Clone the Git repository for the official Cucumber Linux source tree using portstrap:
  
   install -m 755 -d chroot/usr   install -m 755 -d chroot/usr
-  ​cd chroot/​usr +  ​wget https://raw.githubusercontent.com/​cucumberlinux/​ports/​master/​utilities/​tools/​portstrap 
-  git clone https://github.com/​cucumberlinux/​ports.git+  chmod +x portstrap 
 +  ROOT=/​opt/​culfs/​chroot ​./portstrap
  
-If you are building a version of Cucumber Linux other than the current development versionswitch ​to the appropriate Git branch for it:+When asked to choose the location to clone the ports tree frompress enter to accept ​the default.
  
-  cd ports +When asked which branch of the ports tree to clone, do one of the following: 
-  ​git checkout 2.0 +  ​* If you are building the current development version of Cucumber Linux, enter ''​master''​
-  ​cd ..+  ​* If you are building any other version of Cucumber Linux, enter the version number (i.e. ''​2.0''​). 
 + 
 +When asked to choose the user that will be able to write to the ports tree, enter ''​portuser''​.
  
 Temporarily change the portmake configuration so it expects to find the ports tree in /opt: Temporarily change the portmake configuration so it expects to find the ports tree in /opt:
Line 69: Line 76:
   fi   fi
   echo PORTS_TREE=/​opt/​culfs/​chroot/​usr/​ports > /​etc/​portmake.conf   echo PORTS_TREE=/​opt/​culfs/​chroot/​usr/​ports > /​etc/​portmake.conf
-  ​+
 Download the source tarballs for the phase 2 and 3 packages. This must be done now, as the chroot environment will not have internet access until after phase 3 is built. This step will also verify the integrity of all the downloaded tarballs via checksums and PGP signatures. Download the source tarballs for the phase 2 and 3 packages. This must be done now, as the chroot environment will not have internet access until after phase 3 is built. This step will also verify the integrity of all the downloaded tarballs via checksums and PGP signatures.
  
-  ports/​utilities/​tools/​portmake download-recursive phase2 +  ​chroot/usr/ports/​utilities/​tools/​portmake download-recursive phase2 
-  ports/​utilities/​tools/​portmake download-recursive phase3+  ​chroot/usr/ports/​utilities/​tools/​portmake download-recursive phase3
   ​   ​
 Restore the original portmake.conf. Restore the original portmake.conf.
Line 88: Line 95:
 There are two additional packages that must be downloaded now so they are available immediately inside the chroot environment:​ pkgtools and tar 1.13. Create a directory to store them in: There are two additional packages that must be downloaded now so they are available immediately inside the chroot environment:​ pkgtools and tar 1.13. Create a directory to store them in:
  
-  cd ..+  cd chroot
   mkdir sources   mkdir sources
   cd sources   cd sources
Line 108: Line 115:
 In this chapter, we will perform a few additional tasks to prepare for building the temporary system. In this chapter, we will perform a few additional tasks to prepare for building the temporary system.
  
-===== Adding the lfs user =====+===== Creating Necessary Directories ​=====
   ​   ​
 Create a directory to download the phase 1 source tarballs to:   Create a directory to download the phase 1 source tarballs to:  
  
-  mkdir /opt/culfs/lfscript/sources +  mkdir /​opt/​culfs/​lfscript/​sources
- +
-Ensure that the lfs user has full access to /​opt/​culfs/​lfscript:​ +
- +
-  chown -Rv lfs /​opt/​culfs/​lfscript +
-  ​+
 ====== Chapter 5 - Building Phase 1 ====== ====== Chapter 5 - Building Phase 1 ======
  
Line 136: Line 138:
   ./lfscript -B   ./lfscript -B
   ​   ​
-Note that lfscript will exit with a reported failure. This is because lfscript will attempt to continue on after chapter 5 and begin building chapter 6. It will fail at building chapter 6 (because we don't use it for that part on Cucumber Linux), but will still build the tools tarball successfully. Therefore, this error can be safely ignored. When you reach the error message, press ''​^C''​.+
  
 ===== Installing /tools to the Chroot ===== ===== Installing /tools to the Chroot =====
Line 205: Line 207:
 It is time to create some structure in the LFS file system. Create a standard directory tree by issuing the following commands: It is time to create some structure in the LFS file system. Create a standard directory tree by issuing the following commands:
  
-  mkdir -pv /​{bin,​boot,​etc/​{opt,​sysconfig},​home,​lib/​firmware,​mnt,​opt}+  mkdir -pv /​{bin,​boot,​etc/​{opt,​sysconfig},​home/portuser,​lib/​firmware,​mnt,​opt}
   mkdir -pv /​{media/​{floppy,​cdrom},​sbin,​srv,​var}   mkdir -pv /​{media/​{floppy,​cdrom},​sbin,​srv,​var}
   install -dv -m 0750 /root   install -dv -m 0750 /root
Line 251: Line 253:
   messagebus:​x:​18:​18:​D-Bus Message Daemon User:/​var/​run/​dbus:/​bin/​false   messagebus:​x:​18:​18:​D-Bus Message Daemon User:/​var/​run/​dbus:/​bin/​false
   nobody:​x:​99:​99:​Unprivileged User:/​dev/​null:/​bin/​false   nobody:​x:​99:​99:​Unprivileged User:/​dev/​null:/​bin/​false
 +  portuser::​1000:​999:​Ports Tree Privsep User:/​home/​portuser:/​bin/​bash
   EOF   EOF
  
Line 375: Line 378:
   ​   ​
   gcc -dumpspecs | sed -e '​s@/​tools@@g' ​                  \   gcc -dumpspecs | sed -e '​s@/​tools@@g' ​                  \
-    -e '/​\*startfile_prefix_spec:/​{n;​s@.*@/​usr/​lib${LIBDIRSUFFIX}/​ @}' \+    -e '/​\*startfile_prefix_spec:/​{n;​s@.*@/​usr/​lib'${LIBDIRSUFFIX}'/ @}' \
     -e '/​\*cpp:/​{n;​s@$@ -isystem /​usr/​include@}'​ >      \     -e '/​\*cpp:/​{n;​s@$@ -isystem /​usr/​include@}'​ >      \
     `dirname $(gcc --print-libgcc-file-name)`/​specs     `dirname $(gcc --print-libgcc-file-name)`/​specs
Line 450: Line 453:
 This phase is akin to building a few select packages from the Beyond Linux from Scratch Book. This phase is akin to building a few select packages from the Beyond Linux from Scratch Book.
  
-At the end of this phase the system will be capable of both running *and* compiling itself; however, it will not be complete yet. +At the end of this phase the system will be capable of both running *and* compiling itself; however, it will not be complete yet. 
 + 
 +The entirety this process can be automated with portmake. Run the following (note that this command will take a //long// time): 
 + 
 +  /​usr/​ports/​utilities/​tools/​portmake install phase3
  
 ====== Chapter 8 - Building Phase 4 ====== ====== Chapter 8 - Building Phase 4 ======
Line 456: Line 463:
 This phase is akin to building additional packages from the Beyond Linux from Scratch Book. This phase is akin to building additional packages from the Beyond Linux from Scratch Book.
  
-At the end of this phase the system will be complete. ​+At the end of this phase the system will be complete. 
 + 
 +Similarly, this entire process can be automated with portmake as well. Note that this will take a //very long// time (even longer than phases 1. 2 & 3). 
 + 
 +  /​usr/​ports/​utilities/​tools/​portmake install phase4 
 + 
 +====== Chapter 9 - Creating the Installer Image ====== 
 + 
 +We are done building the packages now, so exit the chroot environment. 
 + 
 +  exit 
 + 
 +===== Getting the Installer Buildscripts ===== 
 + 
 +Navigate to /opt/culfs and download the installer buildscripts from the Cucumber Linux mirror: 
 + 
 +  cd /​opt/​culfs 
 +  rsync mirror.cucumberlinux.com::​cucumber/​cucumber-current/​installer ./ -rv 
 + 
 +===== Preparing the Installer Build Environment ===== 
 + 
 +Create a symlink to the directory containing the binary packages. Replace ''​$CUCARCH''​ with the architecture you are building for (''​i686''​ or ''​x86_64''​). If you are building for both architectures,​ create a separate symlink for each one. 
 + 
 +  ln -s chroot/​opt/​packages/​cucumber cucumber-$CUCARCH 
 + 
 +===== Building the Installer ===== 
 + 
 +==== Build the Initrds ==== 
 + 
 +If desired, rebuild the initrds. This step is optional; if you skip it, the prebuilt initrds in the official Cucumber Linux source tree will be used instead. See the file installer/​README for instructions on this. 
 + 
 +==== Build the ISOs ==== 
 + 
 +Cd to the installer/​iso directory. 
 + 
 +  cd installer/​iso 
 + 
 +If you are not building the ISOs for every architecture,​ you will need to modify iso.buildscript. If you are building for all architectures you can skip this step. 
 + 
 +In iso.buildscript,​ find the line that reads: 
 + 
 +  for a in x86_64 i686; do 
 + 
 +Delete the architectures that you are not building from that line. 
 + 
 +Finally, run iso.buildscript. This will build your installer ISO images and place them in /tmp. 
 + 
 +  ./​iso.buildscript
  
cucumber_linux_from_scratch.txt · Last modified: 2018/11/14 00:12 by z5t1