LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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-12-2012, 03:18 PM   #1
Z4kW0lf
LQ Newbie
 
Registered: Nov 2012
Posts: 9

Rep: Reputation: 0
Question CLFS UEFI bootloader, updating, and changing kernel to linux-libre


Hello all, it's my first post on LQ, so I hope I'm not doing anything wrong.

I have been a GNU/Linux user since 2009, but started to know my way around at about 2011.
I am posting from my Arch installation from Firefox while PPL runs its test suite, in 64bit, on an xterm window.
I am building a multilib CLFS system, following the 1.2.0 version of the x86_64 multilib book.

I haven't used any package management technique, I am following the book letter by letter. The only issue I ran in so far was a problem with compiling GCC, problem that was quickly resolved with a gengtype.c patch after 10 seconds of googling.

My motherboard is an ASRock Z77 Pro3 using UEFI instead of the usual BIOS. On Arch, that only means installing grub-efi-x86_64 and efibootmgr instead of just GRUB, but it's not overcomplicated.

However, UEFI is not mentioned anywhere in the CLFS book. (If it is and I haven't seen it, feel free to punch me in the face repeatedly while screaming "RTFM BETTER!") I do not know how to install an UEFI bootloader on CLFS, so that's my first question:

1) How do I manage to boot CLFS on a 64-bit UEFI environment?

The two others are questions to which I have only found partial or no answer while googling.

2) How can I update the CLFS packages after building the system? Do I have to rebuild it from scratch with the updated packages?(I hope I don't have to )

3) How can I change the kernel to linux-libre...and update it to the latest version?

I want to to build a free as in freedom minimal system base to work on later, and the libre kernel is a prerequisite for it.
Do I have to rebuild the entire system from scratch? If I have to, is there a way to automate the boring compiling process?

That's it with my questions, sorry for my bad English(I am from Italy) and thanks in advance

Last edited by Z4kW0lf; 11-12-2012 at 03:24 PM.
 
Old 11-15-2012, 10:45 AM   #2
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 464

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by Z4kW0lf

1) How do I manage to boot CLFS on a 64-bit UEFI environment?
I don't use EFI, but I would expect there to be at least a good chance that your Arch GRUB 2 boot loader can detect your LFS system and add an entry for it in your Arch boot menu. That's one idea anyway. If you want to try that, then just don't do the steps to install the boot loader for your LFS system. Install the GRUB-2.00 package, of course, in case you need it to try another way. Just don't do the steps in the book to install the boot loader, or the exiting bootloader will be busted. Then update Arch's GRUB boot loader in the usual way.

Somebody else may be able to discuss directly booting your new system with EFI if you prefer that.

Quote:
Originally Posted by Z4kW0lf

2) How can I update the CLFS packages after building the system? Do I have to rebuild it from scratch with the updated packages?(I hope I don't have to)
Just like the LFS book, the CLFS book talks about that subject in the Package Management chapter. Sometimes you can just re-install the newer version of a package. Sometimes, it's better to rebuild the whole system. It mostly depends on the package being updated and how other things are compiled against it. Anyway, I've gotten to the point where I can build LFS in one evening. And I look forward to every new version of the book. So rebuilding the LFS system is not something that I dread. It's the BLFS system built on top of it that still takes me three weeks of evenings to finish. I've been rebuilding the whole thing about every six months when a new LFS book is released.

Quote:
Originally Posted by Z4kW0lf

3) How can I change the kernel to linux-libre...and update it to the latest version?
Honestly, I had never heard of linux-libre until you mentioned it. But it's any easy read with Google. Apparently, it's a project that offers a modified Linux kernel with non-free software removed from it. To me, that would be installed like any other Linux kernel. New Linux kernels are installed alongside old ones. The new kernel has new files in /boot and a new folder in /lib/modules. The firmware for all kernels gets co-mingled in the same /lib/firmware folder. Removing an old unwanted kernel can be done by deleting its files in /boot and its folder in /lib/modules. I never do anything to /lib/firmware when deleting old kernels. If you choose to install a kernel's docs (I don't), then they can be deleted when the kernel is deleted.

So first, I would install the standard kernel specified in your book. Get that booting and working satifactorily. Create a tarball backup. Then install the linux-libre kernel in the usual way. You should end up with new vmlinuz, System.map, and config files in your /boot directory. There will be a new folder in /lib/modules. Its firmware will be co-mingled with the existing firmware in /lib/firmware. Anyway, if the system still boots and works normally with the new kernel, then you can delete the other kernel's boot files and modules subfolder if you want. If you want to be a purist about that non-free firmware that will still be in /lib/firmware, then you will need to do something about that. Maybe rename the /lib/firmware folder just before installing the linux-libre kernel. Obviously, I never tried that (and I'm not going to), but I predict that it will result in a new /lib/firmware folder being created containing only the linux-libre firmware. If so, and if the system still boots with the new kernel, delete the old renamed firmware folder. It works in my head anyway. No promises though. You may find that you need some of that non-free firmware to boot.

Last edited by stoat; 11-15-2012 at 10:48 AM.
 
2 members found this post helpful.
Old 11-15-2012, 02:15 PM   #3
Z4kW0lf
LQ Newbie
 
Registered: Nov 2012
Posts: 9

Original Poster
Rep: Reputation: 0
Lightbulb

Quote:
Originally Posted by stoat View Post
I don't use EFI, but I would expect there to be at least a good chance that your Arch GRUB 2 boot loader can detect your LFS system and add an entry for it in your Arch boot menu.
I thought it might work like that, too. Maybe I would need to run a grub-mkconfig from Arch...I'll try, for now it's running autoconf's test suite(which is 100x longer than compilation...)

Quote:
Originally Posted by stoat View Post
Anyway, I've gotten to the point where I can build LFS in one evening.
I haven't got to that point yet, LOL. I started building CLFS 3 days ago and I haven't finished yet...oh well, guess I'll just upgrade those packages that do not require rebuilding
Is there something like ALFS for CLFS?

Quote:
Originally Posted by stoat View Post
To me, that would be installed like any other Linux kernel. New Linux kernels are installed alongside old ones. The new kernel has new files in /boot and a new folder in /lib/modules. The firmware for all kernels gets co-mingled in the same /lib/firmware folder. Removing an old unwanted kernel can be done by deleting its files in /boot and its folder in /lib/modules. I never do anything to /lib/firmware when deleting old kernels. If you choose to install a kernel's docs (I don't), then they can be deleted when the kernel is deleted.
So first, I would install the standard kernel specified in your book. Get that booting and working satifactorily. Create a tarball backup. Then install the linux-libre kernel in the usual way. You should end up with new vmlinuz, System.map, and config files in your /boot directory. There will be a new folder in /lib/modules. Its firmware will be co-mingled with the existing firmware in /lib/firmware. Anyway, if the system still boots and works normally with the new kernel, then you can delete the other kernel's boot files and modules subfolder if you want. If you want to be a purist about that non-free firmware that will still be in /lib/firmware, then you will need to do something about that. Maybe rename the /lib/firmware folder just before installing the linux-libre kernel. Obviously, I never tried that (and I'm not going to), but I predict that it will result in a new /lib/firmware folder being created containing only the linux-libre firmware. If so, and if the system still boots with the new kernel, delete the old renamed firmware folder. It works in my head anyway. No promises though. You may find that you need some of that non-free firmware to boot.
Ehm...what? I never installed a kernel from source, always used pacman...and...what does "mingled" mean? LOL, sorry for the stupidity(does this word even exist, in English?)
 
Old 11-15-2012, 04:53 PM   #4
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 464

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by Z4kW0lf

...I never installed a kernel from source, always used pacman...
The book tells how to do it. The actual commands for compiling a kernel are as simple as those for any other ordinary source package. It's the configuration of the kernel that's very different from the other packages we install. For me, the configuration of the kernel was the part of LFS that took the longest time to learn (still learning it, actually). I probably recompiled my first kernel thirty times until I had all of the configuration issues worked out. I have spent many hours researching various nuances and finer points of the kernel configuration. I don't mean to be negative. I just don't see any point in pretending about it. Maybe other people don't go through that ordeal. I don't know really.

Quote:
Originally Posted by Z4kW0lf

...what does "mingled" mean?
Just disregard that. I only mentioned it because I told you to install the standard kernel first, and because of that talk about linux-libre and not having non-free software installed. The standard kernel may install some non-free firmware in /lib/firmware, and it may still be there if you then install linux-libre and delete the standard kernel. Maybe not though. I have no way to know what firmware will be installed.

P.S.: There really is no reason not to just go ahead and install that linux-libre kernel first. See what happens. It might just do what you want. Who knows. I recommend that you stop and create a tarball backup of your work before doing that (always a good idea before installing something big).

P.P.S.: I just installed the 3.6.6 version of that linux-libre thing in a clone of my BLFS system that I use for testing things. I used the config file from my installation of the standard 3.6.6 kernel. It installed with the normal commands (the ones in the book). But it installed no firmware. Not surprising, I guess. I ran make firmware_install and it created a /lib/firmware folder and copied some stuff in there, but not what I need. I copied my firmware in there. I couldn't boot it. No video. I do remember seeing some warning messages fly up the screen during building. I'm nearly certain they involved radeon which is the video driver I use. Anyway, that's as far as I'm going with it. I was just curious and had a few minutes for it. Not really interested enough to resolve the issues with it. I guess you have your reasons for wanting to use that kernel. Plan for more trouble than necessary.

Last edited by stoat; 11-16-2012 at 07:30 AM.
 
Old 11-16-2012, 12:43 PM   #5
Z4kW0lf
LQ Newbie
 
Registered: Nov 2012
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by stoat View Post
Plan for more trouble than necessary.
I just discovered that nouveau won't work on my 670, so yeah, not going to even try linux-libre since I have kinda new hardware.
Soo...how can update the linux kernel to the latest version?
And also...is there a way to replace some of the packages with busybox?I am trying to build the system as minimal as possible, and when I discovered busybox I fell in love with it.
 
Old 11-16-2012, 09:24 PM   #6
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 464

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by Z4kW0lf

...how can update the linux kernel to the latest version?
If by that you mean how to install a different kernel than the one in the book, then usually it's just a matter of downloading the newer kernel tarball and substituting the version numbers in the book's steps. Another idea since wget-list usually downloads a kernel along with everything else, is to go ahead with the book's step to install the older kernel. Get that working. Then merely install another kernel that is more what you want. I periodically install new kernels in just that way. I keep the replaced kernel until I upgrade again, then delete it. So I have two kernels installed all the time.

P.S.: I don't know anything about busybox. Maybe somebody else will answer that question.
 
Old 11-18-2012, 02:44 PM   #7
Keith Hedger
Member
 
Registered: Jun 2010
Location: Devon,UK
Distribution: Linux From Scratch, Slackware64,
Posts: 832

Rep: Reputation: 167Reputation: 167
I built busybox some few years ago and it compiles in much the same way as a kernel compile, you can choose which modules to add and whether to make symlinks at install time, so for instance if you compile in the 'find' module when you install it it will place a symlink called find in bin that points to busybox and the command is run just like the normal find command.
Some (most) of the modules are just cut down versions of the full command and only support a small subset of the command line options.
Busybox can be called via a symlink or directly and then you specify what module you want to use.
I havn't compiled it in a while but it is a brilliant peice of software and I think I might just go add it to my system now that I've been reminded of it!
 
Old 11-19-2012, 01:04 PM   #8
Z4kW0lf
LQ Newbie
 
Registered: Nov 2012
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Keith Hedger View Post
I built busybox some few years ago and it compiles in much the same way as a kernel compile, you can choose which modules to add and whether to make symlinks at install time, so for instance if you compile in the 'find' module when you install it it will place a symlink called find in bin that points to busybox and the command is run just like the normal find command.
Some (most) of the modules are just cut down versions of the full command and only support a small subset of the command line options.
Busybox can be called via a symlink or directly and then you specify what module you want to use.
I havn't compiled it in a while but it is a brilliant peice of software and I think I might just go add it to my system now that I've been reminded of it!
Nevermind, I discovered CLFS-embedded and started rebuilding from scratch, LOL.
Another question...Can I remove GCC and all the cross-tools after I finished building CLFS-Embedded and keep only Busybox, Iana-Etc and RPM(to install packages)?
 
Old 11-19-2012, 01:13 PM   #9
Keith Hedger
Member
 
Registered: Jun 2010
Location: Devon,UK
Distribution: Linux From Scratch, Slackware64,
Posts: 832

Rep: Reputation: 167Reputation: 167
You can remove the tools chain when the book says you are finished with it but I would tar it up so that if you need the tools again you can just untar them. I would not remove gcc on you finished system or the ability to compile software as not everything has a RPM package, some software is source only.
 
Old 11-19-2012, 02:59 PM   #10
Z4kW0lf
LQ Newbie
 
Registered: Nov 2012
Posts: 9

Original Poster
Rep: Reputation: 0
OK, thanks, sorry if I didn't read the book until the part where it says to remove the toolchain
 
Old 12-18-2012, 03:15 PM   #11
Z4kW0lf
LQ Newbie
 
Registered: Nov 2012
Posts: 9

Original Poster
Rep: Reputation: 0
Ok guys, I have rebuilt everything, this time following the CLFS-Embedded book(that didn't even take me a full hour, if we don't consider package downloading times. )

I am using the rEFInd bootloader on my Parabola GNU/Linux host system.
I have:
  • built in the kernel(i.e. not as module) everything EFI-related.
  • built in the kernel everything SATA-related, but disabled everything IDE/PATA related. The kernel has modules disabled.
  • copied the kernel to the UEFI System Partition, in a subfolder named clfs
  • set the kernel command line to "root=/dev/sda6 rootfstype=ext4".
When i boot the vmlinuz_clfs.efi file using rEFInd, it says "Error: unsupported while loading vmlinuz_clfs.efi". I have googled a bit but found nothing helpful.

EDIT: By the way, it's built for an i686 arch. I assumed it'd be compatible. Will it?

Last edited by Z4kW0lf; 12-18-2012 at 03:34 PM.
 
Old 12-19-2012, 02:47 PM   #12
Z4kW0lf
LQ Newbie
 
Registered: Nov 2012
Posts: 9

Original Poster
Rep: Reputation: 0
Ok, I have recompiled for a x86_64 arch and copied bzImage to my ESP instead of vmlinux. It now boots, but I only see the console for a split second, then the screen goes black. What could it possibly be? I am using SysV Init scripts.
EDIT: I am an idiot. I forgot to compile the nouveau drivers in the kernel.
It now boots correctly, and I con use the created sys but only with SysVInit.
BSD-Init gives me a bunch of errors like "error, cannot mount /dev/something, no such file or dir." Why? I am using the LFS hint on BSD-Init

Last edited by Z4kW0lf; 12-19-2012 at 05:02 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Is there a Linux-Libre version of Slackware? Experiences with Linux-Libre? DrCube Slackware 28 01-30-2013 09:08 AM
Using Linux-Libre kernel alongside mainline corbis_demon Linux From Scratch 5 09-23-2010 01:34 PM
Changing command line resolution. Not a bootloader problem but kernel's. kummiliim Linux - Kernel 6 08-06-2007 01:00 AM
Changing bootloader options from linux / windows? pk21 Linux - General 5 04-22-2006 04:42 PM
iPAQ 2210 - installiong Linux: problem with changing bootloader ubik001 Linux - Laptop and Netbook 0 12-05-2004 04:57 AM


All times are GMT -5. The time now is 11:01 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration