ipq5332: TINY NOR: remove unused commands and functions

Below commands and functions are disabled
for reducing image footprint.

Introduced new config CONFIG_REDUCE_FOOTPRINT
to use for non-standard size reductions.

Commands disabled
-----------------
base, bootp, chpart, fdt

Added new configs to control enablement
of above commands respectively.
CONFIG_CMD_DISABLE_BASE
CONFIG_CMD_DISABLE_BOOTP,
CONFIG_CMD_DISABLE_CHPART

Functions disabled
------------------
- remove complete fdt support
- fit_image_print, fit_image_print_data, fit_image_print_verification_data
- fit_image_check_target_arch
- fit_image_get_os, fit_image_get_arch, fit_image_get_type, fit_image_get_comp,
- fit_image_check_os, fit_image_check_arch, fit_image_check_type,
  fit_image_check_comp,
- get_table_entry_id, genimg_get_os_id, genimg_get_arch_id, genimg_get_type_id,
  genimg_get_comp_id

Change-Id: I10259c0b70f6e84c850fd28f551df752b3cba814
Signed-off-by: Gokul Sriram Palanisamy <quic_gokulsri@quicinc.com>
Signed-off-by: Timple Raj M <quic_timple@quicinc.com>
This commit is contained in:
Gokul Sriram Palanisamy 2022-07-14 08:48:07 +05:30
parent ca9ece4989
commit cdd2ba4fcb
13 changed files with 78 additions and 18 deletions

View file

@ -363,7 +363,9 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
return 0;
}
#ifndef CONFIG_REDUCE_FOOTPRINT
boot_prep_linux(images);
#endif
boot_jump_linux(images, flag);
return 0;
}

View file

@ -98,7 +98,10 @@ obj-$(CONFIG_CMD_EXT4) += cmd_ext4.o
obj-$(CONFIG_CMD_EXT2) += cmd_ext2.o
obj-$(CONFIG_CMD_FAT) += cmd_fat.o
obj-$(CONFIG_CMD_FDC) += cmd_fdc.o
obj-$(CONFIG_OF_LIBFDT) += cmd_fdt.o fdt_support.o
ifndef CONFIG_CMD_DISABLE_FDT
obj-y += cmd_fdt.o
endif
obj-$(CONFIG_OF_LIBFDT) += fdt_support.o
obj-$(CONFIG_CMD_FITUPD) += cmd_fitupd.o
obj-$(CONFIG_CMD_FLASH) += cmd_flash.o
obj-$(CONFIG_CMD_FLASHWRITE) += cmd_flashwrite.o

View file

@ -112,6 +112,12 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
#endif
#if defined(CONFIG_FIT)
case IMAGE_FORMAT_FIT:
#ifdef CONFIG_REDUCE_FOOTPRINT
images.os.type = IH_TYPE_KERNEL;
images.os.comp = IH_COMP_LZMA;
images.os.os = IH_OS_LINUX;
images.os.arch = IH_ARCH_ARM;
#else
if (fit_image_get_type(images.fit_hdr_os,
images.fit_noffset_os,
&images.os.type)) {
@ -141,6 +147,7 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
puts("Can't get image ARCH!\n");
return 1;
}
#endif
images.os.end = fit_get_end(images.fit_hdr_os);
@ -244,7 +251,7 @@ int bootm_find_images(int flag, int argc, char * const argv[])
puts("Could not find a valid device tree\n");
return 1;
}
set_working_fdt_addr((ulong)images.ft_addr);
setenv_hex("fdtaddr", (ulong)images.ft_addr);
#endif
#if defined(CONFIG_FIT)
@ -914,6 +921,7 @@ void memmove_wd(void *to, void *from, size_t len, ulong chunksz)
memmove(to, from, len);
}
#ifdef CONFIG_FIT_SIGNATURE
static int bootm_host_load_image(const void *fit, int req_image_type, int cfg_noffset)
{
const char *fit_uname_config = NULL;
@ -979,5 +987,6 @@ int bootm_host_load_images(const void *fit, int cfg_noffset)
/* Return the first error we found */
return err;
}
#endif
#endif /* ndef USE_HOSTCC */

View file

@ -492,6 +492,7 @@ static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
#ifndef CONFIG_CMD_DISABLE_BASE
static int do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
@ -506,6 +507,14 @@ static int do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc,
return 0;
}
U_BOOT_CMD(
base, 2, 1, do_mem_base,
"print or set address offset",
"\n - print address offset for memory commands\n"
"base off\n - set address offset for memory commands to 'off'"
);
#endif
static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
@ -1342,13 +1351,6 @@ static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
}
#endif
U_BOOT_CMD(
base, 2, 1, do_mem_base,
"print or set address offset",
"\n - print address offset for memory commands\n"
"base off\n - set address offset for memory commands to 'off'"
);
U_BOOT_CMD(
loop, 3, 1, do_mem_loop,
"infinite loop on address range",

View file

@ -1899,6 +1899,7 @@ static struct part_info* mtd_part_info(struct mtd_device *dev, unsigned int part
return NULL;
}
#ifndef CONFIG_CMD_DISABLE_CHPART
/***************************************************/
/* U-boot commands */
/***************************************************/
@ -1941,6 +1942,15 @@ static int do_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
/***************************************************/
U_BOOT_CMD(
chpart, 2, 0, do_chpart,
"change active partition",
"part-id\n"
" - change active partition (e.g. part-id = nand0,1)"
);
#endif
/**
* Routine implementing u-boot mtdparts command. Initialize/update default global
* partition list and process user partition request (list, add, del).
@ -2068,14 +2078,6 @@ static int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
/***************************************************/
U_BOOT_CMD(
chpart, 2, 0, do_chpart,
"change active partition",
"part-id\n"
" - change active partition (e.g. part-id = nand0,1)"
);
#ifdef CONFIG_SYS_LONGHELP
static char mtdparts_help_text[] =
"\n"

View file

@ -14,6 +14,7 @@
static int netboot_common(enum proto_t, cmd_tbl_t *, int, char * const []);
#ifndef CONFIG_CMD_DISABLE_BOOTP
static int do_bootp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
return netboot_common(BOOTP, cmdtp, argc, argv);
@ -24,6 +25,7 @@ U_BOOT_CMD(
"boot image via network using BOOTP/TFTP protocol",
"[loadAddress] [[hostIPaddr:]bootfilename]"
);
#endif
int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{

View file

@ -109,10 +109,12 @@ source (ulong addr, const char *fit_uname)
return 1;
}
#ifndef CONFIG_REDUCE_FOOTPRINT
if (!fit_image_check_type (fit_hdr, noffset, IH_TYPE_SCRIPT)) {
puts ("Not a image image\n");
return 1;
}
#endif
/* verify integrity */
if (verify) {

View file

@ -144,6 +144,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
return 1;
}
#ifndef CONFIG_REDUCE_FOOTPRINT
if (!fit_image_check_comp(fit_hdr, noffset, IH_COMP_NONE)
&& (argc < 4)) {
printf("Must specify load address for %s command "
@ -151,6 +152,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
cmdtp->name);
return 1;
}
#endif
/* verify integrity */
if (verify) {
@ -167,11 +169,15 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
return 1;
}
#ifdef CONFIG_REDUCE_FOOTPRINT
comp = IH_COMP_NONE;
#else
if (fit_image_get_comp(fit_hdr, noffset, &comp)) {
puts("Could not find script subimage "
"compression type\n");
return 1;
}
#endif
data = (ulong)fit_data;
len = (ulong)fit_len;

View file

@ -191,7 +191,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
*of_flat_tree = of_start;
*of_size = of_len;
set_working_fdt_addr((ulong)*of_flat_tree);
setenv_hex("fdtaddr", (ulong)*of_flat_tree);
return 0;
error:

View file

@ -207,7 +207,9 @@ void fit_print_contents(const void *fit)
printf("%s Image %u (%s)\n", p, count++,
fit_get_name(fit, noffset, NULL));
#ifndef CONFIG_REDUCE_FOOTPRINT
fit_image_print(fit, noffset, p);
#endif
}
}
@ -242,6 +244,7 @@ void fit_print_contents(const void *fit)
}
}
#ifndef CONFIG_REDUCE_FOOTPRINT
/**
* fit_image_print_data() - prints out the hash node details
* @fit: pointer to the FIT format image header
@ -451,6 +454,7 @@ void fit_image_print(const void *fit, int image_noffset, const char *p)
}
}
}
#endif
#endif /* !defined(CONFIG_SPL_BUILD) || defined(CONFIG_FIT_SPL_PRINT) */
@ -547,6 +551,7 @@ int fit_image_get_node(const void *fit, const char *image_uname)
return noffset;
}
#ifndef CONFIG_REDUCE_FOOTPRINT
/**
* fit_image_get_os - get os id for a given component image node
* @fit: pointer to the FIT format image header
@ -674,6 +679,7 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp)
*comp = genimg_get_comp_id(data);
return 0;
}
#endif
/**
* fit_image_get_load() - get load addr property for given component image node
@ -1113,6 +1119,7 @@ int fit_all_image_verify(const void *fit)
return 1;
}
#ifndef CONFIG_REDUCE_FOOTPRINT
/**
* fit_image_check_os - check whether image node is of a given os type
* @fit: pointer to the FIT format image header
@ -1202,6 +1209,7 @@ int fit_image_check_comp(const void *fit, int noffset, uint8_t comp)
return 0;
return (comp == image_comp);
}
#endif
/**
* fdt_check_no_at() - Check for nodes whose names contain '@'
@ -1563,7 +1571,9 @@ void fit_conf_print(const void *fit, int noffset, const char *p)
static int fit_image_select(const void *fit, int rd_noffset, int verify)
{
#ifndef CONFIG_REDUCE_FOOTPRINT
fit_image_print(fit, rd_noffset, " ");
#endif
if (verify) {
puts(" Verifying Hash Integrity ... ");
@ -1733,6 +1743,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
}
bootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ARCH);
#ifndef CONFIG_REDUCE_FOOTPRINT
#if !defined(USE_HOSTCC) && !defined(CONFIG_SANDBOX)
if (!fit_image_check_target_arch(fit, noffset)) {
puts("Unsupported Architecture\n");
@ -1740,15 +1751,21 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
return -ENOEXEC;
}
#endif
#if !defined(CONFIG_DTB_COMPRESSION)
if (image_type == IH_TYPE_FLATDT &&
!fit_image_check_comp(fit, noffset, IH_COMP_NONE)) {
puts("FDT image is compressed");
return -EPROTONOSUPPORT;
}
#endif
#endif
bootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL);
#ifdef CONFIG_REDUCE_FOOTPRINT
type_ok = 1;
os_ok = 1;
#else
type_ok = fit_image_check_type(fit, noffset, image_type) ||
(image_type == IH_TYPE_KERNEL &&
fit_image_check_type(fit, noffset,
@ -1757,6 +1774,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
os_ok = image_type == IH_TYPE_FLATDT ||
fit_image_check_os(fit, noffset, IH_OS_LINUX) ||
fit_image_check_os(fit, noffset, IH_OS_OPENRTOS);
#endif
/*
* If either of the checks fail, we should report an error, but

View file

@ -623,6 +623,7 @@ const char *genimg_get_comp_name(uint8_t comp)
comp));
}
#ifndef CONFIG_REDUCE_FOOTPRINT
/**
* get_table_entry_id - translate short entry name to id
* @table: pointer to a translation table for entries of a specific type
@ -674,6 +675,7 @@ int genimg_get_comp_id(const char *name)
{
return (get_table_entry_id(uimage_comp, "Compression", name));
}
#endif
#ifndef USE_HOSTCC
/**

View file

@ -433,6 +433,16 @@ extern loff_t board_env_size;
#define CONFIG_DM_I2C
#endif
/*
* TINY NOR 16M Profile
*/
#ifdef CONFIG_IPQ_TINY_SPI_NOR
#define CONFIG_CMD_DISABLE_BASE
#define CONFIG_CMD_DISABLE_BOOTP
#define CONFIG_CMD_DISABLE_CHPART
#define CONFIG_CMD_DISABLE_FDT
#endif
/*
* ELF authentication
*/

View file

@ -1119,6 +1119,7 @@ struct image_region *fit_region_make_list(const void *fit,
struct fdt_region *fdt_regions, int count,
struct image_region *region);
#ifndef CONFIG_REDUCE_FOOTPRINT
static inline int fit_image_check_target_arch(const void *fdt, int node)
{
#ifndef USE_HOSTCC
@ -1128,6 +1129,7 @@ static inline int fit_image_check_target_arch(const void *fdt, int node)
return 0;
#endif
}
#endif
#ifdef CONFIG_FIT_VERBOSE
#define fit_unsupported(msg) printf("! %s:%d " \