summaryrefslogtreecommitdiff
path: root/fs/cbfs
AgeCommit message (Collapse)AuthorFilesLines
2019-08-18cbfs: Rename camel-case variablesSimon Glass1-22/+22
Rename some camel-case variables to match U-Boot style. Camel case is not generally allowed in U-Boot. Rename this variable to fit in with the style. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-08-18cbfs: Add functions to support multiple CBFSsSimon Glass1-0/+46
Sometimes an image has multiple CBFS. The current CBFS API is limited to handling only one at time. Also it keeps track of the CBFS internally in BSS, which does not work before relocation, for example. Add a few new functions to overcome these limitations. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-08-18cbfs: Move result variable into the structSimon Glass1-20/+28
Move the result variable into the struct also, so that it can be used when BSS is not available. Add a function to read it. Note that all functions sill use the BSS version of the data. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-08-18cbfs: Move static variables into a structSimon Glass1-32/+59
At present there are a number of static variables in BSS. This cannot work with SPL, at least until BSS is available in board_init_r(). Move the variables into a struct, so it is possible to malloc() it and use it before BSS is available. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-08-18cbfs: Move declarations above functionsSimon Glass1-9/+5
At present this file has a function at the top, above declarations. This is normally avoided, so fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-08-18cbfs: Allow CBFS to be used in SPLSimon Glass1-0/+12
Add a new Kconfig option to enable CBFS in SPL. This can be useful when the memory-init code is in CBFS. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2019-07-24cbfs: Rename checksum to attributes_offsetSimon Glass1-2/+2
It seems that this field has been renamed in later version of coreboot. Update it. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-31fs: cbfs: Fix out of bound access during CBFS walking throughBin Meng1-2/+2
The call to file_cbfs_fill_cache() is given with the parameter 'start' pointing to the offset by the CBFS base address, but with the parameter 'size' that equals to the whole CBFS size. During CBFS walking through, it checks files one by one and after it pass over the end of the CBFS which is 4GiB boundary it tries to check files from address 0 and so on, until the overall size the codes checked hits to the given 'size'. Fix this by passing 'start' pointing to the CBFS base address. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-12-31fs: cbfs: remove wrong header validationChristian Gmeiner1-2/+1
cbfs_fileheader.len indicates the content size of the file in the cbfs, and it has nothing to do with cbfs_fileheader.offset which is the starting address of the file in the cbfs. Remove such check in file_cbfs_next_file(). Before this change 'cbfsinit' failed with 'Bad CBFS file'. After this change all cbfs commands are working as expected. Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> [bmeng: keep the necessary header sanity check] Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2-5/+2
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-03-31fs: cbfs: fix locating the cbfs headerAndre Heider1-2/+2
The value at the end of the rom is not a pointer, it is an offset relative to the end of rom. Signed-off-by: Andre Heider <a.heider@gmail.com>
2017-04-30fs: Kconfig: Add a separate config for FS_CBFSSimon Glass1-0/+8
Rather than using CMD_CBFS for both the filesystem and its command, we should have a separate option for each. This allows us to enable CBFS support without the command, if desired, which reduces U-Boot's size slightly. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: imply FS_CBFS on SYS_COREBOOT] Signed-off-by: Tom Rini <trini@konsulko.com>
2016-08-16cbfs: Fix incorrect CBFS file header size being usedYaroslav K1-4/+4
This fixes incorrect filenames in cbfsls output. Signed-off-by: Yaroslav K. <yar444@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> [clean up checkpatch errors and warnings] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2016-06-19fs: cbfs: Fix build of fs/cbfs/cbfs.c when building u-boot sandbox on x86 32-bitGuillaume GARDET1-0/+1
Fix the following build errors when building sandbox on x86 32-bit: In file included from fs/cbfs/cbfs.c:8:0: include/malloc.h:364:7: error: conflicting types for 'memset' void* memset(void*, int, size_t); ^ In file included from include/compiler.h:123:0, from include/cbfs.h:10, from fs/cbfs/cbfs.c:7: include/linux/string.h:78:15: note: previous declaration of 'memset' was here extern void * memset(void *,int,__kernel_size_t); ^ In file included from fs/cbfs/cbfs.c:8:0: include/malloc.h:365:7: error: conflicting types for 'memcpy' void* memcpy(void*, const void*, size_t); ^ In file included from include/compiler.h:123:0, from include/cbfs.h:10, from fs/cbfs/cbfs.c:7: include/linux/string.h:81:15: note: previous declaration of 'memcpy' was here extern void * memcpy(void *,const void *,__kernel_size_t); ^ scripts/Makefile.build:280: recipe for target 'fs/cbfs/cbfs.o' failed Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2013-11-17fs: descend into sub directories when it is necessaryMasahiro Yamada1-1/+1
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-10-31fs: convert makefiles to Kbuild styleMasahiro Yamada1-23/+1
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2-28/+2
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2012-12-07cbfs: Remove mention of CREDITS filesSimon Glass2-6/+1
As requested by Wolfgang, remove references to CREDITS in the CBFS files. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-10-22fs: Add a Coreboot Filesystem (CBFS) driver and commandsGabe Black2-0/+382
This change adds CBFS support and some commands to use it to u-boot. These commands are: cbfsinit - Initialize CBFS support and pull all metadata into RAM. The end of the ROM is an optional parameter which defaults to the standard 0xffffffff and can be used to support multiple CBFSes in a system. The last one set up with cbfsinit is the one that will be used. cbfsinfo - Print information from the CBFS header. cbfsls - Print out the size, type, and name of all the files in the current CBFS. Recognized types are translated into symbolic names. cbfsload - Load a file from CBFS into memory. Like the similar command for fat filesystems, you can optionally provide a maximum size. Support for CBFS is compiled in when the CONFIG_CMD_CBFS option is specified. The CBFS driver can also be used programmatically from within u-boot. If u-boot needs something out of CBFS very early before the heap is configured, it won't be able to use the normal CBFS support which caches some information in memory it allocates from the heap. The cbfs_file_find_uncached function searches a CBFS instance without touching the heap. Signed-off-by: Gabe Black <gabeblack@google.com> Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>