u-boot-brain/api
fuz@fuz.su f2288c5a5b Apparent conflict between CONFIG_BLK and CONFIG_API
Good evening,

I am trying to port FreeBSD to the ASUS Tinker Board, a computer based
on the Rockchip 3288 SoC. FreeBSD's boot loader (named loader(8)) needs
CONFIG_API to be enabled, but trying to build an U-Boot from trunk with
both CONFIG_API and CONFIG_BLK (as required for Rockchip SoC's?) leads
to the following build failure:

$ CROSS_COMPILE=arm-none-eabi- gmake tinker-rk3288_defconfig all
...
  CC      api/api_storage.o
api/api_storage.c: In function 'dev_read_stor':
api/api_storage.c:334:9: error: 'struct blk_desc' has no member named 'block_read'
  if ((dd->block_read) == NULL) {
         ^~
api/api_storage.c:339:11: error: 'struct blk_desc' has no member named 'block_read'
  return dd->block_read(dd, start, len, buf);
           ^~
api/api_storage.c:340:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
gmake[2]: *** [scripts/Makefile.build:281: api/api_storage.o] Fehler 1
gmake[1]: *** [Makefile:1229: api] Fehler 2
gmake: *** [Makefile:460: __build_one_by_one] Error 2

I applied the following fix, but the product doesn't boot. Perhaps
that's not a property of the fix though:

Yours,
Robert Clausecker
2017-04-08 09:26:48 -04:00
..
Kconfig kconfig: Add API kconfig file 2017-02-08 15:56:31 -05:00
Makefile api: Add FreeBSD API support for MIPS platforms 2016-02-08 10:22:38 -05:00
README Coding Style cleanup; update CHANGELOG 2008-01-10 00:55:14 +01:00
api.c api: Use hashtable function for API_env_enum 2017-01-20 09:15:24 -05:00
api_display.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
api_net.c api: Disable api_net when DM is used 2016-07-22 14:03:43 +02:00
api_platform-arm.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
api_platform-mips.c api: Add FreeBSD API support for MIPS platforms 2016-02-08 10:22:38 -05:00
api_platform-powerpc.c powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260 2014-03-07 10:59:06 -05:00
api_private.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
api_storage.c Apparent conflict between CONFIG_BLK and CONFIG_API 2017-04-08 09:26:48 -04:00

README

U-Boot machine/arch independent API for external apps
=====================================================

1.  Main assumptions

  - there is a single entry point (syscall) to the API

  - per current design the syscall is a C-callable function in the U-Boot
    text, which might evolve into a real syscall using machine exception trap
    once this initial version proves functional

  - the consumer app is responsible for producing appropriate context (call
    number and arguments)

  - upon entry, the syscall dispatches the call to other (existing) U-Boot
    functional areas like networking or storage operations

  - consumer application will recognize the API is available by searching
    a specified (assumed by convention) range of address space for the
    signature

  - the U-Boot integral part of the API is meant to be thin and non-intrusive,
    leaving as much processing as possible on the consumer application side,
    for example it doesn't keep states, but relies on hints from the app and
    so on

  - optional (CONFIG_API)


2. Calls

  - console related (getc, putc, tstc etc.)
  - system (reset, platform info)
  - time (delay, current)
  - env vars (enumerate all, get, set)
  - devices (enumerate all, open, close, read, write); currently two classes
    of devices are recognized and supported: network and storage (ide, scsi,
    usb etc.)


3. Structure overview

  - core API, integral part of U-Boot, mandatory
    - implements the single entry point (mimics UNIX syscall)

  - glue
    - entry point at the consumer side, allows to make syscall, mandatory
      part

    - helper conveniency wrappers so that consumer app does not have to use
      the syscall directly, but in a more friendly manner (a la libc calls),
      optional part

  - consumer application
    - calls directly, or leverages the provided glue mid-layer