Skip to contentSkip to conversation

palo: place iplboot inside disk label if it's big enough

PATCH New James Bottomley 1 participant 1 message Jul 6, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 palo: place iplboot inside disk label if it's big enough

Ever since the widespread adoption of gpt and 4k emulation disks, we've been starting the first partition at sector 2048 instead of 63. Since we only need 512 sectors for iplboot, this offers the opportunity of placing iplboot directly inside the disk label.

The way this patch works is that if no palo (F0) partition is found and the first partition starts high enough, initialise the disk with the ipl boot just below the first partition. If the disk isn't big enough, error out as previously and if an F0 partition is found, proceed as usual.

---
 ipl/ipl.c   | 11 +++++++++--
 palo/palo.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 57 insertions(+), 7 deletions(-)
ipl/ipl.c +9 -2
index 03fe4ba..2a25e7c 100644
@@ -486,6 +486,7 @@ iplmain(int is_interactive, char *initialstackptr, int started_wide)
     char kern_name[128], rd_name[128];
     char kern_fullname[128+10];
     int ok = 1;
+    const char *str;
 
     /* BSS clear */
     bzero(&_edata, &_end - &_edata);
@@ -527,8 +528,14 @@ iplmain(int is_interactive, char *initialstackptr, int started_wide)
 	print_ptab_pretty(partition, sizeof partition / sizeof partition[0]);
     }
 
-    printf("\n%s contains:\n",
-	partitioned ? "PALO(F0) partition" : "Boot image");
+    if (partitioned && f.ipl_addr < partition[0].start * 512)
+	str = "PALO within boot label";
+    else if (partitioned)
+	str = "PALO(F0) partition";
+    else
+	str = "Boot image";
+
+    printf("\n%s contains:\n", str);
 
     if(partitioned && f.version >= 4 && (f.flags & PFLAG_EXT2)) {
 	printf("PALO is formatted EXT2/3\n");
palo/palo.c +48 -5

76 lines not on this page · raw message

Signature · 1 line
2.16.4