"Das U-Boot" Source Tree
at jcs/rk3128 65 lines 1.7 kB view raw
1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * 'bootstd' command 4 * 5 * Copyright 2024 Google LLC 6 * Written by Simon Glass <sjg@chromium.org> 7 */ 8 9#include <bootdev.h> 10#include <bootflow.h> 11#include <bootmeth.h> 12#include <bootstd.h> 13#include <command.h> 14#include <dm.h> 15#include <malloc.h> 16#include <dm/uclass-internal.h> 17 18static int do_bootstd_images(struct cmd_tbl *cmdtp, int flag, int argc, 19 char *const argv[]) 20{ 21 const struct bootflow *bflow; 22 struct bootstd_priv *std; 23 int ret, i; 24 25 ret = bootstd_get_priv(&std); 26 if (ret) { 27 printf("Cannot get bootstd (err=%d)\n", ret); 28 return CMD_RET_FAILURE; 29 } 30 31 printf("Seq Bootflow Type At Size Filename\n"); 32 printf("--- ------------------- -------------- -------- -------- ----------------\n"); 33 34 /* 35 * Use the ordering if we have one, so long as we are not trying to list 36 * all bootmethds 37 */ 38 i = 0; 39 alist_for_each(bflow, &std->bootflows) { 40 const struct bootflow_img *img; 41 42 alist_for_each(img, &bflow->images) { 43 printf("%3d %-20.20s %-15.15s ", 44 bootflow_get_seq(bflow), bflow->name, 45 bootflow_img_type_name(img->type)); 46 if (img->addr) 47 printf("%8lx", img->addr); 48 else 49 printf("%8s", "-"); 50 printf(" %8lx %s\n", img->size, img->fname); 51 i++; 52 } 53 } 54 55 printf("--- ------------------- -------------- -------- -------- ----------------\n"); 56 printf("(%d image%s)\n", i, i != 1 ? "s" : ""); 57 58 return 0; 59} 60 61U_BOOT_LONGHELP(bootstd, 62 "images - list loaded images"); 63 64U_BOOT_CMD_WITH_SUBCMDS(bootstd, "Standard-boot operation", bootstd_help_text, 65 U_BOOT_SUBCMD_MKENT(images, 1, 1, do_bootstd_images));