Minor tweak to silo regarding GPT labeled drives
I've been prompted by a couple of folk to pass along this minor patch for silo Newer sparc firmware, mostly in the T4 and above range, along with sun(vtoc) now support gpt labelled drives on the system boot drive (and theoretically some can also support msdos? not tried it)
The problem with sillo is that it actively looks to see if a sun label magic is written but GPT has no such 'magic' and silo would moan.
Phil
=--=
From 5d5994b88513f2e45701460d275a2d29ab89c40b Mon Sep 17 00:00:00 2001
From: Dazed and confused <[email protected]>
Date: Thu, 19 Feb 2015 05:58:30 -0800
Subject: [PATCH] GPT tweak
quietens silo about lack of a MAGIC for the GPT label
--- include/silo.h | 1 + second/fs/iom.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
include/silo.h +1 -0
@@ -46,6 +46,7 @@ typedef struct { } sun_partition;#define SUN_LABEL_MAGIC 0xDABE +#define GPT_LABEL_MAGIC 0x0000struct silo_inode {unsigned int inolen;
second/fs/iom.c +2 -2
@@ -37,8 +37,8 @@ static int read_sun_partition (int partno)silo_fatal ("Cannot read partition" );return 0 ; } -if (sdl.magic !=SUN_LABEL_MAGIC ) -silo_fatal ("Wrong disklabel magic" ); +if ((sdl.magic !=SUN_LABEL_MAGIC ) && (sdl.magic !=GPT_LABEL_MAGIC )) +printf ("Wrong disklabel magic [0x%X]\n" , (unsigned int ) sdl.magic);for (csum =0 , ush = ((unsigned short *) ((&sdl) +1 )) -1 ; ush >= (unsigned short *) &sdl;) csum ^= *ush--;if (csum)
Signature · 1 line
1.7.1
Quoted 7 lines · Bryce
I've been prompted by a couple of folk to pass along this minor patch for silo Newer sparc firmware, mostly in the T4 and above range, along with sun(vtoc) now support gpt labelled drives on the system boot drive (and theoretically some can also support msdos? not tried it)
The problem with sillo is that it actively looks to see if a sun label magic is written but GPT has no such 'magic' and silo would moan.
having non-patched silo run on disk with gpt label (hardware is T5-2 server), breaks autoboot ( auto-boot?=true )
Boot device: vdisk0 File and args:
SILO Version 1.4.14
Fatal error: Wrong disklabel magic
boot:
I'm going to test git silo with this patch and report back tomorrow.
Quoted 8 lines · Bryce
I've been prompted by a couple of folk to pass along this minor patch for silo Newer sparc firmware, mostly in the T4 and above range, along with sun(vtoc) now support gpt labelled drives on the system boot drive (and theoretically some can also support msdos? not tried it)
The problem with sillo is that it actively looks to see if a sun label magic is written but GPT has no such 'magic' and silo would moan.
Quoted 6 lines
Phil
=-->Quoted 1 line
From
5d5994b88513f2e45701460d275a2d29ab89c40bMon Sep 17 00:00:00 2001From: Dazed and confused <[email protected]>
Can the original author be found and attributed?
I recall davem would like silo patches to be signed off, like kernel patches.
Sam
Quoted 12 lines · Sam Ravnborg
Quoted 11 lines · Bryce
I've been prompted by a couple of folk to pass along this minor patch for silo Newer sparc firmware, mostly in the T4 and above range, along with sun(vtoc) now support gpt labelled drives on the system boot drive (and theoretically some can also support msdos? not tried it)
The problem with sillo is that it actively looks to see if a sun label magic is written but GPT has no such 'magic' and silo would moan.
Phil
=-->>
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
From
5d5994b88513f2e45701460d275a2d29ab89c40bMon Sep 17 00:00:00 2001From: Dazed and confused <[email protected]>
Can the original author be found and attributed?
I recall davem would like silo patches to be signed off, like kernel patches.
Sam
The original author is myself, that is the raw patch from the internal svn repo.
Hi Bryce.
Quoted 13 lines · Bryce
Quoted 12 lines · Sam Ravnborg
Quoted 11 lines · Bryce
I've been prompted by a couple of folk to pass along this minor patch for silo Newer sparc firmware, mostly in the T4 and above range, along with sun(vtoc) now support gpt labelled drives on the system boot drive (and theoretically some can also support msdos? not tried it)
The problem with sillo is that it actively looks to see if a sun label magic is written but GPT has no such 'magic' and silo would moan.
Phil
=--> >>
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
From
5d5994b88513f2e45701460d275a2d29ab89c40bMon Sep 17 00:00:00 2001From: Dazed and confused <[email protected]>
Can the original author be found and attributed?
I recall davem would like silo patches to be signed off, like kernel patches.
Sam
The original author is myself, that is the raw patch from the internal svn repo.
Great.
Then I suggest to await feedback from Anatoly and then please re-submit like a proper patch with a proper changelog including signed-off-by, and Tested-by.
And with a real name in the From part- so git picks up the real name.
Sam
Anatoly Pugachev
Tested-byQuoted 20 lines · Sam Ravnborg
Quoted 19 lines · Bryce
Quoted 18 lines · Sam Ravnborg
Quoted 5 lines · Bryce
I've been prompted by a couple of folk to pass along this minor patch for silo Newer sparc firmware, mostly in the T4 and above range, along with sun(vtoc) now support gpt labelled drives on the system boot drive (and theoretically some can also support msdos? not tried it)
Quoted 8 lines
The problem with sillo is that it actively looks to see if a sun label magic is written but GPT has no such 'magic' and silo would moan.
Phil
=--> > >>Quoted 1 line
From
5d5994b88513f2e45701460d275a2d29ab89c40bMon Sep 17 00:00:00 2001From: Dazed and confused <[email protected]>
Can the original author be found and attributed?
I recall davem would like silo patches to be signed off, like kernel patches.
Quoted 8 lines
Quoted 2 lines
Quoted 1 line
Sam
The original author is myself, that is the raw patch from the internal svn repo.
Great.
Then I suggest to await feedback from Anatoly and then please re-submit like a proper patch with a proper changelog including signed-off-by, and Tested-by.
And with a real name in the From part- so git picks up the real name.
My quick report.
Used silo git from https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/silo
I wasn't able to compile git silo on debian sparc64 (full 64-bit, kernel+userland), and used debian 7.9 (32-bit userland) instead.
I have 2 test machines: bare-metal v215 (no gpt disks, 2 disks with sun partition table) with debian 7.9 installed and T5-2 with solaris 11 control domain and few LDOMs (Oracle Linux on Sparc, debian sid 64-bit, solaris)
So, I used v215 to compile silo git, installed and tried to boot - silo timeout doesn't work, other than that Linux boots - seems like git silo has broken timeout.
Next, compiled with gpt-patch, and applied another patch from oracle linux on sparc silo.src.rpm package
(http://yum.oracle.com/repo/linux_sparc64/latest//silo-1.4.14-4.0.18.el6.src.rpm),
called silo-1.4.14-timer-timeout.patch
Compiled, installed - timeout settings in silo.conf works, linux boots.
Copied compiled silo directory to another debian 64-bit LDOM (where I have debian sid sparc 64-bit installed to gpt disk partition), made "make install" and run "silo -f", it complained, that there's no such file, cause don't have 32-bit C library, so I've installed 32-bit libc6-sparc, run "silo -f" again succesfully.
So far works, linux boots, silo timeout works, no fatal error with "Wrong disklabel magic".
PS: oracle linux on sparc silo.src.rpm has a few more patches, one of them is to make silo to compile as 64-bit.
--
include/silo.h | 1 + second/fs/iom.c | 4 ++-- second/timer.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-)
include/silo.h +1 -0
@@ -46,6 +46,7 @@ typedef struct { } sun_partition;#define SUN_LABEL_MAGIC 0xDABE +#define GPT_LABEL_MAGIC 0x0000struct silo_inode {unsigned int inolen;
second/fs/iom.c +2 -2
@@ -37,8 +37,8 @@ static int read_sun_partition (int partno)silo_fatal ("Cannot read partition" );return 0 ; } -if (sdl.magic !=SUN_LABEL_MAGIC ) -silo_fatal ("Wrong disklabel magic" ); +if ((sdl.magic !=SUN_LABEL_MAGIC ) && (sdl.magic !=GPT_LABEL_MAGIC )) +printf ("Wrong disklabel magic [0x%X]\n" , (unsigned int ) sdl.magic);for (csum =0 , ush = ((unsigned short *) ((&sdl) +1 )) -1 ; ush >= (unsigned short *) &sdl;) csum ^= *ush--;if (csum)
second/timer.c +2 -2
@@ -145,7 +145,7 @@ static inline int sun4u_init_timer ()prom_getstring (node,"device_type" , node_str,sizeof (node_str));if (!strcmp (node_str,"cpu" )) { foundcpu =1 ; - clock_frequency =prom_getintdefault (node,"clock-frequency" ,0 ) /100 ; + clock_frequency = (unsigned int )prom_getintdefault (node,"clock-frequency" ,0 ) /100 ; } }if (notimer) {
@@ -155,7 +155,7 @@ static inline int sun4u_init_timer () } }if (!foundcpu || !clock_frequency) - clock_frequency =prom_getint (prom_root_node,"clock-frequency" ) /100 ; + clock_frequency = (unsigned int )prom_getint (prom_root_node,"clock-frequency" ) /100 ;if (notimer && !sun4v_cpu) { sun4u_notimer =1 ; __asm__ __volatile__ ("\t"
Quoted 19 lines · Anatoly Pugachev
Next, compiled with gpt-patch, and applied another patch from oracle linux on sparc silo.src.rpm package
(http://yum.oracle.com/repo/linux_sparc64/latest//silo-1.4.14-4.0.18.el6.src.rpm),
called silo-1.4.14-timer-timeout.patchsecond/timer.c +1
-1@@ -145,7 +145,7 @@ static inline int sun4u_init_timer ()prom_getstring (node,"device_type" , node_str,sizeof (node_str));if (!strcmp (node_str,"cpu" )) { foundcpu =1 ; - clock_frequency =prom_getintdefault (node,"clock-frequency" ,0 ) /100 ; + clock_frequency = (unsigned int )prom_getintdefault (node,"clock-frequency" ,0 ) /100 ; } }if (notimer) {
second/timer.c static inline int sun4u_init_timer () · line 161
Quoted 8 lines
second/timer.c +1
-1@@ -155,7 +155,7 @@ static inline int sun4u_init_timer () } }if (!foundcpu || !clock_frequency) - clock_frequency =prom_getint (prom_root_node,"clock-frequency" ) /100 ; + clock_frequency = (unsigned int )prom_getint (prom_root_node,"clock-frequency" ) /100 ;if (notimer && !sun4v_cpu) { sun4u_notimer =1 ; __asm__ __volatile__ ("\t"
found an owner of this patch in silo.spec changelog, quote:
* Fri Aug 30 2013 Nikita Gerasimov <[email protected]> 1.4.14-4.0.14
- silo.conf timeout property does not work due to overflow. Basically the CPU is so fast now that it overslows the signed 32bit value. I guess at some point it'll be even faster and we'll have to promte prom_getintdefault() to returning an unsigned double int.
So we need to make Nikita Gerasimov <[email protected]> as Signed-off-by as well.
Thanks.
From: Anatoly Pugachev <[email protected]>
Date: Thu, 21 Jan 2016 15:52:29 +0300
Quoted 31 lines · Anatoly Pugachev
Quoted 19 lines
Next, compiled with gpt-patch, and applied another patch from oracle linux on sparc silo.src.rpm package
(http://yum.oracle.com/repo/linux_sparc64/latest//silo-1.4.14-4.0.18.el6.src.rpm),
called silo-1.4.14-timer-timeout.patchsecond/timer.c +1
-1@@ -145,7 +145,7 @@ static inline int sun4u_init_timer ()prom_getstring (node,"device_type" , node_str,sizeof (node_str));if (!strcmp (node_str,"cpu" )) { foundcpu =1 ; - clock_frequency =prom_getintdefault (node,"clock-frequency" ,0 ) /100 ; + clock_frequency = (unsigned int )prom_getintdefault (node,"clock-frequency" ,0 ) /100 ; } }if (notimer) {second/timer.c static inline int sun4u_init_timer () · line 161
Quoted 8 lines
second/timer.c +1
-1@@ -155,7 +155,7 @@ static inline int sun4u_init_timer () } }if (!foundcpu || !clock_frequency) - clock_frequency =prom_getint (prom_root_node,"clock-frequency" ) /100 ; + clock_frequency = (unsigned int )prom_getint (prom_root_node,"clock-frequency" ) /100 ;if (notimer && !sun4v_cpu) { sun4u_notimer =1 ; __asm__ __volatile__ ("\t"found an owner of this patch in silo.spec changelog, quote:
Quoted 8 lines
* Fri Aug 30 2013 Nikita Gerasimov <[email protected]> 1.4.14-4.0.14
- silo.conf timeout property does not work due to overflow. Basically the CPU is so fast now that it overslows the signed 32bit value. I guess at some point it'll be even faster and we'll have to promteprom_getintdefault()to returning an unsigned double int.So we need to make Nikita Gerasimov <[email protected]> as Signed-off-by as well.
And maybe we can ask them how to get access to this amazing "unsigned double int" type. I'd like to start using it too.
From: Bryce <[email protected]>
Date: Mon, 18 Jan 2016 18:17:34 +0000
Quoted 17 lines
include/silo.h +1
-0@@ -46,6 +46,7 @@ typedef struct { } sun_partition;#define SUN_LABEL_MAGIC 0xDABE +#define GPT_LABEL_MAGIC 0x0000struct silo_inode {unsigned int inolen;second/fs/iom.c +0
-0
second/fs/iom.c static int read_sun_partition (int partno) · line 44
Quoted 10 lines
second/fs/iom.c +2
-2@@ -37,8 +37,8 @@ static int read_sun_partition (int partno)silo_fatal ("Cannot read partition" );return 0 ; } -if (sdl.magic !=SUN_LABEL_MAGIC ) -silo_fatal ("Wrong disklabel magic" ); +if ((sdl.magic !=SUN_LABEL_MAGIC ) && (sdl.magic !=GPT_LABEL_MAGIC )) +printf ("Wrong disklabel magic [0x%X]\n" , (unsigned int ) sdl.magic);for (csum =0 , ush = ((unsigned short *) ((&sdl) +1 )) -1 ; ush >= (unsigned short *) &sdl;) csum ^= *ush--;if (csum)
This can't be right.
If it's a GPT label then we have to add all of the necessary GPT datastructures and code necessary to interpret and verify the partition label properly.
You can't just fudge it by making the label magic check pass, the code right afterwards verifies the checksum and then we calculate the disk offset from the partition entry 'partno' to determine where to start reading things.