Re: sbuild on hurd-amd64...

Stéphane Glondu <[email protected]>
Newsgroups gmane.linux.debian.ports.hurd
Message-ID <[email protected]>
Le 22/08/2025 à 15:47, Stéphane Glondu a écrit :
>>> FI, apparently ATM when using a file as image, libstore uses 1-byte
>>> block size, and thus disk sizes should be smaller than 2G otherwise
>>> boot's device size reporting interface gets wrong.
>>
>> (an alternative is to use a disk partition, which report 512-byte block
>> size)
>>
>> Perhaps we could make libstore use 512-byte block size when the file is
>> multiple of 512 bytes. It could also be configurable, by introducing a
>> libstore layer (similarly to the part libstore layer)
> 
> It makes sense, but I'm not yet there.

I've implemented the first idea. With the attached patch, I can boot a 
subhurd with a 3G image. (Without, I cannot.)


Cheers,

-- 
Stéphane
0001-libstore-file.c-use-512-byte-blocks-if-file-size-is-.patch (text/x-patch, 1.3 KB)
From ab82e4e6065e523e9bb0e733e9c9d58c126f29c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Glondu?= <[email protected]>
Date: Sat, 23 Aug 2025 09:03:53 +0100
Subject: [PATCH] libstore/file.c: use 512-byte blocks if file size is a
 multiple

As suggested in:

  https://lists.debian.org/msgid-search/aKheR0SX8yI5Aw9Q@begin
---
 libstore/file.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libstore/file.c b/libstore/file.c
index c54eee9..7c08d4b 100644
--- a/libstore/file.c
+++ b/libstore/file.c
@@ -271,6 +271,7 @@ store_file_create (file_t file, int flags, struct store **store)
   struct store_run run;
   struct stat stat;
   error_t err = io_stat (file, &stat);
+  size_t block_size = 1;
 
   if (err)
     return err;
@@ -278,9 +279,14 @@ store_file_create (file_t file, int flags, struct store **store)
   run.start = 0;
   run.length = stat.st_size;
 
+  if ((stat.st_size & 0x1ff) == 0) {
+    block_size = 512;
+    run.length = stat.st_size >> 9;
+  }
+
   flags |= STORE_ENFORCED;	/* 'cause it's the whole file.  */
 
-  return _store_file_create (file, flags, 1, &run, 1, store);
+  return _store_file_create (file, flags, block_size, &run, 1, store);
 }
 
 /* Like store_file_create, but doesn't query the file for information.  */
-- 
2.50.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.