Re: libsa and 4K devices
mlel...@serpens.de (Michael van Elst) writes: >- The copied filesystem code in libsa uses absolute disk offsets > in bytes to locate superblocks. A backend that uses physical blocks > cannot easily address such offsets if it doesn't know the block > size. > The filesystem code deduces this as fsize >> fsbtodb, but both > values are only available after reading the superblock. Here is a patch for stand/efiboot and libsa that lets it handle large sectors for ffs,lfs,ext2fs,minix3fs. http://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/efiboot.patch
Re: libsa and 4K devices
nick.hud...@gmx.co.uk (Nick Hudson) writes: >https://github.com/skrll/src/commit/a5432c0ce71ea2fd1b7ad22ff6c26d01f4dca7= >1a When looking at this, I got a few more issues: - The copied filesystem code in libsa uses absolute disk offsets in bytes to locate superblocks. A backend that uses physical blocks cannot easily address such offsets if it doesn't know the block size. The filesystem code deduces this as fsize >> fsbtodb, but both values are only available after reading the superblock. - fsck_msdos (used by arm64.img as the EFI partition is mounted) fails for large sectors. The bootblock (with disk info) is always read as 512 bytes. - When testing in qemu, you can emulate a specific disk geometry including large sectors, but you cannot use a physical disk with large sectors as backend. Qemu will use I/O transfers as small as 512 bytes and it won't accept a block device.
Re: libsa and 4K devices
On 23/04/2022 15:25, Tobias Nygren wrote: On Sat, 23 Apr 2022 14:17:09 - (UTC) Michael van Elst wrote: nick.hud...@gmx.co.uk (Nick Hudson) writes: To enable efiboot to work from Apple M1 nvme I had to apply this diff so that libsa picks up the fs_fshift based FFS_FSBTODB. Is this correct or does it mean the FS has an incorrect fs_fsbtodb? (and there's a bug in mkfs somewhere) The bug is probably in the arm efi code. See port-evbarm/56356 for some of the bugs and how to fix them. https://github.com/skrll/src/commit/a5432c0ce71ea2fd1b7ad22ff6c26d01f4dca71a With this commit efiboot finds the super block... Nick
Re: libsa and 4K devices
On Sat, 23 Apr 2022 14:17:09 - (UTC) Michael van Elst wrote: > nick.hud...@gmx.co.uk (Nick Hudson) writes: > > >To enable efiboot to work from Apple M1 nvme I had to apply this diff so > >that libsa picks up the fs_fshift based FFS_FSBTODB. > > >Is this correct or does it mean the FS has an incorrect fs_fsbtodb? (and > >there's a bug in mkfs somewhere) > > > The bug is probably in the arm efi code. See port-evbarm/56356 for some of the bugs and how to fix them.
Re: libsa and 4K devices
nick.hud...@gmx.co.uk (Nick Hudson) writes: >To enable efiboot to work from Apple M1 nvme I had to apply this diff so >that libsa picks up the fs_fshift based FFS_FSBTODB. >Is this correct or does it mean the FS has an incorrect fs_fsbtodb? (and >there's a bug in mkfs somewhere) The bug is probably in the arm efi code. The NetBSD kernel once changed how to use disk addresses by making device drivers work with DEV_BSIZE units. Everything else, userland and standalone code, accesses disks in sector size units and needs to use the traditional definition in the #else part. The filesystem image stores the factor between filesystem blocks (frags) and physical disk blocks in the superblock. Traditional code needs this information, the NetBSD kernel ignores it. You can use to 'dumpfs -s' to look at the numbers.
libsa and 4K devices
Hi, To enable efiboot to work from Apple M1 nvme I had to apply this diff so that libsa picks up the fs_fshift based FFS_FSBTODB. Is this correct or does it mean the FS has an incorrect fs_fsbtodb? (and there's a bug in mkfs somewhere) Thanks, Nick Index: sys/ufs/ffs/fs.h === RCS file: /cvsroot/src/sys/ufs/ffs/fs.h,v retrieving revision 1.69 diff -u -p -r1.69 fs.h --- sys/ufs/ffs/fs.h 18 Sep 2021 03:05:20 - 1.69 +++ sys/ufs/ffs/fs.h 22 Apr 2022 08:16:04 - @@ -616,7 +616,7 @@ struct ocg { * Turn file system block numbers into disk block addresses. * This maps file system blocks to device size blocks. */ -#if defined (_KERNEL) +#if defined (_KERNEL) || defined(_STANDALONE) #define FFS_FSBTODB(fs, b) ((b) << ((fs)->fs_fshift - DEV_BSHIFT)) #define FFS_DBTOFSB(fs, b) ((b) >> ((fs)->fs_fshift - DEV_BSHIFT)) #else