Ability to choose a kernel at bootup? (bootloader menu)

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
jlst

Ability to choose a kernel at bootup? (bootloader menu)

#1 Post by jlst »

I've been thinkng about this for a couple of days. These are just ideas... nothing concrete at the moment

I'm amazed at how easy downgrading and upgrading kernels in Arch Linux is.

I'm used to create Puppy+ManyOtherThings multiboot cds, usbs, Puppy is just the greatest live distro there is.

Now I have never looked at the code that loads the kernel, so basically I'm blind. But I can see some things.

This is how it works in Arch Linux: there are the 'linux' and 'linux-lts' packages (and other linux-* packages). Both packages can be upgraded or downgraded and both can coexist peacefully, there is no conflict.

Basically the grub2 menu is updated to reflect any changes. Well, that's great.

============================================

In Puppy, I see the kernel is now in a separate SFS and this SFS must conform to: DISTRO_SPECS

That file is located in initrd.gz -> /DISTRO_SPECS
Another copy is found in puppy_zzzz_X.Y.Z.sfs -> /etc/DISTRO_SPECS

I wonder if initrd.gz -> /DISTRO_SPECS is copied to puppy_zzzz_X.Y.Z.sfs -> /etc/DISTRO_SPECS on bootup?
It should overwrite the one in puppy_zzzz_X.Y.Z.sfs

These are they key variables stored in DISTRO_SPECS

Code: Select all

DISTRO_ZDRVSFS='zdrv_slacko_6.3.0.sfs'
DISTRO_ADRVSFS='adrv_slacko_6.3.0.sfs'
DISTRO_YDRVSFS='ydrv_slacko_6.3.0.sfs'
==============================================

Let's say we have these files in a USB stick

Code: Select all

/IMG/PUPPY/SLACKO/devx_slacko_6.3.0.sfs
/IMG/PUPPY/SLACKO/initrd.gz
/IMG/PUPPY/SLACKO/puppy_slacko_6.3.0.sfs
/IMG/PUPPY/SLACKO/vmlinuz
/IMG/PUPPY/SLACKO/zdrv_slacko_6.3.0.sfs
And this is a grub4dos menu entry to boot slacko from a subdirecty

Code: Select all

title Puppy Linux - slacko
  kernel /IMG/PUPPY/SLACKO/vmlinuz   psubdir=IMG/PUPPY/SLACKO pmedia=usbhd pfix=fsck,nocopy
  initrd /IMG/PUPPY/SLACKO/initrd.gz
We can see the only important files for the bootloader are vmlinuz and initrd.gz


============================================
============================================

Now, taking that information into account, it's time to device an evil plan.

- We'll ship 3 kernels
1) Kernel 3.14.55 (not that old, not that new)
2) Kernel-new 4.2.5 (the most recent stable kernel)
3) Kernel-retro 3.4.108 (for a machine like mine)

1) Kernel 3.14.55

Code: Select all

/IMG/PUPPY/SLACKO/initrd.gz
/IMG/PUPPY/SLACKO/vmlinuz
/IMG/PUPPY/SLACKO/zdrv_slacko_6.3.0.sfs
2) Kernel-new 4.2.5

Code: Select all

/IMG/PUPPY/SLACKO/initrd-new.gz
/IMG/PUPPY/SLACKO/vmlinuz-new
/IMG/PUPPY/SLACKO/zdrv_slacko_6.3.0-new.sfs
Now we need to modify initrd-new.gz -> /DISTRO_SPECS
The key variables should like this

Code: Select all

DISTRO_ZDRVSFS='zdrv_slacko_6.3.0-new.sfs'
DISTRO_ADRVSFS='adrv_slacko_6.3.0-new.sfs'
DISTRO_YDRVSFS='ydrv_slacko_6.3.0-new.sfs'
3) Kernel-retro 3.4.108

Code: Select all

/IMG/PUPPY/SLACKO/initrd-retro.gz
/IMG/PUPPY/SLACKO/vmlinuz-retro
/IMG/PUPPY/SLACKO/zdrv_slacko_6.3.0-retro.sfs
Now we need to modify initrd-retro -> /DISTRO_SPECS
The key variables should like this

Code: Select all

DISTRO_ZDRVSFS='zdrv_slacko_6.3.0-retro.sfs'
DISTRO_ADRVSFS='adrv_slacko_6.3.0-retro.sfs'
DISTRO_YDRVSFS='ydrv_slacko_6.3.0-retro.sfs'
---------------------------------------------

Now the grub4dos menu should look like this

Code: Select all

title Puppy Linux - Slacko
  kernel /IMG/PUPPY/SLACKO/vmlinuz   psubdir=IMG/PUPPY/SLACKO pmedia=usbhd pfix=fsck,nocopy
  initrd /IMG/PUPPY/SLACKO/initrd.gz
  
title Puppy Linux - Slacko (most recent kernel)
  kernel /IMG/PUPPY/SLACKO/vmlinuz-new   psubdir=IMG/PUPPY/SLACKO pmedia=usbhd pfix=fsck,nocopy
  initrd /IMG/PUPPY/SLACKO/initrd-new.gz

title Puppy Linux - Slacko (retro kernel)
  kernel /IMG/PUPPY/SLACKO/vmlinuz-retro   psubdir=IMG/PUPPY/SLACKO pmedia=usbhd pfix=fsck,nocopy
  initrd /IMG/PUPPY/SLACKO/initrd-retro.gz
Something like that would allow puppy to be even more awesome

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: Ability to choose a kernel at bootup? (bootloader menu)

#2 Post by L18L »

jlst wrote:Something like that would allow puppy to be even more awesome

You had to include firmware and kernel modules for 3 kernels.
Thus this would no more be a puppy but a pregnant monster bitch I fear. :roll:

gcmartin

Boot different versions of a distr using @StemSee's approach

#3 Post by gcmartin »

This "may" meet the need: @Stemsee has for over a year shown the community a distro that when booted, at Boot Menu the user selects whether he would choose the 64bit version or the32bit version of the same distro. Thus, a single ISO provides the user selectable boot options of the same distro.

Pull and view his distro from this thread.

Would his technique address this need?

jlst

#4 Post by jlst »

I was right.

My precise install has 4 kernels. I just have to choose one when booting

This is how my grub4dos menu looks like:
title Puppy Linux - PRECISE k3.4.103
kernel /PUPPYBOOT/precise/vmlinuz-3.4.103-tahr_noPae psubdir=PUPPYBOOT/precise pmedia=atahd
initrd /PUPPYBOOT/precise/initrd-3.4.103-tahr_noPae.gz

title Puppy Linux - PRECISE k3.14.55
kernel /PUPPYBOOT/precise/vmlinuz-3.14.55-slacko psubdir=PUPPYBOOT/precise pmedia=atahd
initrd /PUPPYBOOT/precise/initrd-3.14.55-slacko.gz

title Puppy Linux - PRECISE k3.14.56
kernel /PUPPYBOOT/precise/vmlinuz-3.14.56-tahr_noPae psubdir=PUPPYBOOT/precise pmedia=atahd
initrd /PUPPYBOOT/precise/initrd-3.14.56-tahr_noPae.gz

title Puppy Linux - PRECISE k4.4.1
kernel /PUPPYBOOT/precise/vmlinuz-4.4.1-i486-nopae psubdir=PUPPYBOOT/precise pmedia=atahd
initrd /PUPPYBOOT/precise/initrd-4.4.1-i486-nopae.gz
Now I see that:

/etc/networkmodules must be /etc/networkmodules-$(uname -r)
/boot/System.map must be /boot/System.map-$(uname -r)
/etc/default/aufs must be /etc/default/aufs-$(uname -r)

jlst

#5 Post by jlst »

What I'll do next is this:

1) Make a huge and unique firmware package ... already done (80mb gz compressed)
2) Create a single sfs containing all the kernels and firmware
3) Test and modify code to suit this new approach...

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#6 Post by musher0 »

Hello jlst

I need more time to absorb your complete idea, but about your sentence :

> I wonder if initrd.gz -> /DISTRO_SPECS is copied to puppy_zzzz_X.Y.Z.sfs -> /etc/DISTRO_SPECS on bootup?

I can tell you right now that during the boot process, there is an equivalence check between
the two: if the one at /etc/ is not identical -- except for a couple of lines at the bottom -- with
the one iin the initrd: no go, the boot process stops with an error.

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#7 Post by musher0 »

Hello again, jlst.

Sorry for coming late to your thread. I hadn't noticed it before.
~~~~~~~~~~

Ahem. :) The most recent stable kernel as of this writing is version 4.4.4!
I checked this morning.

Why not go for the most recent LTS kernel? Stable kernels are like migrating birds -- no,
wait, they're worse: rather like holiday lovers. They may be stable technically, but they're
very soon replaced.

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply