U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: "Tom Rini" <trini@konsulko.com>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
	"Simon Glass" <sjg@chromium.org>,
	"Albert Aribaud" <albert.u.boot@aribaud.net>,
	"Baruch Siach" <baruch@tkos.co.il>,
	"Bin Meng" <bmeng.cn@gmail.com>,
	"Eddie James" <eajames@linux.ibm.com>,
	"Evgeny Bachinin" <EABachinin@sberdevices.ru>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Ivan Mikhaylov" <fr0st61te@gmail.com>,
	"Jaehoon Chung" <jh80.chung@samsung.com>,
	"Jerry Van Baren" <vanbaren@cideas.com>,
	"Joe Hershberger" <joe.hershberger@ni.com>,
	"Marek Behún" <kabel@kernel.org>,
	"Marek Vasut" <marek.vasut+renesas@mailbox.org>,
	"Marek Vasut" <marex@denx.de>,
	"Mattijs Korpershoek" <mkorpershoek@baylibre.com>,
	"Michal Simek" <michal.simek@amd.com>,
	"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
	"Peng Fan" <peng.fan@nxp.com>, "Qu Wenruo" <wqu@suse.com>,
	"Safae Ouajih" <souajih@baylibre.com>,
	"Sean Anderson" <sean.anderson@seco.com>,
	"Stefano Babic" <sbabic@denx.de>,
	"Tobias Waldekranz" <tobias@waldekranz.com>,
	linux-btrfs@vger.kernel.org
Subject: [PATCH 00/29] bootm: Refactoring to reduce reliance on CMDLINE (part A)
Date: Sat, 11 Nov 2023 17:08:45 -0700	[thread overview]
Message-ID: <20231112000923.73568-1-sjg@chromium.org> (raw)

It would be useful to be able to boot an OS when CONFIG_CMDLINE is
disabled. This could allow reduced code size.

Standard boot provides a way to handle programmatic boot, without
scripts, so such a feature is possible. The main impediment is the
inability to use the booting features of U-Boot without a command line.
So the solution is to avoid passing command arguments and the like to
code in boot/

A similar process has taken place with filesystems, for example, where
we have (somewhat) separate Kconfig options for the filesystem commands
and the filesystems themselves.

This series starts the process of refactoring the bootm logic so that
it can be called from standard boot without using the command line.
Mostly it removes the use of argc, argv and cmdtbl from the internal
logic.

Some limited tidy-up is included, but this is kept to smaller patches,
rather than trying to remove all #ifdefs etc. Some function comments
are added, however.

A simple programmatic boot is provided as a starting point.

This work will likely take many series, so this is just the start.

Size growth with this series for firefly-rk3288 (Thumb2) is:

       arm: (for 1/1 boards) all +23.0 rodata -49.0 text +72.0

This should be removed by:

   https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/11

but it is not included in this series as it is already large enough.

No functional change is intended in this series.


Simon Glass (29):
  arm: x86: Drop discarding of command linker-lists
  mmc: env: Unify the U_BOOT_ENV_LOCATION conditions
  treewide: Tidy up semicolon after command macros
  bootstd: Add missing header file from bootdev.h
  bootstd: Introduce programmable boot
  bootm: Drop arguments from bootm_start()
  bootm: Simplify arguments for bootm_pre_load()
  bootm: Move boot_get_kernel() higher in the file
  image: Tidy up genimg_get_kernel_addr_fit()
  bootm: Reduce arguments to boot_get_kernel()
  image: Document error codes from fit_image_load()
  bootm: Adjust boot_get_kernel() to return an error
  bootm: Use the error return from boot_get_kernel()
  bootstage: Drop BOOTSTAGE_ID_FIT_KERNEL_INFO
  bootm: Move error printing out of boot_get_kernel()
  bootm: Reduce arguments to boot_find_os()
  bootm: Reduce arguments to boot_get_ramdisk()
  fdt: Allow use of fdt_support inside if() statements
  bootm: Drop #ifdef in bootm_find_images()
  bootm: Pass image buffer to boot_get_fdt()
  bootm: Reduce arguments to boot_get_fdt()
  bootm: Reduce arguments to boot_get_fpga()
  bootm: Reduce arguments to boot_get_loadables()
  bootm: Simplify Android ramdisk addr in bootm_find_images()
  bootm: efi: Drop special call to bootm_find_other()
  bootm: optee: Drop special call to bootm_find_other()
  bootm: Adjust the parameters of bootm_find_images()
  bootm: Add a function to check overlap
  bootm: Reduce arguments to bootm_find_other()

 arch/arm/cpu/u-boot.lds      |   3 -
 arch/x86/cpu/u-boot-64.lds   |   4 -
 arch/x86/cpu/u-boot-spl.lds  |   4 -
 arch/x86/cpu/u-boot.lds      |   4 -
 board/freescale/common/vid.c |   2 +-
 board/xilinx/common/fru.c    |   2 +-
 board/xilinx/versal/cmds.c   |   2 +-
 board/xilinx/zynqmp/cmds.c   |   2 +-
 boot/Kconfig                 |  11 +
 boot/Makefile                |   2 +
 boot/bootm.c                 | 576 +++++++++++++++++++----------------
 boot/bootm_os.c              |  16 -
 boot/image-board.c           |  67 +---
 boot/image-fdt.c             |  39 +--
 boot/prog_boot.c             |  51 ++++
 cmd/booti.c                  |   4 +-
 cmd/bootz.c                  |   4 +-
 cmd/btrfs.c                  |   2 +-
 cmd/eeprom.c                 |   2 +-
 cmd/ext2.c                   |   4 +-
 cmd/fs.c                     |   8 +-
 cmd/pinmux.c                 |   2 +-
 cmd/qfw.c                    |   2 +-
 common/main.c                |   9 +
 env/mmc.c                    |   2 +-
 include/bootdev.h            |   1 +
 include/bootm.h              |  26 +-
 include/bootstage.h          |   1 -
 include/bootstd.h            |   9 +
 include/command.h            |   2 +-
 include/fdt_support.h        |   5 +-
 include/image.h              | 127 ++++++--
 32 files changed, 550 insertions(+), 445 deletions(-)
 create mode 100644 boot/prog_boot.c

-- 
2.42.0.869.gea05f2083d-goog


             reply	other threads:[~2023-11-12  0:12 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-12  0:08 Simon Glass [this message]
2023-11-12  0:08 ` [PATCH 01/29] arm: x86: Drop discarding of command linker-lists Simon Glass
2023-11-15 19:55   ` Tom Rini
2023-11-12  0:08 ` [PATCH 02/29] mmc: env: Unify the U_BOOT_ENV_LOCATION conditions Simon Glass
2023-11-15 10:02   ` Heinrich Schuchardt
2023-11-19 14:49     ` Simon Glass
2023-11-21 18:12       ` Tom Rini
2023-11-12  0:08 ` [PATCH 03/29] treewide: Tidy up semicolon after command macros Simon Glass
2023-11-15 19:58   ` Tom Rini
2023-11-12  0:08 ` [PATCH 04/29] bootstd: Add missing header file from bootdev.h Simon Glass
2023-11-12  0:08 ` [PATCH 05/29] bootstd: Introduce programmable boot Simon Glass
2023-11-12  0:08 ` [PATCH 06/29] bootm: Drop arguments from bootm_start() Simon Glass
2023-11-15 22:36   ` Tom Rini
2023-11-12  0:08 ` [PATCH 07/29] bootm: Simplify arguments for bootm_pre_load() Simon Glass
2023-11-15 22:36   ` Tom Rini
2023-11-12  0:08 ` [PATCH 08/29] bootm: Move boot_get_kernel() higher in the file Simon Glass
2023-11-15 22:36   ` Tom Rini
2023-11-12  0:08 ` [PATCH 09/29] image: Tidy up genimg_get_kernel_addr_fit() Simon Glass
2023-11-15 22:36   ` Tom Rini
2023-11-12  0:08 ` [PATCH 10/29] bootm: Reduce arguments to boot_get_kernel() Simon Glass
2023-11-15 22:36   ` Tom Rini
2023-11-12  0:08 ` [PATCH 11/29] image: Document error codes from fit_image_load() Simon Glass
2023-11-15 22:36   ` Tom Rini
2023-11-12  0:08 ` [PATCH 12/29] bootm: Adjust boot_get_kernel() to return an error Simon Glass
2023-11-15 22:36   ` Tom Rini
2023-11-12  0:08 ` [PATCH 13/29] bootm: Use the error return from boot_get_kernel() Simon Glass
2023-11-15 22:36   ` Tom Rini
2023-11-12  0:08 ` [PATCH 14/29] bootstage: Drop BOOTSTAGE_ID_FIT_KERNEL_INFO Simon Glass
2023-11-15 22:37   ` Tom Rini
2023-11-12  0:09 ` [PATCH 15/29] bootm: Move error printing out of boot_get_kernel() Simon Glass
2023-11-15 22:37   ` Tom Rini
2023-11-12  0:09 ` [PATCH 16/29] bootm: Reduce arguments to boot_find_os() Simon Glass
2023-11-15 22:37   ` Tom Rini
2023-11-12  0:09 ` [PATCH 17/29] bootm: Reduce arguments to boot_get_ramdisk() Simon Glass
2023-11-15 22:37   ` Tom Rini
2023-11-12  0:09 ` [PATCH 18/29] fdt: Allow use of fdt_support inside if() statements Simon Glass
2023-11-15 22:37   ` Tom Rini
2023-11-12  0:09 ` [PATCH 19/29] bootm: Drop #ifdef in bootm_find_images() Simon Glass
2023-11-12  0:09 ` [PATCH 20/29] bootm: Pass image buffer to boot_get_fdt() Simon Glass
2023-11-12  0:09 ` [PATCH 21/29] bootm: Reduce arguments " Simon Glass
2023-11-15 22:37   ` Tom Rini
2023-11-12  0:09 ` [PATCH 22/29] bootm: Reduce arguments to boot_get_fpga() Simon Glass
2023-11-15 22:37   ` Tom Rini
2023-11-12  0:09 ` [PATCH 23/29] bootm: Reduce arguments to boot_get_loadables() Simon Glass
2023-11-15 22:37   ` Tom Rini
2023-11-12  0:09 ` [PATCH 24/29] bootm: Simplify Android ramdisk addr in bootm_find_images() Simon Glass
2023-11-15 22:37   ` Tom Rini
2023-11-12  0:09 ` [PATCH 25/29] bootm: efi: Drop special call to bootm_find_other() Simon Glass
2023-11-12  0:09 ` [PATCH 26/29] bootm: optee: " Simon Glass
2023-11-12  0:09 ` [PATCH 27/29] bootm: Adjust the parameters of bootm_find_images() Simon Glass
2023-11-15 22:38   ` Tom Rini
2023-11-16  1:42     ` Simon Glass
2023-11-16  1:47       ` Tom Rini
2023-11-16  1:56         ` Simon Glass
2023-11-16  2:07           ` Tom Rini
2023-11-16  2:35             ` Simon Glass
2023-11-12  0:09 ` [PATCH 28/29] bootm: Add a function to check overlap Simon Glass
2023-11-15 22:38   ` Tom Rini
2023-11-12  0:09 ` [PATCH 29/29] bootm: Reduce arguments to bootm_find_other() Simon Glass
2023-11-15 22:38   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231112000923.73568-1-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=EABachinin@sberdevices.ru \
    --cc=albert.u.boot@aribaud.net \
    --cc=baruch@tkos.co.il \
    --cc=bmeng.cn@gmail.com \
    --cc=eajames@linux.ibm.com \
    --cc=festevam@gmail.com \
    --cc=fr0st61te@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jh80.chung@samsung.com \
    --cc=joe.hershberger@ni.com \
    --cc=kabel@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=marex@denx.de \
    --cc=michal.simek@amd.com \
    --cc=mkorpershoek@baylibre.com \
    --cc=peng.fan@nxp.com \
    --cc=sbabic@denx.de \
    --cc=sean.anderson@seco.com \
    --cc=souajih@baylibre.com \
    --cc=tobias@waldekranz.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    --cc=vanbaren@cideas.com \
    --cc=wqu@suse.com \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox