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
cucumber_linux_from_scratch [2018/11/07 19:10]
z5t1 [Create Essential Directories]
cucumber_linux_from_scratch [2018/11/14 00:12]
z5t1 [The End]
Line 145: Line 145:
  
   cd ../chroot   cd ../chroot
-  tar -xvJf ../​lfscript/​packages-*/lfs-*/​toolchain.bak.txz+  tar -xvJf ../​lfscript/​packages-*/​toolchain.bak.txz
   ​   ​
 ===== Preparing the Chroot ===== ===== Preparing the Chroot =====
Line 189: Line 189:
  
 At the end of this phase, the system will be capable of running itself (without the /tools directory), but will not be capable of compiling itself yet. At the end of this phase, the system will be capable of running itself (without the /tools directory), but will not be capable of compiling itself yet.
 +
 +
  
 ===== Enter the Chroot ===== ===== Enter the Chroot =====
Line 207: Line 209:
 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/portuser,​lib/​firmware,​mnt,​opt}+  mkdir -pv /​{bin,​boot,​etc/​{opt,​sysconfig},​home,​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 253: Line 255:
   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 293: Line 294:
   chmod 600  /​var/​log/​btmp   chmod 600  /​var/​log/​btmp
  
 +==== Customize Portmake ====
  
 +If desired, you can customize the Portmake configuration. This will let you change the build tag from ''​localport''​. This step is optional.
 +
 +  cp -v /​usr/​ports/​utilities/​templates/​portmake.conf /etc/
 +
 +If desired, edit the file /​etc/​portmake.conf to your liking.
  
 ===== Build a few Packages Manually ===== ===== Build a few Packages Manually =====
Line 346: Line 353:
   chmod 755 /​tools/​bin/​gpg   chmod 755 /​tools/​bin/​gpg
  
 +
 +Also create a dummy sudo to satisfy a dependency in Portmake:
 +
 +  cat > /​tools/​bin/​sudo << EOF
 +  #!/bin/bash
 +  ​
 +  while [ \$# -ne 0 ]; do
 +    case \$1 in
 +      '​-u'​)
 +        shift 2
 +        ;;
 +      *)
 +        exec \$@
 +        ;;
 +    esac
 +  done
 +  EOF
 +  chmod 755 /​tools/​bin/​sudo
  
 Build and install them: Build and install them:
Line 465: Line 490:
 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).+===== Modifying the Chroot Environment =====
  
-  /usr/ports/​utilities/​tools/​portmake ​install phase4+Before we can build the remainder of the system, we must make a few modifications to the chroot environment to enable the ports tree and portmake ​to function properly.
  
-====== Chapter 9 - Creating the Installer Image ======+==== Set up DNS ====
  
-We are done building the packages now, so exit the chroot ​environment.+Create a resolv.conf ​so the chroot ​can resolve DNS queries. Feel free to substitute in your favorite DNS servers here.
  
-  ​exit+  ​cat > /​etc/​resolv.conf << EOF 
 +  nameserver 208.67.222.222 
 +  nameserver 208.67.220.220 
 +  EOF
  
-===== Getting ​the Installer Buildscripts =====+==== Remove ​the Tools Directory ​====
  
-Navigate ​to /​opt/​culfs ​and download the installer buildscripts from the Cucumber Linux mirror:+The ''/​tools''​ directory is no longer needed, so remove it to ensure that the tools located there do not impact phase 4 and update ​the PATH variable accordingly.
  
-  ​cd /opt/culfs +  ​rm -rf /tools 
-  ​rsync mirror.cucumberlinux.com::cucumber/cucumber-current/installer .-rv+  ​export PATH=/bin:/usr/bin:/sbin:/usr/sbin
  
-===== Preparing ​the Installer Build Environment ​=====+===== Building ​the Packages ​=====
  
-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.+Proceed ​to build the phase 4 packages. ​Similarly to phase 3, this entire process can be automated ​with portmake. Note that this will take a //very long// time (even longer than phases 1. 2 & 3).
  
-  ​ln -s chroot/opt/packages/cucumber cucumber-$CUCARCH+  /usr/ports/utilities/​tools/​portmake install phase4
  
-===== Building ​the Installer =====+====== Chapter 9 - Creating ​the Installer ​Image ======
  
-==== Build the Initrds ====+We are done building ​the packages now, so exit the chroot environment.
  
-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.+  exit
  
-==== Build the ISOs ====+===== Getting ​the Installer Buildscripts =====
  
-Cd to the installer/iso directory.+Navigate ​to /opt/culfs and download ​the installer ​buildscripts from GitHub:
  
-  cd installer/iso+  cd /opt/culfs 
 +  git clone https://​github.com/​cucumberlinux/​installer.git 
 + 
 +===== Building the Installer =====
  
-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.+Enter the installer directory.
  
-In iso.buildscript,​ find the line that reads:+  cd installer
  
-  for a in x86_64 i686; do+Run the build-iso.sh script, setting some special variables.
  
-Delete the architectures that you are not building from that line.+  PORTSDIR=/​opt/​culfs/​chroot/​usr/​ports PKGDIR=/​opt/​culfs/​chroot/​opt/​packages ​./​build-iso.sh
  
-Finally, run iso.buildscript. ​This will build your installer ISO images ​and place them in /tmp.+This will the installer ISO file and place it in /tmp.
  
-  ./​iso.buildscript+====== The End ======
  
 +Congrats, you made it!
cucumber_linux_from_scratch.txt · Last modified: 2018/11/14 00:12 by z5t1