U-Boot supports a fairly wide variety of filesystems, including ext4, ubifs, fat, exfat, zfs, btrfs. These are an important part of bootloader functionality, since reading files from bare partitions or disk offsets is neither scalable nor convenient. The filesystem API is functional but could use an overhaul. The main interface is in fs/fs.c, which looks like this: At first glance this seems like a reasonable API. But where is the filesystem specified? The API seems to assume that this is already present somehow. In fact there is a pair of separate functions responsible for selecting which filesystem the API acts on: When you want to access a file, call either of these functions. It sets three ‘global’ variables, fs_dev_desc, fs_dev_part and fs_type . After each operation, a call to fs_close() resets things. This means you must select the block device before each operation. For example, see this code in bootmeth-uclass.c: […]