[edk2-devel] [Patch 0/3] Ext4Pkg: Add Ext4Pkg

Michael D Kinney michael.d.kinney at intel.com
Thu Aug 5 16:02:27 UTC 2021


Hi Pedro,

There is a build failure when building the Ext4Pkg.dsc file for a missing RegisterFilerLib mapping.

The correct fix for this issue is to add the following !include statement to the DSC file after the
the [Defines] section.

!include MdePkg/MdeLibs.dsc.inc

With this one change, the X64 VS2019 builds pass.

There is an additional issue for IA32 VS2019 NOOPT builds.

build -a IA32 -n 5 -t VS2019 -p Features\Ext4Pkg\Ext4Pkg.dsc -b NOOPT

Ext4.lib(DiskUtil.obj) : error LNK2001: unresolved external symbol __allmul
Ext4.lib(File.obj) : error LNK2001: unresolved external symbol __allmul
Ext4.lib(Inode.obj) : error LNK2001: unresolved external symbol __allmul
Ext4.lib(BlockGroup.obj) : error LNK2001: unresolved external symbol __allmul
Ext4.lib(Superblock.obj) : error LNK2001: unresolved external symbol __allmul
Ext4.lib(BlockGroup.obj) : error LNK2001: unresolved external symbol __allshl
Ext4.lib(Superblock.obj) : error LNK2001: unresolved external symbol __allshl
Ext4.lib(File.obj) : error LNK2001: unresolved external symbol __allshl
Ext4.lib(Extents.obj) : error LNK2001: unresolved external symbol __allshl
Ext4.lib(Directory.obj) : error LNK2001: unresolved external symbol __allshl
Ext4.lib(Inode.obj) : error LNK2001: unresolved external symbol __allshl

These are usually caused by doing 64-bit math operations when building for IA32.
There are BaseLib functions that do 64-bit path for multiply and left shift that
need to be used when operands are of type INT64 or UINT64.

>From the disasm, the following functions are doing 64bit multiple (__allmull)
_Ext4GetFilesystemInfo:
_Ext4FilePhysicalSpace:
_Ext4Read:
_Ext4BlockToByteOffset:
_Ext4ReadInode:
_Ext4OpenSuperblock:
_Ext4ReadBlocks:


>From the disasm, the following functions are doing 64-bit shift or power of 2 multiply (__allshl)

_Ext4GetFileInfo:
_Ext4MakeBlockNumberFromHalfs:
_Ext4SetPosition:
_Ext4ExtentIdxLeafBlock:
_Ext4InodeSize:
_Ext4RetrieveDirent:
_Ext4FileATime:
_Ext4FileCrTime:
_Ext4FileMTime:
_Ext4FilePhysicalSpace:
_Ext4InodeSize:
_Ext4Read:
_Ext4MakeBlockNumberFromHalfs:
_Ext4MakeBlockNumberFromHalfs:

For example, Ext4GetFileInfo, uses EXT4_INODE_SIZE() macro, which does a 32-bit shift:

    ext4disk.h:#define EXT4_INODE_SIZE (ino)  (((UINT64)ino->i_size_hi << 32) | ino->i_size_lo)

This can be changes to use the BaseLib function:

    UINT64
    EFIAPI
    LShiftU64 (
      IN      UINT64                    Operand,
      IN      UINTN                     Count
      );

    ext4disk.h:#define EXT4_INODE_SIZE (ino)  ((LShiftU64 (no->i_size_hi, 32) | ino->i_size_lo)

Best regards,

Mike

> -----Original Message-----
> From: Pedro Falcato <pedro.falcato at gmail.com>
> Sent: Friday, July 30, 2021 9:17 AM
> To: devel at edk2.groups.io
> Cc: Pedro Falcato <pedro.falcato at gmail.com>; Leif Lindholm <leif at nuviainc.com>; Kinney, Michael D
> <michael.d.kinney at intel.com>; Bret Barkelew <Bret.Barkelew at microsoft.com>
> Subject: [Patch 0/3] Ext4Pkg: Add Ext4Pkg
> 
> This patch-set adds Ext4Pkg, a package designed to hold various drivers and
> utilities related to the EXT4 filesystem.
> 
> Right now, it holds a single read-only UEFI EXT4 driver (Ext4Dxe), which consumes the
> DISK_IO, BLOCK_IO and DISK_IO2 protocols and produce EFI_FILE_PROTOCOL and
> EFI_SIMPLE_FILE_SYSTEM_PROTOCOL; this driver allows the mounting of EXT4 partitions and
> the reading of their contents.
> 
> Relevant RFC discussion, which includes a more in-depth walkthrough of EXT4 internals and
> driver limitations is available at https://edk2.groups.io/g/devel/topic/84368561.
> 
> Cc: Leif Lindholm <leif at nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney at intel.com>
> Cc: Bret Barkelew <Bret.Barkelew at microsoft.com>
> 
> Pedro Falcato (3):
>   Ext4Pkg: Add Ext4Pkg.dec and Ext4Pkg.uni.
>   Ext4Pkg: Add Ext4Dxe driver.
>   Ext4Pkg: Add .DSC file.
> 
>  Features/Ext4Pkg/Ext4Dxe/BlockGroup.c | 208 ++++++
>  Features/Ext4Pkg/Ext4Dxe/Collation.c  | 157 +++++
>  Features/Ext4Pkg/Ext4Dxe/Crc16.c      |  75 ++
>  Features/Ext4Pkg/Ext4Dxe/Crc32c.c     |  84 +++
>  Features/Ext4Pkg/Ext4Dxe/Directory.c  | 492 ++++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/DiskUtil.c   |  83 +++
>  Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   | 450 ++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c    | 454 +++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    | 942 ++++++++++++++++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  | 147 ++++
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.uni  |  15 +
>  Features/Ext4Pkg/Ext4Dxe/Extents.c    | 616 +++++++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/File.c       | 583 ++++++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Inode.c      | 468 +++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Partition.c  | 120 ++++
>  Features/Ext4Pkg/Ext4Dxe/Superblock.c | 257 +++++++
>  Features/Ext4Pkg/Ext4Pkg.dec          |  17 +
>  Features/Ext4Pkg/Ext4Pkg.dsc          |  68 ++
>  Features/Ext4Pkg/Ext4Pkg.uni          |  14 +
>  19 files changed, 5250 insertions(+)
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/BlockGroup.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Collation.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc16.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc32c.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Directory.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/DiskUtil.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.uni
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Extents.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/File.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Inode.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Partition.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Superblock.c
>  create mode 100644 Features/Ext4Pkg/Ext4Pkg.dec
>  create mode 100644 Features/Ext4Pkg/Ext4Pkg.dsc
>  create mode 100644 Features/Ext4Pkg/Ext4Pkg.uni
> 
> --
> 2.32.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78719): https://edk2.groups.io/g/devel/message/78719
Mute This Topic: https://groups.io/mt/84553674/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list