mirror of
https://github.com/KeithDHedger/LFSPkgBuilds.git
synced 2026-01-12 15:43:15 +00:00
481 lines
15 KiB
Plaintext
481 lines
15 KiB
Plaintext
|
|
Instructions for Raspberry Pi 4 !ONLY!
|
|
|
|
1)
|
|
|
|
#Set some env vars to make copy/paste easier, ( change as needed for your setup ).
|
|
#Folders should be pre created, change paths to suit,
|
|
#Use sudo where necessary to create links etc.
|
|
#It will be assumed that your LFS partition is mounted on /mnt/LFS, using /dev/mmcblk0p11 <--- You MUST set this correctly!
|
|
|
|
|
|
#If compiling on raspberian you need to install some extra files like so:
|
|
apt-get update
|
|
apt-get install bison gawk m4 texinfo
|
|
#Also make sure /bin/sh points to /bin/bash
|
|
|
|
#This step is optional.
|
|
#Some scripts can include user options so copy the LFSPkgBuildScripts/pkgoptions to a /etc like so:
|
|
sudo mkdir -vp /etc/pkgoptions
|
|
#Make sure you can edit the files:
|
|
sudo chmod 777 /etc/pkgoptions
|
|
sudo chmod 666 /etc/pkgoptions/*
|
|
cp LFSPkgBuildScripts/pkgoptions/* /etc/pkgoptions
|
|
|
|
LFS=/mnt/LFS
|
|
LFSVERSION=10.1
|
|
SOURCEARCHIVES=/LFSSourceArchives/$LFSVERSION
|
|
PKGARCHIVES=/LFSBuiltPackages/$LFSVERSION
|
|
EXTFOLDER=
|
|
PIKERNELVERSION=5.10.y
|
|
PIVERS=4
|
|
PIBUILD=1
|
|
PIBOOTDEV=/dev/mmcblk0p10
|
|
PIROOTDEV=/dev/mmcblk0p11
|
|
|
|
export LFS
|
|
export LFSVERSION
|
|
export SOURCEARCHIVES
|
|
export PKGARCHIVES
|
|
export EXTFOLDER
|
|
export KERNELVERSION
|
|
export PIVERS
|
|
export PIBUILD
|
|
export PIBOOTDEV
|
|
export PIROOTDEV
|
|
|
|
#Own the files ( If needed ):
|
|
[sudo -E] chown -R $USER:$USER $LFS/LFSPkgBuilds
|
|
|
|
2)
|
|
#If you want a swap file set up for later do:
|
|
sudo dd if=/dev/zero of=swapfile bs=1M count=512
|
|
sudo chmod 600 swapfile
|
|
sudo mkswap swapfile
|
|
sudo swapon -v swapfile
|
|
#set count to the size of the swapfile needed.
|
|
|
|
3)
|
|
#cd into the LFSScripts folder
|
|
cd $LFS/LFSScripts
|
|
|
|
#Set up config files !!IMPORTANT!!
|
|
#You can just press 'Return' to accept the default.
|
|
#Run:
|
|
[sudo -E] ./LFSSetUp
|
|
|
|
#To check config:
|
|
./ShowSystemData
|
|
|
|
#You can rerun LFSSetUp if needed.
|
|
|
|
4)
|
|
#make sure normal user owns $LFS ( if you are using a dedicated user change $USER if needed ).
|
|
[sudo -E] chown $USER $LFS
|
|
#Run BuildTools script:
|
|
./BuildTools1
|
|
|
|
5)
|
|
#Run BuildFileSystem script:
|
|
[sudo -E ] ./BuildFileSystem
|
|
|
|
6)
|
|
#Enter chroot
|
|
[sudo] ./Chroot
|
|
cd /LFSScripts
|
|
|
|
7)
|
|
#finish building tempory tools.
|
|
./BuildTools2
|
|
exit
|
|
|
|
#Make sure you are no longer in the chroot. !IMPORTANT!
|
|
|
|
8)
|
|
cd $LFS
|
|
[sudo] find usr/{lib,libexec} -name \*.la -delete
|
|
[sudo] rm -rf usr/share/{info,man,doc}/*
|
|
[sudo] strip --strip-debug usr/lib/*
|
|
[sudo] strip --strip-unneeded usr/{,s}bin/*
|
|
[sudo] strip --strip-unneeded tools/bin/*
|
|
|
|
#tar MUST be run as root to preserve permissions.
|
|
#change ${HOME}/tools-${LFSVERSION}.tar.xz to suit.
|
|
#make sure all virtual file systems etc are unmounted, including /LFSSourceArchives etc if you have mounted an extern drive there.
|
|
#If you did NOT bind an external disk to /LFSSourceArchives, you may want to add --exclude="./LFSSourceArchives" to the tar command below, ( no real need to include the source archives into the tools archive ).
|
|
[sudo -E] tar --one-file-system --exclude="./LFSPkgBuilds" --exclude="./LFSScripts" --exclude="./LFSPkgBuildScripts" -apcv -f ${HOME}/tools-${LFSVERSION}.tar.xz .
|
|
|
|
9)
|
|
#make sure you are back in the lfsscripts folder.
|
|
cd $LFS/LFSScripts
|
|
|
|
#Mount bind external folder if set and if not already mounted.
|
|
. ./SystemData
|
|
mkdir -vp ${LFS}/${SOURCEARCHIVES}||true
|
|
mkdir -vp ${LFS}/${PKGARCHIVES}||true
|
|
if [ "X$EXTFOLDER" != "X" ];then
|
|
sudo mount --bind $EXTFOLDER/${PKGARCHIVES} $LFS/${PKGARCHIVES}
|
|
sudo mount --bind $EXTFOLDER/${SOURCEARCHIVES} $LFS/${SOURCEARCHIVES}
|
|
fi
|
|
|
|
10)
|
|
#You may/will have to re-own/set perms the various folders etc, so:
|
|
[sudo -E ] chown -R $USER:$USER $LFS/LFSPkgBuilds $LFS/LFSSourceArchives/$LFSVERSION $LFS/LFSBuiltPackages/$LFSVERSION
|
|
chmod -R 755 $LFS/LFSSourceArchives/$LFSVERSION $LFS/LFSBuiltPackages/$LFSVERSION
|
|
|
|
11)
|
|
#Create a link from downloaded linux tarball to /LFSSourceArchives/$LFSVERSION/KERNEL to prevent re-downloading source tarball.
|
|
mkdir $LFS/LFSSourceArchives/$LFSVERSION/KERNEL
|
|
cd $LFS/LFSSourceArchives/$LFSVERSION/KERNEL
|
|
ln -snfv ../SYSTEM/rpi-$PIKERNELVERSION.tar.gz .
|
|
|
|
12)
|
|
#get the package manager archive via the host system:
|
|
cd $LFS/LFSPkgBuildScripts/admin/LFSPkg
|
|
wget -c --no-check-certificate "https://github.com/KeithDHedger/LFSPkg/archive/master.zip" -O LFSPkg.zip
|
|
unzip LFSPkg.zip
|
|
|
|
13)
|
|
#Change back to $LFS/LFSScripts folder.
|
|
cd $LFS/LFSScripts
|
|
|
|
#If you are building over ssh you may want to start a screen session that you can come back to later.
|
|
screen
|
|
|
|
#Chroot into temporary system:
|
|
[sudo -E] ./Chroot
|
|
|
|
14)
|
|
#You should now be in the chroot
|
|
#First install lfspkg:
|
|
cd /LFSPkgBuildScripts/admin/LFSPkg
|
|
BOOTSTRAP=1 ./LFSPkg.LFSBuild install
|
|
#If you are asked whether to replace files etc You should reply 'R' to keep the settings created by the LFSSetup script.
|
|
|
|
#As part of the LFSSetUp script $LFS/etc/lfspkg.rc has been created to contain basic info needed by lfspkg, review and change if needed.
|
|
#Set $LFS/etc/lfspkg.rc variables, make sure the SOURCEARCHIVES points to the same place as $SOURCEARCHIVES from SystemData.local as that's where the main LFS system source files are, you can do this either from in the chroot environment or from the host with root permissions.
|
|
#At this point wget/openssl is not installed so you will get a load of complaints from lfspkg about no wget etc, ignore them as lfspkg will be reinstalled later with the main system.
|
|
|
|
#You should run lfspkg --setup to create the lfspkg.rc file ( in /etc )
|
|
#Rc files are sourced from /etc/lfspkg.rc
|
|
#lfspkg --setup can be run again later if you need/want to change source/build folders etc.
|
|
#For building the main system you should probably set the configure options config files in /etc and log options.
|
|
lfspkg --setup
|
|
|
|
#You shoud probably set log file to 1, and check etc to 0 when installing the base system.
|
|
#You can rerun lfspkg --setup at any time to tweak the settings.
|
|
#after installing the base system you will probably want to at least set check etc to 1.
|
|
|
|
15)
|
|
#Remake a ( possibly ) broken symlink
|
|
cd /LFSPkgBuildScripts/system
|
|
ln -snvf ../../../LFSScripts/PkgVersions PkgVersions
|
|
|
|
#Build main system:
|
|
cd /LFSPkgBuildScripts/system/system-meta
|
|
|
|
#LFSSetUp will have created a symlink to your desired init type so use:
|
|
./system-meta.LFSBuild install
|
|
|
|
Wait for script to complete:
|
|
...
|
|
Have coffee
|
|
Walk the dog
|
|
...
|
|
|
|
16)
|
|
#logout from temporary system:
|
|
exit
|
|
|
|
18)
|
|
#Re-enter the chroot:
|
|
cd $LFS/LFSScripts
|
|
[sudo -E] ./Chroot
|
|
|
|
19)
|
|
#You MUST rebuild lfspkg after completeing the the basic system and removing the tools folder.
|
|
#Use same process as 2)/7) EXCEPT do NOT use BOOTSTRAP=1
|
|
#If you have set any vairiable in /etc/lfspkg.rc then reply 'R' ( without the quotes ) when asked about replacing files in /etc.
|
|
#If you forgot to do the above bit just re-edit /etc/lfspkg.rc:
|
|
|
|
cd /LFSPkgBuildScripts/admin/LFSPkg
|
|
./LFSPkg.LFSBuild
|
|
#rerun setup if needed, ( probably best to set "Check /etc For Possible Config File Clashes" to 1 now.
|
|
lfspkg --setup
|
|
|
|
13)
|
|
#No point in compiling your own kernel on pi so prebuilt one is used.
|
|
#But you may want to set up wifi now so:
|
|
cd /LFSPkgBuildScripts/net/wpa-supplicant/
|
|
./wpa-supplicant.LFSBuild install
|
|
#configure
|
|
wpa_passphrase SSID SECRET_PASSWORD > /etc/sysconfig/wpa_supplicant-wifi0.conf
|
|
#Set the country code:
|
|
sed -i '1s/^/country=GB\n/' /etc/sysconfig/wpa_supplicant-wifi0.conf
|
|
|
|
cd /LFSPkgBuildScripts/HelperScripts/
|
|
#dialog program not yet installed so use:
|
|
./InstallService wpa
|
|
|
|
#Don't forget to set up /etc/sysconfig/ifconfig.wifi0 if nessasary ( a default is created based on /LFSSourceArchives/10.1/SYSTEM/SystemData.local ).
|
|
#Disable eth0
|
|
mv /etc/sysconfig/ifconfig.eth0 /etc/sysconfig/XXifconfig.eth0XX
|
|
|
|
#Openssh and the sshd init script is installed by the system-meta package the init scripts for ntpd and gpm are also installed.
|
|
|
|
14)
|
|
#Optional - Add your shiny new LFS to the NOOBS boot menu.
|
|
#If you have installed LFS onto a spare partition on your NOOBS card you can easily add LFS to the boot menu like so:
|
|
|
|
#IMPORTANT! before changing ANY files that may affect your pi booting up MAKe A COPY!!!
|
|
#First locate and mount the SETTINGS partition ( usually /dev/mmcblk0p5 ), the blkid command can take several seconds to complete.
|
|
sudo blkid
|
|
|
|
#In my case the SETTINGS partition is /dev/mmcblk0p5 mounted on /media/keithhedger/SETTINGS, change the mount point to suit yourself.
|
|
#You can either mount the partition manually or via your filemanager either way you will probably need root perms to make alterations.
|
|
#You can also use extended attribute like so:
|
|
sudo setfacl -bRm u:${USER}:rwx /media/keithhedger/SETTINGS
|
|
|
|
#Create a LFS folder and add a nice image, the image should be apng image and no bigger than about 48x48:
|
|
cd /media/keithhedger/SETTINGS
|
|
mkdir -vp os/LFS
|
|
#Change image path to suit.
|
|
cp ~/Desktop/LFSTux.png os/LFS
|
|
|
|
#Backup menu file then open in text editor.
|
|
cp installed_os.json installed_os.json.BAK
|
|
|
|
#Scroll to bottom and change the last '}' to '},' ( without quotes ).
|
|
#Then insert the following between '},' and ']'
|
|
|
|
{
|
|
"bootable" : true,
|
|
"description" : "LFS System",
|
|
"icon" : "/settings/os/LFS/LFSTux.png",
|
|
"name" : "LFSKodi",
|
|
"partitions" : [
|
|
"/dev/mmcblk0p10"
|
|
],
|
|
"release_date" : "2018-03-04",
|
|
"supported_models" : [
|
|
"Pi 4"
|
|
]
|
|
}
|
|
|
|
#Change the description to suit, image path to suit, change the release-date to suit and change supported models to suit.
|
|
#Most important! change the boot partition to your newly created LFS boot partition, in this example it is /dev/mmcblk0p10 as set at the beginning of the HowTo.
|
|
|
|
#Save and exit unmount as needed and reboot.
|
|
|
|
#########################
|
|
# If you have trouble ssh'ing into the 'real' LFS system you may need to manually set the date if the ntpd server takes too long, eg:
|
|
ntpdate -s time.nist.gov
|
|
#########################
|
|
|
|
#Install any extra hardware/firmware packages you need ( you may have to boot into the 'real' system for this ).
|
|
#eg usb wireless package:
|
|
cd /LFSPkgBuildScripts/hware/RTL88x2BU-Linux-Driver
|
|
./RTL88x2BU-Linux-Driver.LFSBuild install
|
|
|
|
22)
|
|
#Before building the X server now is a good time to quickly boot into your new system and make sure all is OK, you can then reboot back to the host and continue building in the chroot or build in the 'real' system, the choice is yours but this HowTo assumes all building is done in the chroot.
|
|
#Build xorg:
|
|
cd /LFSPkgBuildScripts/xorg/xorg-meta/
|
|
./xorg-meta.LFSBuild install
|
|
|
|
#BLFS optional extras
|
|
#You should mix and match to suit your own needs this is just what I do for a full desktop
|
|
|
|
#wifi
|
|
#Install wireless tools
|
|
cd /LFSPkgBuildScripts/net/wireless-tools
|
|
./wireless-tools.LFSBuild install
|
|
|
|
cd /LFSPkgBuildScripts/net/wpa-supplicant
|
|
./wpa-supplicant.LFSBuild install
|
|
|
|
#Install a binary jdk, this is circular dependency for openjdk and set up jdk environment ( assumes jdk is in /opt change to suit ).
|
|
cat > /etc/profile.d/openjdk.sh << "EOF"
|
|
# Begin /etc/profile.d/openjdk.sh
|
|
|
|
# Set JAVA_HOME directory
|
|
JAVA_HOME=/opt/jdk
|
|
|
|
# Adjust PATH
|
|
pathappend $JAVA_HOME/bin
|
|
|
|
# Add to MANPATH
|
|
pathappend $JAVA_HOME/man MANPATH
|
|
|
|
# Auto Java CLASSPATH: Copy jar files to, or create symlinks in, the
|
|
# /usr/share/java directory. Note that having gcj jars with OpenJDK 8
|
|
# may lead to errors.
|
|
|
|
AUTO_CLASSPATH_DIR=/usr/share/java
|
|
|
|
pathprepend . CLASSPATH
|
|
|
|
for dir in `find ${AUTO_CLASSPATH_DIR} -type d 2>/dev/null`; do
|
|
pathappend $dir CLASSPATH
|
|
done
|
|
|
|
for jar in `find ${AUTO_CLASSPATH_DIR} -name "*.jar" 2>/dev/null`; do
|
|
pathappend $jar CLASSPATH
|
|
done
|
|
|
|
export JAVA_HOME
|
|
unset AUTO_CLASSPATH_DIR dir jar
|
|
|
|
# End /etc/profile.d/openjdk.sh
|
|
EOF
|
|
|
|
mkdir -vp /etc/sudoers.d/
|
|
cat > /etc/sudoers.d/java << "EOF"
|
|
Defaults env_keep += JAVA_HOME
|
|
Defaults env_keep += CLASSPATH
|
|
EOF
|
|
|
|
#Only do this the first time.
|
|
cat >> /etc/man_db.conf << "EOF"
|
|
# Begin Java addition
|
|
MANDATORY_MANPATH /opt/jdk/man
|
|
MANPATH_MAP /opt/jdk/bin /opt/jdk/man
|
|
MANDB_MAP /opt/jdk/man /var/cache/man/jdk
|
|
# End Java addition
|
|
EOF
|
|
|
|
mkdir -vp /var/cache/man
|
|
|
|
cd /LFSPkgBuildScripts/devel/binaryjdk
|
|
./binaryjdk.LFSBuild install
|
|
|
|
#Install documentation stuff
|
|
#Loads of apps need these for building documentation so might as well install now.
|
|
cd /LFSPkgBuildScripts/devel/gtk-doc
|
|
./gtk-doc.LFSBuild install
|
|
|
|
cd /LFSPkgBuildScripts/devel/doxygen
|
|
./doxygen.LFSBuild install
|
|
|
|
#Install cups and gtk.
|
|
#Gtk2 has a 'soft' dependency on cups so best to buils cups first.
|
|
cd /LFSPkgBuildScripts/print/cups
|
|
./cups.LFSBuild install
|
|
|
|
cd /LFSPkgBuildScripts/gtk/gtk
|
|
./gtk.LFSBuild install
|
|
|
|
#Development stuff
|
|
cd /LFSPkgBuildScripts/devel/development-meta
|
|
./development-meta.LFSBuild install
|
|
|
|
#xsane frontends and xsane require gimp installed first to build the plugin
|
|
cd /LFSPkgBuildScripts/desktop/gimp
|
|
./gimp.LFSBuild install
|
|
|
|
#The rest of the printing stuff
|
|
cd /LFSPkgBuildScripts/print/printing-meta
|
|
./printing-meta.LFSBuild install
|
|
|
|
#Multi media
|
|
cd /LFSPkgBuildScripts/mm/mm-meta
|
|
./mm-meta.LFSBuild install
|
|
|
|
#The big one! build a complete desktop
|
|
#This meta packagage includes other meta packages and takes a LOOOooooonnnnggggg time to build!
|
|
#This is for an xfce4 desktop.
|
|
cd /LFSPkgBuildScripts/desktop/desktop-meta
|
|
./desktop-meta.LFSBuild install
|
|
|
|
#Or for an LFSDesktop
|
|
cd /LFSPkgBuildScripts/lfsdesktop/LFSDesktop-meta
|
|
./LFSDesktop-meta.LFSBuild install
|
|
|
|
#Or just xfce4
|
|
cd /LFSPkgBuildScripts/xfce/xfce4-meta
|
|
./xfce4-meta.LFSBuild install
|
|
|
|
#Extra odd stuff
|
|
#Browsers
|
|
#Chromium chromium takes a LOT of resouces to build, so I would suggest the oficial chrome build.
|
|
cd /LFSPkgBuildScripts/desktop/chromium
|
|
|
|
#Chrome binary
|
|
#NOTE this is an x86_64 ONLY package from the 'official' chrome deb.
|
|
cd /LFSPkgBuildScripts/desktop/google-chrome
|
|
./google-chrome.LFSBuild install
|
|
|
|
#Falkon
|
|
cd /LFSPkgBuildScripts/qt/falkon/
|
|
./falkon.LFSBuild install
|
|
|
|
#Cairo-dock-plugins pulls in cairo-dock as a dependency
|
|
cd /LFSPkgBuildScripts/desktop/cairo-dock-plugins
|
|
./cairo-dock-plugins.LFSBuild install
|
|
|
|
#Samba
|
|
cd /LFSPkgBuildScripts/net/samba
|
|
./samba.LFSBuild install
|
|
|
|
#Fuse and stuff
|
|
cd /LFSPkgBuildScripts/net/sshfs
|
|
./sshfs.LFSBuild install
|
|
|
|
cd /LFSPkgBuildScripts/net/davfs2
|
|
./davfs2.LFSBuild install
|
|
|
|
cd /LFSPkgBuildScripts/net/curlftpfs
|
|
./curlftpfs.LFSBuild install
|
|
|
|
#Qemu builds both static and dynamically linked versions
|
|
cd /LFSPkgBuildScripts/hware/qemu
|
|
./qemu.LFSBuild install
|
|
|
|
#Seamonkey for web dev
|
|
cd /LFSPkgBuildScripts/net/seamonkey
|
|
./seamonkey.LFSBuild install
|
|
|
|
#If you are building in chroot you will pobably have to rerun the postinstall script for this package AFTER booting to the 'real' system.
|
|
cd /LFSPkgBuildScripts/admin/mariadb
|
|
./mariadb.LFSBuild install
|
|
|
|
#Add users
|
|
cd /LFSPkgBuildScripts/HelperScripts/
|
|
./UsersAndGroups YOURUSERNAME
|
|
|
|
#System admin/security stuff
|
|
cd /LFSPkgBuildScripts/admin/logrotate
|
|
./logrotate.LFSBuild install
|
|
|
|
cd /LFSPkgBuildScripts/net/iptables
|
|
./iptables.LFSBuild install
|
|
|
|
cd /LFSPkgBuildScripts/net/fail2ban
|
|
./fail2ban.LFSBuild install
|
|
|
|
#Odd stuff
|
|
cd /LFSPkgBuildScripts/xorg/xbindkeys
|
|
./xbindkeys.LFSBuild install
|
|
|
|
cd /LFSPkgBuildScripts/qt/qt-creator
|
|
./qt-creator.LFSBuild install
|
|
|
|
#Conky is getting increasingly tied to gnome and difficult ( impossible! )to build.
|
|
#cd /LFSPkgBuildScripts/desktop/conky
|
|
#./conky.LFSBuild install
|
|
|
|
#Try an alternative!
|
|
cd /LFSPkgBuildScripts/desktop/gkrellm
|
|
./gkrellm.LFSBuild install
|
|
|
|
|
|
|
|
#TODO
|
|
|
|
cd /LFSPkgBuildScripts/net/libcddb
|
|
./libcddb.LFSBuild install
|
|
|
|
cd /LFSPkgBuildScripts/desktop/epdfview
|
|
./epdfview.LFSBuild install
|
|
|