LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 11-07-2020, 09:15 AM   #1
athithanvijay
Member
 
Registered: Aug 2020
Posts: 31

Rep: Reputation: Disabled
Building Custom Linux ISO from scratch


Hi All,
I have been trying to build ISO using LFS book. I am fine with the book. But I was not successful for after trying multiple attempts on different versions. Each time it fails on due to some error where I couldn't move further.

Just wanted to know is there any approach to build Linux custom ISO for x86_64 arch with my own modules and make it as bootable ISO to load it into VM.

I heard about Yocto and Buildroot. Any suggestions whether buildroot is simpler than LFS approach
 
Old 11-07-2020, 10:27 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
This may not be quite what you want but it is a start:
https://github.com/KeithDHedger/LFSBootCD
Look at the file
Roll your own Linux Rescue or Setup CD.html
 
Old 11-07-2020, 11:58 PM   #3
athithanvijay
Member
 
Registered: Aug 2020
Posts: 31

Original Poster
Rep: Reputation: Disabled
Thanks for sharing the scripts. It looks much simpler and has got good documentation. let me go through it.

On the other hand I have come across about people where they talk about Yocto and build root as well. It seems these tools are used heavily in software industry. If learning curve is small I am wondering whether I can also try the same
 
Old 11-23-2020, 06:35 AM   #4
athithanvijay
Member
 
Registered: Aug 2020
Posts: 31

Original Poster
Rep: Reputation: Disabled
I have completed LFS 10 chapter 10 on Debian 10 VM successfully. Would appreciate your suggestions towards the next step. I would like to create iso and use that for set up CD so that I can install it in a new VM or PC.

As mentioned by @Keith Hedger,Roll your own Linux Rescue or Setup CD.html at https://github.com/KeithDHedger/LFSBootCD seems to be a solution for that as they achieved the same purpose using lfs. I am not sure whether I need to run both build_iso and build_diskimage files.

I have used instructions from lfs. All went fine. The other thing is I didn't create any partition for lfs as mentioned in the book. Now I have got file system(chapter 8), boot scripts(chapter 9),kernel-config-5.8.3, vmlinuz-5.8.3-lfs-10.0, and System.map-5.8.3(chapter 10) in /home/vijay/lfs directory.

Now I need to create an installer file which would create partitions in the target system and install kernel, file system then call the boot scripts. I also need to create iso file. Not sure which code will create initial ramdisk related code. Anything else is there in the process?

can someone guide me in simple steps on things to be done or providing some more references so that I learn more.

Last edited by athithanvijay; 11-23-2020 at 06:38 AM.
 
Old 11-28-2020, 05:51 PM   #5
fiajm
LQ Newbie
 
Registered: Nov 2020
Distribution: Debian
Posts: 4

Rep: Reputation: Disabled
I think your question is not clear (regardless you said you want for a VM) because an ISO is common term for the installer

Do you want a raw LFS image like a live iso, don't you?

First of all finish having a installed LFS system (functional, booteable, with its own partition) is mandatory. When you finish simply copy the partition with dd and try to put it in the VM.

Otherwise if you are looking for a LFS installer you could make a script that personalize the instalation (copying files and defining user, keyboardlayout, passwd...), you would need to manage the new loader and some firmware specific for the hardware and also the new partitions of the new system (Calamares may help)

I expect this help, if not, specify more concretely your problem.
 
Old 11-29-2020, 09:27 AM   #6
athithanvijay
Member
 
Registered: Aug 2020
Posts: 31

Original Poster
Rep: Reputation: Disabled
Thanks for your inputs. I can download Ubuntu ISO or Debian from their website and install it in a VM or PC. Can we do the same with our own distribution?

I try to build a custom Linux distribution with our own modules in an R&D setup. I follow guidelines from LFS 10 to build distribution.

we should be able to install it in a VM, PC or appliance depends on whether we use it for testing purposes, demo purposes or production use. We prefer X86_64 based on arch.

Now we need an installer for that as you mentioned(LFS installer). It seems I lack an understanding of these aspects such as installer, iso creation etc. Currently, I refer http://www.linuxfromscratch.org/hint...ot-cd_easy.txt to understand things that happen in the background.

I have tried to explain what I try to do in more concrete terms.

Let me try to explore further
 
Old 11-29-2020, 04:07 PM   #7
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,345

Rep: Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588
If I read it correctly, the op wants to create an installation iso of a built lfs system, so when the iso is booted in a vm, one can run an installation script similar to other distributions install iso.

If, so the question should be broken down in to two parts,
how to create an iso from a pre-built lfs system?
How to create an installation script?


another source to create a live iso from an installed system:
https://www.linux-live.org/
How to create an iso has been answered, to give any additional help on creating iso you have will need to give details on where the making of the iso/booting iso is failing.

Last edited by colorpurple21859; 11-29-2020 at 04:44 PM.
 
Old 11-29-2020, 11:34 PM   #8
athithanvijay
Member
 
Registered: Aug 2020
Posts: 31

Original Poster
Rep: Reputation: Disabled
You have put things in a perfect manner. I appreciate that clarity. Thanks for that.

As on Aug 2020, we had some old shell scripts that would automatically download sources, build them in LFS way(Linux kernel 3.x), create ISO with installation scripts as well.

Then we wanted higher version of Kernel and other packages, those scripts didn't help and we also didn't know what those scripts are doing in different stages. We know how to write programs but didn't know about underlying things. Hence I started this learning.

I learned the following things from LFS 10 and other sources.
  1. How to create tool chain for X86_64 target system
  2. How to build basic tools using tool chain
  3. how to create file system with directory structure
  4. How to build development packages such Perl,Python etc
  5. How to build application packages
  6. How to build kernel
  7. How to build default init scripts - /etc/rc.d etc
  8. How to update grub

As mentioned earlier I didn't create partition to build LFS system. Remaining things are how to create ISO and installation script. These things I have to try and understand so that in future I don't have to struggle again though we use other Linux distributions as well.

From LFS hints I see following steps
1. What do you need and what is the idea?
2. Configure & compile Kernel, add packages, other tweaks
3. Add bootloader.
4. Move /etc /var /root /home to /fake/needwrite and make symlinks
5. Create boot script which mounts the ramdisk
6. Tweaks for running with CD as root fs.
7. Create initial ramdisk
8. (Optional) compress /usr
9. Create initial ramdisk
9a. Burn the Boot CD
10. Reboot and enjoy

Let me try www.linux-live.org as well and get back.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Custom LiveOS ISO with Custom Files and RPMs niteshadw Red Hat 1 11-06-2012 10:44 AM
Does anyone Know how to open either .iso.rz or these .iso.xdelta,.iso.bz2,.iso.lzma?? maximalred Debian 5 06-09-2004 06:15 AM
ali aladdin v agp stinks :scratch: :scratch: :scratch: Mr Marmmalade Linux - Hardware 1 07-08-2003 05:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 06:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration