/LFS-RPM

Linux from scratch with rpm package manager

Primary LanguageShell

This build system requires the following:
	Partition for LFS under build,	mounted at /mnt/lfs
	Fetch build system from https://www.github.com/baho-utot/LFS-RPM

Notes:
	This build system uses su.
	If you don't want to enter the root password on every step then
	you can temporary modify /etc/passwd and remove the x in the
	root user entry.

WARNING:
	This build system can trash your host.  
	DO NOT install/use rpm to install packages unless you are in the
	chrooted system.
	Doing so will install the packages into your host system!

	Always:
		sudo ./scripts/mount.kernel.filesystem.sh
		sudo ./scripts/final.chroot.sh
		rpm -Uvh <package name>
		exit
		sudo ./scripts/umount.kernel.filesystem.sh
	
Procedure for the setting up of the build:
	Login as root
	fdisk /dev/sdxx				- create partition
	mkfs.ext4 /dev/sdxx			- format partition
	install -vdm 777 /mnt/lfs		- create mount point
	mount /dev/sdxx	 /mnt/lfs		- mount work partition
	install -vdm 777 /mnt/lfs/tools		- create tools directory
	ln -sv /mnt/lfs/tools /			- symlink tool directory
	cd /mnt/lfs
	git clone https://github.com/baho-utot/LFS-RPM.git
						- clone repository
	ln -vfs LFS-RPM/rpmbuild		- create symlink
	vi /mnt/lfs/rpmbuild/complete.sh	- edit flags/configuration
	pushd rpmbuild/SOURCES			- switch directory
	wget -nc -i wget-list 			- fetch packages
	wget -nc -i wget-list.rpm		- fetch packages
	md5sum -c md5sums			- verify packages for lfs
	md5sum -c md5sums.rpm			- verify packages for rpm
	popd					- back to parrent
	rpmbuild/SCRIPTS/add.user.lfs.sh	- add lfs user
	chown -R lfs.lfs /mnt/lfs/*		- fix perms
	find . -name '*.sh' -exec chmod +x '{}' \;
						- add execute perms

Procedure to build the tool chain:
	su - lfs 				- login lfs user
	cd /mnt/lfs/rpmbuild			- goto build system
	./complete.sh				- build system & install

Install grub:

Notes:
	This is one way to install grub,
	You will need to edit the set root=(hdx,x) and
	root=/dev/sdxx lines to suit.
	If you don't have a boot partition you will need to
	change: linux vmlinux-3.5.2 root=/dev/sdxx ro
	to:	linux /boot/vmlinux-3.5.2 root=/dev/sdxx ro
	
	grub-install /dev/sdx
	cat > /boot/grub/grub.cfg << "EOF"
	# Begin /boot/grub/grub.cfg
	set default=0
	set timeout=5

	menuentry "GNU/Linux Linux from scratch" {
		insmod ext2
		set root=(hdx,x)
		linux vmlinux-3.5.8 root=/dev/sdxx ro
	 }
 	menuentry "Windows" {
		insmod ntfs
		set root=(hdx,x)
		chainloader +1
	 }
	# End /boot/grub/grub.cfg
	 EOF

Post setup:
	reboot		- reboot and run
	login root
	passwd		- set root password

This completes the build.

You should save the *.rpm and *.srpm files for reuse or to
install this build on other computers.

You can now remove build system if desired. rm -rf /rpmbuild and
rm -rf /tools, to cleanup the root directory.

After login as root to the newly built system do rpm -qa
if it errors you will then need to do:
rpmdb --rebuilddb
That will fix the error with the dabase