LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Closed Thread
  Search this Thread
Old 07-11-2017, 02:26 AM   #2551
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Original Poster
Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351

Re mkinitrd, as evidenced by the patches and such here, you see that it's not as trivial as you'd like :-) The patch has to be transparent to the user, i.e. if the user doesn't intentionally tell mkinitrd to add the kernel version string, then it has to output /boot/initrd.gz. The patch has to take into account that KERNEL_VERSION isn't actually set /sbin/mkinitrd is running, hence editing /etc/mkinitrd.conf isn't sufficient (and no, adding the VERSION string to /etc/mkinitrd.conf isn't a solution). If I have to edit something every time I run mkinitrd, then it isn't a solution. In other words, I want to continue my usage of "mkinitrd -c -k $version -F" and get out "/boot/initrd-$version.gz"

As I said, I gave up on it whenever I last looked at it and moved on to other problems. I'd love to see someone come up with a simple solution (I'd not be surprised if I overlooked it - it happens more than I'd like to admit)... After thinking a bit more about it (and without looking back at the mkinitrd script), I'd like to think that the most elegant solution is another variable in /etc/mkinitrd.conf, e.g. "APPEND_KVER" that /sbin/mkinitrd checks for and writes out /boot/initrd-${KERNEL_VERSION}.gz if APPEND_KVER=1 -- it seems really simple now, but maybe not; either way, if someone wants some ChangeLog mention (assuming Pat accepts the idea), then have a go at it.

Last edited by rworkman; 07-11-2017 at 02:30 AM.
 
2 members found this post helpful.
Old 07-11-2017, 02:38 AM   #2552
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Rep: Reputation: Disabled
Hi,

At first I didn't understand what you mean, so I tested it.
I placed in mkinitrd.conf:
Code:
KERNEL_VERSION=$( readlink /boot/vmlinuz-generic | rev | cut -f1 -d- | rev )
OUTPUT_IMAGE="/boot/initrd-${KERNEL_VERSION}.gz
Then I run:
Code:
$ mkinitrd -F -c
and it produced the expected result: /boot/initrd-4.4.75.gz

Then I run:
Code:
$ mkinitrd -F -c -k 4.4.70-prod
and it produced the unexpected result: /boot/initrd-4.4.75.gz
I would expect it to be /boot/initrd-4.4.75-prod.gz

So you are correct in that it does not work as we thought it would.

--
Best regards,
Andrzej Telszewski
 
Old 07-11-2017, 02:43 AM   #2553
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Original Poster
Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Even if that did work, it still wouldn't be ideal - there's no expectation (nor should there be) that I name my custom kernels as /boot/vmlinuz-generic-$version or create a symlink to /boot/vmlinuz-generic. Never mind that there would be another issue on 32bit :-)
 
Old 07-11-2017, 04:44 AM   #2554
phenixia2003
Senior Member
 
Registered: May 2006
Location: France
Distribution: Slackware
Posts: 1,052

Rep: Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008
Quote:
Originally Posted by rworkman View Post
Even if that did work, it still wouldn't be ideal - there's no expectation (nor should there be) that I name my custom kernels as /boot/vmlinuz-generic-$version or create a symlink to /boot/vmlinuz-generic. Never mind that there would be another issue on 32bit :-)
Just an idea. The patch at the end of this post allows you to specify a template (on the command line or in mkinitrd.conf) for the output initrd name. This template can contains tags which are resolved at runtime. Currently, the tags %KVER% and %SLACKVER% are supported.

Example :
Code:
$ mkinitrd -o /tmp/initrd-%KVER%.gz
33751 blocks
/tmp/initrd-4.4.75.gz created.
Be sure to run lilo again if you use it.

$ mkinitrd -o /tmp/initrd-%KVER%_%SLACKVER%.gz
33751 blocks
/tmp/initrd-4.4.75_14.2.gz created.
Be sure to run lilo again if you use it.


$ cat /etc/mkinitrd.conf | grep OUTPUT_IMAGE
OUTPUT_IMAGE=/boot/%KVER%-initrd-generic-%SLACKVER%.gz

$ mkinitrd -k 4.4.75-custom -F
33751 blocks
/boot/4.4.75-custom-initrd-generic-14.2.gz created.
Be sure to run lilo again if you use it.

$ OUTPUT_IMAGE=/tmp/my-initrd-for-%KVER%-on-slackware-%SLACKVER%.gz ./mkinitrd -k 4.4.75
33751 blocks
/tmp/my-initrd-for-4.4.75-on-slackware-14.2.gz created.
Be sure to run lilo again if you use it.
Here is the patch:
Code:
--- mkinitrd.orig	2017-07-11 10:24:41.580285638 +0200
+++ mkinitrd	2017-07-11 11:26:00.768449804 +0200
@@ -261,7 +261,19 @@
   cp -a /etc/modprobe.d $SOURCE_TREE/etc
   cp -a /lib/modprobe.d $SOURCE_TREE/lib/
 }
-     
+
+# Normalize the string $1 by replacing occurences of 
+# recognized tags by their current values.
+#
+# this version take the following tags into account:
+#  %KVER% (kernel version)
+#  %SLACKVER% (slackware version)
+#
+function normalize_string() {
+  echo "$1" | sed -e "s?%KVER%?${KERNEL_VERSION}?g" \
+                  -e "s?%SLACKVER%?$(cat /etc/slackware-version|cut -f2 -d" ")?g"
+}
+
 # If --help is given, print_usage and exit:
 if echo $* | grep -wq '\--help' ; then
   print_usage
@@ -285,7 +297,7 @@
 # Default actions without options:
 if [ -z "$1" ]; then
   # We need a sensible default for this special case:
-  OUTPUT_IMAGE=${OUTPUT_IMAGE:-/boot/initrd.gz}
+  OUTPUT_IMAGE=$(normalize_string ${OUTPUT_IMAGE:-/boot/initrd.gz})
   # If the output tree doesn't exist, create it and then exit:
   if [ ! -d $SOURCE_TREE ]; then
     echo "Nothing found at location $SOURCE_TREE, so we will create an"
@@ -349,7 +361,7 @@
       ;;
     -o)
       # canonicalize filename:
-      OUTPUT_IMAGE="$(readlink -m $2)"
+      OUTPUT_IMAGE="$(readlink -m $(normalize_string $2))"
       shift 2
       ;;
     -r)
@@ -465,7 +477,7 @@
 fi
 
 # If no OUTPUT_IMAGE was specified, read it from the SOURCE_TREE if possible:
-OUTPUT_IMAGE=${OUTPUT_IMAGE:-"$(cat $SOURCE_TREE/initrd-name)"}
+OUTPUT_IMAGE=$(normalize_string ${OUTPUT_IMAGE:-"$(cat $SOURCE_TREE/initrd-name)"})
 # If we still have no value, apply the default:
 OUTPUT_IMAGE=${OUTPUT_IMAGE:-"/boot/initrd.gz"}
 # Finally, write the image name into the SOURCE_TREE:
--
SeB

Last edited by phenixia2003; 07-11-2017 at 07:44 AM. Reason: typo
 
3 members found this post helpful.
Old 07-11-2017, 05:00 AM   #2555
franzen
Member
 
Registered: Nov 2012
Distribution: slackware
Posts: 535

Rep: Reputation: 379Reputation: 379Reputation: 379Reputation: 379
libjpeg-turbo 1.5.2 has been released.

Official tarball is here.
Change log is here.
 
1 members found this post helpful.
Old 07-11-2017, 09:18 AM   #2556
bormant
Member
 
Registered: Jan 2008
Posts: 426

Rep: Reputation: 240Reputation: 240Reputation: 240
RE: mkinitrd
Please keep in mind that 32-bit Slackware normal generic kernel has x.x.x-smp version and kernel without -smp is not SMP kernel (only one core).
 
1 members found this post helpful.
Old 07-11-2017, 12:13 PM   #2557
Darth Vader
Senior Member
 
Registered: May 2008
Location: Romania
Distribution: DARKSTAR Linux 2008.1
Posts: 2,727

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
Please, make the slackpkg to stop messing with the bootloader.

Instead of offering to update LILO, it should just put a whatever warning that the kernel was updated and maybe the bootloader needs to be updated!

And I see no sense to (offer to) update LILO when instead the user use ELILO, SYSLINUX, EXTLINUX, GRUB, GRUB2 and so on. Could even create confusions!

Long story short: a presence of LILO in the system does NOT guarantee that the user also use it for boot.

Last edited by Darth Vader; 07-11-2017 at 12:29 PM.
 
1 members found this post helpful.
Old 07-11-2017, 12:58 PM   #2558
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,950

Rep: Reputation: Disabled
Its harmless, just hit 'n'. Or if it really bugs you edit your local slackpkg to not print that.
 
1 members found this post helpful.
Old 07-11-2017, 01:04 PM   #2559
Darth Vader
Senior Member
 
Registered: May 2008
Location: Romania
Distribution: DARKSTAR Linux 2008.1
Posts: 2,727

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
Quote:
Originally Posted by orbea View Post
Its harmless, just hit 'n'. Or if it really bugs you edit your local slackpkg to not print that.
It is NOT harmless. This thing can create to a rookie the false impression that he updated the bootloader, when he wasn't. See this thread, for example:

http://www.linuxquestions.org/questi....php?p=5733395

And NO, does not bother me, rest assured. I do never used slackpkg, in fact.

BUT, instead I suggest to treat the same all bootloaders used by Slackware.

Then, let's say: or we remove that troubling thing, or we should do a shiny auto-detection of bootloader type and do the same for: LILO, ELILO, SYSLINUX, EXTLINUX, GRUB and GRUB2.

Be my guest to find out which bootloader was used for real.

Oh. and maybe this guy: http://www.linuxquestions.org/questi....php?p=5733104 would want to update automatically his bootloader over a write protected SDCARD, who know...

Last edited by Darth Vader; 07-11-2017 at 01:12 PM.
 
Old 07-11-2017, 01:12 PM   #2560
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,950

Rep: Reputation: Disabled
So the correct solution is to help teach rookie users, not remove a harmless message.
 
Old 07-11-2017, 01:16 PM   #2561
Darth Vader
Senior Member
 
Registered: May 2008
Location: Romania
Distribution: DARKSTAR Linux 2008.1
Posts: 2,727

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
I do not see why a package manager should mess with the bootloader, though...

And the correct solution is to not confuse the rookies, first of all.
 
Old 07-11-2017, 01:22 PM   #2562
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Rep: Reputation: Disabled
Hi,

Quote:
Originally Posted by Darth Vader View Post
I do not see why a package manager should mess with the bootloader, though...
Because it might touch files that are directly related to booting.

--
Best regards,
Andrzej Telszewski
 
1 members found this post helpful.
Old 07-11-2017, 01:31 PM   #2563
Darth Vader
Senior Member
 
Registered: May 2008
Location: Romania
Distribution: DARKSTAR Linux 2008.1
Posts: 2,727

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
Quote:
Originally Posted by atelszewski View Post
Hi,


Because it might touch files that are directly related to booting.

--
Best regards,
Andrzej Telszewski
Look, we are NOT the RHEL, where they stuck with their shiny GRUB(2), instead we are Slackware and we use tons of bootloaders.

IF you believe that we can handle all of them, and their particular usage, "after touching files related to booting", be my guest!

BUT, again: a package updater messing with the bootloader is a thing which is not on Slackware way, at least in my opinion, as life-long Slackware user.

Maybe you use this LILO (me too), maybe you are skilled to know when it ask a true question (me too), but NOT all Slackware users are skilled like us, and NOT all of them use LILO, specially those who build a relatively modern box. The UEFI is all the way and they go ELILO or GRUB.

I do not talk here about those who try to boot Slackware from a write protected SDCARD...

Last edited by Darth Vader; 07-11-2017 at 01:54 PM.
 
Old 07-11-2017, 01:39 PM   #2564
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Rep: Reputation: Disabled
Hi,

Quote:
Originally Posted by Darth Vader View Post
I do not talk here about those who try to boot Slackware from a write protected SDCARD...
You made my day :-D

--
Best regards,
Andrzej Telszewski
 
Old 07-11-2017, 01:40 PM   #2565
Darth Vader
Senior Member
 
Registered: May 2008
Location: Romania
Distribution: DARKSTAR Linux 2008.1
Posts: 2,727

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
Here you go: http://www.linuxquestions.org/questi....php?p=5733104

Have fun!
 
  


Closed Thread



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
[SOLVED] how to show the current time at the top in the current shell Always ? rohitchauhan Linux - General 5 04-09-2014 03:05 PM
Slackware ARM (current) epic mistake: the current Android kernels are kicked out! Darth Vader Slackware 16 08-25-2013 04:36 PM
[SOLVED] setup fails on most current Slackware-current March 26, 2012 AlleyTrotter Slackware 15 04-09-2012 06:05 AM
Observation of Feb -current vs March -current Hangaber Slackware 14 03-12-2010 08:26 AM
cvs diff the most current and second last current version powah Linux - Software 1 03-30-2006 01:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:59 AM.

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