Most commands access the filesystem through the command-line interface
rather than the filesystem API itself. Add a new header file which
contains these functions, so we can separate commands from the API.
Signed-off-by: Simon Glass <sjg@chromium.org>
Some parts of fs_legacy.h are useful for the new fs subsystem. Add a
common header and move the filesystem types and some definition into it.
Use an enum for the filesystem type, to permit type checking.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a new SPL_FS_LEGACY which mirrors the recently added FS_LEGACY
option.
Select this new option when filesystems are required, either due to
SPL_FS_LOADER or one of the filesystems.
Signed-off-by: Simon Glass <sjg@chromium.org>
There is currently no Kconfig used and the filesystem code is always
included in U-Boot proper. Add an option to control this. For now it is
always on.
Signed-off-by: Simon Glass <sjg@chromium.org>
The existing name is confusing as this function relates to the
devicetree rather than the device itself.
Rename it to include the word 'read' like other functions in this API.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add the devicetree snippet to include the new virtio block-device
emulator in the test devicetree.
Series-to: u-boot
Cover-letter:
virtio: Add a fully functional virtio emulator
The current implementation of virtio in sandbox is fairly basic. It is
enough to test the behaviour of queues, but it does not test the full
stack, e.g. using MMIO to access a block device.
This series adds a new type of virtio emulator which is capable of
handling MMIO. Some support for MMIO is added to sandbox in the process.
With this, a dummy block device can be used from within U-Boot, without
running on QEMU
END
Signed-off-by: Simon Glass <sjg@chromium.org>
Add an emulator driver for block devices, so that sandbox can test these
fully. The emulator uses MMIO to communicate with the controlling virtio
device.
Signed-off-by: Simon Glass <sjg@chromium.org>
The existing sandbox implementation of virtio only tests the basic API.
It is not able to provide a block device, for example.
Add a new implementation which operations at a higher level. It makes
use of the existing MMIO driver to perform virtio operations.
This emulator-device should be the parent of a function-specific
emulator. That emulator uses this MMIO transport to communicate with the
controller:
virtio-blk {
compatible = "sandbox,virtio-blk-emul";
mmio {
compatible = "sandbox,virtio-emul";
};
};
A new UCLASS_VIRTIO_EMUL uclass is created for the child devices, which
implement the actual function (block device, random-number generator,
etc.)
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a way for calls to readl()/writel() etc. to be picked up by a driver
in order to implement MMIO.
This works by registering some functions, which are then called when
accesses occur.
Add comments to sandbox_read() and sandbox_write() while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Sandbox needs to include system headers in some files, but also wants
to use alist. Adjust the headers to permit this.
Signed-off-by: Simon Glass <sjg@chromium.org>
The new Kbuild changes have broken this script, so 'make qcheck' and
'make pcheck' don't work anymore.
Unset some environment variables to resolve this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: bf030467d2 (Merge patch series "Update kbuild")
This script has conflict markers in it so comes up as an unwanted match
when searching them. Remove the file since it is not used in U-Boot.
Signed-off-by: Simon Glass <sjg@chromium.org>
Use programmatic boot so that it is possible to boot without
CONFIG_CMDLINE enabled.
Series-to: u-boot
Cover-letter:
emulation: Improve support for booting from QFW
U-Boot supports booting Linux from QFW which means that the kernel and
any initrd are provided on the QEMU command line instead of being found
in boot media.
This series improves this support in several ways:
- Enhances bootstd to implement 'bootflow read', thus allowing the
files to be loaded and inspected (with potential cmdline changes)
before booting
- Updates bootstd to use programmatic boot, so that it works even when
CONFIG_CMDLINE is disabled
- Expands build-qemu script to allow providing cmdline and root disk
It also includes a rough script to time U-Boot when running QEMU with
kvm, making use of the qemu-boot-time repo:
https://github.com/stefano-garzarella/qemu-boot-time.git
END
Signed-off-by: Simon Glass <sjg@chromium.org>
The zboot option is used on x86, so add support for it. Use the
programmatic boot API rather than building a command to run, so that it
can work without CONFIG_CMDLINE
For now the other boot options still use the cmdline.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is useful to be able to read the images into memory without actually
booting the kernel. This allows the cmdline to be changed using
'bootflow cmd', for example. Implement this for the QFW bootmeth.
Signed-off-by: Simon Glass <sjg@chromium.org>
QEMU provides a SETUP_ADDR value which should be honoured when placing
the setup block, since that block can include pointers into other parts
of itself.
Instead of putting the setup block immediately before the kernel, put it
where QEMU requests.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a new qemu_fwcfg_read_files() function which reads files into the
provided location. Use this from qemu_fwcfg_setup_kernel()
Signed-off-by: Simon Glass <sjg@chromium.org>
The qemu_fwcfg_setup_kernel() function checks whether a kernel exists
and also reads it. With bootstd we want to do those two steps
separately.
Add a new qemu_fwcfg_read_info() function which gets all the values and
returns then, including the full cmdline. Use that from the outer
function.
The new function also reads the setup address, although this it not used
by the code at present.
Use an abuf for the cmdline since we don't want the read_info function
to alter unallocated memory.
Signed-off-by: Simon Glass <sjg@chromium.org>
Instead of worrying about endianness in each expression, move the
conversion into the function.
Use ulong for values, since this is the normal type for addresses in
U-Boot
Signed-off-by: Simon Glass <sjg@chromium.org>
Move the selector reading into a separate function so we can simplify
qemu_fwcfg_setup_kernel().
Read all sizes at the start and add an enum for the selector.
Signed-off-by: Simon Glass <sjg@chromium.org>
The bootflow_img_find() function does not permit updating the image.
Some bootmeths may want to do this, e.g. to change the address. Add a
function which returns a writeable pointer.
Signed-off-by: Simon Glass <sjg@chromium.org>
In some cases it is convenient to provide an address when initing an
abuf, instead of a pointer. Add a function for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
With kernel size going above 15M we need enough space between where the
kernel loaded and the ramdisk, otherwise the kernel corrupts its ramdisk
while relocating itself. Move the ramdisk up to 128M
Signed-off-by: Simon Glass <sjg@chromium.org>
It is possible to benchmark U-Boot using QEMU as described here:
https://github.com/stefano-garzarella/qemu-boot-time
On x86 devices, that script can read post codes from a perf trace. Add
a code which is emitted just before handing off to the Linux kernel.
Existing post codes can be used to determine when U-Boot starts.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is possible to use QEMU and kvm to measure the time taken by U-Boot
to hand off to Linux. Add a script to support this and print the
resulting time.
This requires a fair bit of setup; see the script for details.
Signed-off-by: Simon Glass <sjg@chromium.org>
Qboot is a good demonstration of the fastest possible boot on x86. Add
a way to run Qboot instead of U-Boot, for easy comparison.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a -C flag to enable the serial console when booting Linux. This is
only supported on x86, but a future -c flag might perhaps support other
archs.
Signed-off-by: Simon Glass <sjg@chromium.org>
QEMU provides a special way to pass a kernel and a devicetree via the
QFW interface. Add -K and -I options to provide these.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add 'imply CONFIG_POSITION_INDEPENTDENT' for QEMU arm arch. This allows
qemu arm boards to load u-boot.bin at any address. It is skipped by
default when u-boot is loaded by either --bios or --kernel.
To load u-boot.bin at a different address, one can use u-boot
chain-loading or qemu loader device[1].
[1] https://www.qemu.org/docs/master/system/generic-loader.html
Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Fixes: #4
when CONFIG_BLOBLIST is enabled, the section is switched to .data but is
not switched back to .text. It makes all the code below placed in .data
section, also breaks CONFIG_POSITION_INDEPENDENT.
Fix it by adding `.section .text` to switch the section back to .text.
Fixes: 5103e69344 ("arm: armv7: save boot arguments")
Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Add a testcase to ensure that scan_and_prop_bootph() actually
propagates bootph-* properties to supernodes.
Signed-off-by: Moteen Shah <m-shah@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reduce subject below 60-char limit:
Signed-off-by: Simon Glass <sjg@chromium.org>
As per bootph schema, bootph-* property in child node should be
implied in their parent, but this feature is not implemented in
the U-Boot proper stage (before relocation) resulting in devices
not being bound because of the missing bootph-all or bootph-some-ram
property in the parent node.
To mitigate this issue, add a function to scan through all the nodes
in the device-tree for bootph-all and bootph-some-ram properties. If
found, propagate it to all of its parent nodes up the hierarchy.
Signed-off-by: Moteen Shah <m-shah@ti.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Reduce subject below 60-char limit:
Signed-off-by: Simon Glass <sjg@chromium.org>
Some SoCs require a Trusted Firmware-A (TF-A) AP Trusted ROM (BL1) to
initialize the SoC before U-Boot can run properly. Add an atf-bl1 etype
so we can properly package BL1 into a final binary
Signed-off-by: Bryan Brattlof <bb@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>
key-name-hint property in u-boot-spl-pubkey-dtb binman entry may contain
a path instead of a filename due to user mistake.
Because we currently assume it is a filename instead of a path, binman
will find the full path to the key based on that path, and return the
dirname of the full path but keeps the path in key-name-hint instead of
stripping the directories from it.
This means mkimage will fail with the following error message if we have
key-name-hint set to keys/dev:
binman: Error 1 running 'fdt_add_pubkey -a sha256,rsa2048 -k /home/qschulz/work/upstream/u-boot/keys -n keys/dev -r conf /home/qschulz/work/upstream/u-boot/build/ringneck/u-boot-spl-dtbdhsfx3mf': Couldn't open RSA certificate: '/home/qschulz/work/upstream/u-boot/keys/keys/dev.crt': No such file or directory
Let's make it a bit more obvious what the error is by erroring out in
binman if a path is provided in key-name-hint (it is named key-name-hint
and not key-path-hint after all).
Fixes: 5609843b57 ("binman: etype: Add u-boot-spl-pubkey-dtb etype")
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reduce subject below 60-char limit
Signed-off-by: Simon Glass <sjg@chromium.org>
mkimage doesn't fail if it cannot find the public key but it prints to
stderr. Considering that btool.run() discards stderr, it means binman
happily returns an unsigned FIT and doesn't tell you something went
wrong.
Binman will actually find the file if there's a path in the
key-name-hint property but the current logic expects key-name-hint to be
a filename and thus returns the dirname of the found path for the key,
but with the original key-name-hint appended. This means we can have the
following:
- key-name-hint = "keys/dev"
- name = "/home/qschulz/work/upstream/u-boot/keys/"
so we pass /home/qschulz/work/upstream/u-boot/keys/ to the -k option of
mkimage but the FIT still contains "keys/dev" in key-name-hint which
means mkimage will try to find the key at
/home/qschulz/work/upstream/u-boot/keys/keys/, which doesn't exist.
Let's assume paths are simply not supported (it is named key-name-hint
and not key-path-hint after all) and raise an error if the property
contains a path so that the build fails and not quietly.
Fixes: 133c000ca3 ("binman: implement signing FIT images during image build")
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
The kernel searching bootconfig will be off-by-1 and never match
thus always not found in this case.
Signed-off-by: George Chan <gchan9527@gmail.com>
Use 'fdt' as the tag and update fdt_test_chosen:
Signed-off-by: Simon Glass <sjg@chromium.org>