Merge branch '2022-08-10-assorted-updates'

- An assortment of bugfixes and minor updates
This commit is contained in:
Tom Rini 2022-08-10 17:49:20 -04:00
commit cdebee1fd9
82 changed files with 477 additions and 25 deletions

View file

@ -1313,7 +1313,7 @@ F: drivers/spmi/
F: include/spmi/
SQUASHFS
M: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
M: Joao Marcos Costa <jmcosta944@gmail.com>
R: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
R: Miquel Raynal <miquel.raynal@bootlin.com>
S: Maintained

View file

@ -676,6 +676,9 @@ endif # $(dot-config)
ifdef CONFIG_CC_OPTIMIZE_FOR_DEBUG
KBUILD_HOSTCFLAGS := -Wall -Wstrict-prototypes -Og -g -fomit-frame-pointer \
$(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
# Avoid false positives -Wmaybe-uninitialized
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78394
KBUILD_HOSTCFLAGS += -Wno-maybe-uninitialized
KBUILD_HOSTCXXFLAGS := -Og -g $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
endif
@ -696,7 +699,10 @@ KBUILD_CFLAGS += -O2
endif
ifdef CONFIG_CC_OPTIMIZE_FOR_DEBUG
KBUILD_CFLAGS += -Og
KBUILD_CFLAGS += -Og -Wno-maybe-uninitialized
# Avoid false positives -Wmaybe-uninitialized
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78394
KBUILD_CFLAGS += -Wno-maybe-uninitialized
endif
LTO_CFLAGS :=

View file

@ -4,6 +4,7 @@
* Minkyu Kang <mk7.kang@samsung.com>
*/
#include <common.h>
#include <display_options.h>
#include <fdtdec.h>
#include <init.h>
#include <asm/global_data.h>

View file

@ -43,6 +43,7 @@
* do a read-modify-write for partially programmed pages
*/
#include <common.h>
#include <display_options.h>
#include <flash.h>
#include <log.h>
#include <asm/io.h>

View file

@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
#include <config.h>
#include <display_options.h>
#include <fuse.h>
#include <mapmem.h>
#include <image.h>

View file

@ -12,6 +12,7 @@
#include <common.h>
#include <cpu_func.h>
#include <clock_legacy.h>
#include <display_options.h>
#include <init.h>
#include <irq_func.h>
#include <log.h>

View file

@ -10,6 +10,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <env.h>
#include <init.h>
#include <net.h>

View file

@ -7,6 +7,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <init.h>
#include <asm/bitops.h>
#include <asm/global_data.h>

View file

@ -18,6 +18,7 @@
#include <common.h>
#include <cpu_func.h>
#include <display_options.h>
#include <net.h>
#include <time.h>
#include <vsprintf.h>

View file

@ -7,6 +7,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <asm/bitops.h>
#include <asm/global_data.h>
#include <linux/compiler.h>

View file

@ -7,6 +7,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <errno.h>
#include <init.h>
#include <log.h>

View file

@ -4,6 +4,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <init.h>
#include <malloc.h>
#include <errno.h>

View file

@ -4,6 +4,7 @@
*/
#include <common.h>
#include <clock_legacy.h>
#include <display_options.h>
#include <env.h>
#include <i2c.h>
#include <init.h>

View file

@ -5,6 +5,7 @@
*/
#include <common.h>
#include <clock_legacy.h>
#include <display_options.h>
#include <env.h>
#include <init.h>
#include <malloc.h>

View file

@ -5,6 +5,7 @@
*/
#include <common.h>
#include <clock_legacy.h>
#include <display_options.h>
#include <env.h>
#include <init.h>
#include <malloc.h>

View file

@ -5,6 +5,7 @@
#include <common.h>
#include <clock_legacy.h>
#include <display_options.h>
#include <dm.h>
#include <init.h>
#include <asm/global_data.h>

View file

@ -6,6 +6,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <init.h>
#include <net.h>
#include <pci.h>

View file

@ -6,6 +6,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <dm.h>
#include <eeprom.h>
#include <init.h>

View file

@ -5,6 +5,7 @@
* Copyright 2019-2021 Traverse Technologies
*/
#include <common.h>
#include <display_options.h>
#include <dm/uclass.h>
#include <env.h>
#include <i2c.h>

View file

@ -11,6 +11,7 @@
#include <common.h>
#include <bootstage.h>
#include <cpu_func.h>
#include <display_options.h>
#include <env.h>
#include <fpga.h>
#include <image.h>

View file

@ -9,6 +9,7 @@
#ifndef USE_HOSTCC
#include <common.h>
#include <env.h>
#include <display_options.h>
#include <init.h>
#include <lmb.h>
#include <log.h>

View file

@ -5,6 +5,7 @@
*/
#include <common.h>
#include <command.h>
#include <display_options.h>
#include <mapmem.h>
#include <acpi/acpi_table.h>
#include <asm/acpi_table.h>

View file

@ -13,6 +13,7 @@
#include <axi.h>
#include <command.h>
#include <console.h>
#include <display_options.h>
#include <dm.h>
#include <log.h>

View file

@ -9,6 +9,7 @@
#include <bcb.h>
#include <command.h>
#include <common.h>
#include <display_options.h>
#include <log.h>
#include <part.h>
#include <malloc.h>

View file

@ -8,6 +8,7 @@
#include <common.h>
#include <command.h>
#include <cpu.h>
#include <display_options.h>
#include <dm.h>
#include <errno.h>

View file

@ -11,6 +11,7 @@
#include <common.h>
#include <command.h>
#include <console.h>
#include <display_options.h>
#include <gdsys_fpga.h>

View file

@ -9,6 +9,7 @@
#include <common.h>
#include <command.h>
#include <display_options.h>
#include <asm/io.h>
/* Display values from last command */

View file

@ -16,6 +16,7 @@
#include <cli.h>
#include <command.h>
#include <console.h>
#include <display_options.h>
#ifdef CONFIG_MTD_NOR_FLASH
#include <flash.h>
#endif

View file

@ -8,6 +8,7 @@
#include <blk.h>
#include <command.h>
#include <console.h>
#include <display_options.h>
#include <memalign.h>
#include <mmc.h>
#include <part.h>

View file

@ -2,6 +2,7 @@
#include <common.h>
#include <command.h>
#include <display_options.h>
#include <dm.h>
#include <hexdump.h>
#include <i2c.h>

View file

@ -7,6 +7,7 @@
#include <common.h>
#include <command.h>
#include <display_options.h>
#include <div64.h>
#include <dm.h>
#include <log.h>

View file

@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
#include <display_options.h>
#include <timestamp.h>
#include <version.h>
#include <version_string.h>

View file

@ -9,6 +9,7 @@
#include <common.h>
#include <bloblist.h>
#include <display_options.h>
#include <log.h>
#include <malloc.h>
#include <mapmem.h>

View file

@ -16,6 +16,7 @@
#include <console.h>
#include <cpu.h>
#include <cpu_func.h>
#include <display_options.h>
#include <dm.h>
#include <env.h>
#include <env_internal.h>

View file

@ -13,6 +13,7 @@
#include <api.h>
#include <bootstage.h>
#include <cpu_func.h>
#include <display_options.h>
#include <exports.h>
#ifdef CONFIG_MTD_NOR_FLASH
#include <flash.h>

View file

@ -7,6 +7,7 @@
#include <common.h>
#include <console.h>
#include <debug_uart.h>
#include <display_options.h>
#include <dm.h>
#include <env.h>
#include <stdarg.h>

View file

@ -7,6 +7,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <log.h>
#include <malloc.h>
#include <asm/global_data.h>

View file

@ -21,6 +21,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <env.h>
#include <splash.h>
#include <lcd.h>

View file

@ -9,6 +9,7 @@
#define LOG_CATEOGRY LOGC_ACPI
#include <common.h>
#include <display_options.h>
#include <dm.h>
#include <log.h>
#include <malloc.h>

View file

@ -9,6 +9,7 @@
#include <common.h>
#include <cpu.h>
#include <display_options.h>
#include <dm.h>
#include <errno.h>
#include <init.h>

View file

@ -11,6 +11,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <dm.h>
#include <i2c.h>
#include <fsl_ddr_sdram.h>

View file

@ -10,6 +10,7 @@
#include <common.h>
#include <clk.h>
#include <display_options.h>
#include <dm.h>
#include <log.h>
#include <mmc.h>

View file

@ -831,6 +831,9 @@ static int __mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value,
return 0;
}
if (!send_status)
return 0;
/* Finally wait until the card is ready or indicates a failure
* to switch. It doesn't hurt to use CMD13 here even if send_status
* is false, because by now (after 'timeout_ms' ms) the bus should be

View file

@ -14,6 +14,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <linux/compat.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/onenand.h>

View file

@ -7,6 +7,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <dm.h>
#include <errno.h>
#include <fdtdec.h>

View file

@ -10,6 +10,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <log.h>
#include <watchdog.h>
#include <dm.h>

View file

@ -9,6 +9,7 @@
#include <config.h>
#include <common.h>
#include <cpu_func.h>
#include <display_options.h>
#include <dm.h>
#include <log.h>
#include <net.h>

View file

@ -8,7 +8,6 @@
#include <errno.h>
#include <dm.h>
#include <fdtdec.h>
#include <i2c.h>
#include <log.h>
#include <asm/gpio.h>
#include <linux/bitops.h>

View file

@ -8,7 +8,6 @@
#include <fdtdec.h>
#include <errno.h>
#include <dm.h>
#include <i2c.h>
#include <log.h>
#include <asm/gpio.h>
#include <power/pmic.h>

View file

@ -10,7 +10,6 @@
#include <fdtdec.h>
#include <errno.h>
#include <dm.h>
#include <i2c.h>
#include <power/pmic.h>
#include <power/regulator.h>
#include <power/lp873x.h>

View file

@ -10,7 +10,6 @@
#include <fdtdec.h>
#include <errno.h>
#include <dm.h>
#include <i2c.h>
#include <log.h>
#include <power/pmic.h>
#include <power/regulator.h>

View file

@ -10,7 +10,6 @@
#include <fdtdec.h>
#include <errno.h>
#include <dm.h>
#include <i2c.h>
#include <power/pmic.h>
#include <power/regulator.h>
#include <power/max77686_pmic.h>

View file

@ -10,7 +10,6 @@
#include <fdtdec.h>
#include <errno.h>
#include <dm.h>
#include <i2c.h>
#include <power/pmic.h>
#include <power/regulator.h>
#include <power/palmas.h>

View file

@ -9,7 +9,6 @@
#include <fdtdec.h>
#include <errno.h>
#include <dm.h>
#include <i2c.h>
#include <log.h>
#include <power/pmic.h>
#include <power/regulator.h>

View file

@ -8,7 +8,6 @@
#include <fdtdec.h>
#include <errno.h>
#include <dm.h>
#include <i2c.h>
#include <linux/delay.h>
#include <power/pmic.h>
#include <power/regulator.h>

View file

@ -7,7 +7,6 @@
#include <fdtdec.h>
#include <errno.h>
#include <dm.h>
#include <i2c.h>
#include <power/pmic.h>
#include <power/regulator.h>
#include <power/s5m8767.h>

View file

@ -8,7 +8,6 @@
#include <fdtdec.h>
#include <errno.h>
#include <dm.h>
#include <i2c.h>
#include <power/pmic.h>
#include <power/regulator.h>
#include <power/sandbox_pmic.h>

View file

@ -9,7 +9,6 @@
#include <fdtdec.h>
#include <errno.h>
#include <dm.h>
#include <i2c.h>
#include <log.h>
#include <linux/delay.h>
#include <power/pmic.h>

View file

@ -10,7 +10,6 @@
#include <fdtdec.h>
#include <errno.h>
#include <dm.h>
#include <i2c.h>
#include <log.h>
#include <linux/delay.h>
#include <power/pmic.h>

View file

@ -6,6 +6,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <dm.h>
#include <tpm-v1.h>
#include <i2c.h>

View file

@ -4,6 +4,7 @@
*/
#include <common.h>
#include <display_options.h>
#include <dm.h>
#include <tpm-v1.h>
#include <asm/state.h>

View file

@ -7,6 +7,7 @@
#include <command.h>
#include <config.h>
#include <display_options.h>
#include <errno.h>
#include <common.h>
#include <env.h>

View file

@ -229,10 +229,10 @@ enum command_ret_t {
* is left unchanged.
* @param ticks If ticks is not null, this function set it to the
* number of ticks the command took to complete.
* Return: 0 if the command succeeded, 1 if it failed
* Return: 0 if command succeeded, else non-zero (CMD_RET_...)
*/
int cmd_process(int flag, int argc, char *const argv[], int *repeatable,
unsigned long *ticks);
enum command_ret_t cmd_process(int flag, int argc, char *const argv[],
int *repeatable, unsigned long *ticks);
void fixup_cmdtable(struct cmd_tbl *cmdtp, int size);

View file

@ -23,7 +23,6 @@
#include <stdio.h>
#include <linux/kernel.h>
#include <asm/u-boot.h> /* boot information for Linux kernel */
#include <display_options.h>
#include <vsprintf.h>
#endif /* __ASSEMBLY__ */

View file

@ -19,6 +19,7 @@
* @size: Size to print
* @suffix String to print after the size
*/
#include <display_options.h>
void print_size(uint64_t size, const char *suffix);
/**

View file

@ -68,7 +68,7 @@ struct lmb_region {
struct lmb {
struct lmb_region memory;
struct lmb_region reserved;
#if IS_ENABLED(CONFIG_LMB_MEMORY_REGIONS)
#ifdef CONFIG_LMB_MEMORY_REGIONS
struct lmb_property memory_regions[CONFIG_LMB_MEMORY_REGIONS];
struct lmb_property reserved_regions[CONFIG_LMB_RESERVED_REGIONS];
#endif

View file

@ -23,6 +23,7 @@
#ifndef USE_HOSTCC
#include <common.h>
#include <display_options.h>
#include <log.h>
#else
#include <string.h>

View file

@ -7,6 +7,7 @@
#include <common.h>
#include <compiler.h>
#include <console.h>
#include <display_options.h>
#include <div64.h>
#include <version_string.h>
#include <linux/ctype.h>

View file

@ -6,6 +6,7 @@
#ifndef USE_HOSTCC
#include <common.h>
#include <boot_fit.h>
#include <display_options.h>
#include <dm.h>
#include <hang.h>
#include <init.h>

View file

@ -108,7 +108,7 @@ void lmb_init(struct lmb *lmb)
#if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
lmb->memory.max = CONFIG_LMB_MAX_REGIONS;
lmb->reserved.max = CONFIG_LMB_MAX_REGIONS;
#elif IS_ENABLED(CONFIG_LMB_MEMORY_REGIONS)
#elif defined(CONFIG_LMB_MEMORY_REGIONS)
lmb->memory.max = CONFIG_LMB_MEMORY_REGIONS;
lmb->reserved.max = CONFIG_LMB_RESERVED_REGIONS;
lmb->memory.region = lmb->memory_regions;

View file

@ -80,7 +80,7 @@ int ulz4fn(const void *src, size_t srcn, void *dst, size_t *dstn)
}
if (block_header & LZ4F_BLOCKUNCOMPRESSED_FLAG) {
size_t size = min((ptrdiff_t)block_size, end - out);
size_t size = min((ptrdiff_t)block_size, (ptrdiff_t)(end - out));
memcpy(out, in, size);
out += size;
if (size < block_size) {

View file

@ -28,6 +28,7 @@
#include <common.h>
#include <command.h>
#include <display_options.h>
#ifdef CONFIG_SYS_DIRECT_FLASH_NFS
#include <flash.h>
#endif

View file

@ -7,6 +7,7 @@
*/
#include <common.h>
#include <command.h>
#include <display_options.h>
#include <efi_loader.h>
#include <env.h>
#include <image.h>

View file

@ -358,13 +358,14 @@ $(obj)/dts/dt-%.o: $(obj)/dts/dt-%.c $(platdata-hdr)
$(call if_changed,plat)
# Don't use dts_dir here, since it forces running this expensive rule every time
$(platdata-hdr) $(u-boot-spl-platdata_c) &: $(obj)/$(SPL_BIN).dtb
$(platdata-hdr) $(u-boot-spl-platdata_c) &: $(obj)/$(SPL_BIN).dtb FORCE
@[ -d $(obj)/dts ] || mkdir -p $(obj)/dts
@# Remove old files since which ones we generate depends on the setting
@# of OF_PLATDATA_INST and this might change between builds. Leaving old
@# ones around is confusing and it is possible that switching the
@# setting again will use the old one instead of regenerating it.
@rm -f $(u-boot-spl-all-platdata_c) $(u-boot-spl-all-platdata)
@rm -f $(u-boot-spl-old-platdata_c) $(u-boot-spl-platdata_c) \
$(u-boot-spl-old-platdata)
$(call if_changed,dtoc)
ifneq ($(CONFIG_ARCH_EXYNOS)$(CONFIG_ARCH_S5PC1XX),)

230
scripts/config Executable file
View file

@ -0,0 +1,230 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0
# Manipulate options in a .config file from the command line
myname=${0##*/}
# If no prefix forced, use the default CONFIG_
CONFIG_="${CONFIG_-CONFIG_}"
# We use an uncommon delimiter for sed substitutions
SED_DELIM=$(echo -en "\001")
usage() {
cat >&2 <<EOL
Manipulate options in a .config file from the command line.
Usage:
$myname options command ...
commands:
--enable|-e option Enable option
--disable|-d option Disable option
--module|-m option Turn option into a module
--set-str option string
Set option to "string"
--set-val option value
Set option to value
--undefine|-u option Undefine option
--state|-s option Print state of option (n,y,m,undef)
--enable-after|-E beforeopt option
Enable option directly after other option
--disable-after|-D beforeopt option
Disable option directly after other option
--module-after|-M beforeopt option
Turn option into module directly after other option
commands can be repeated multiple times
options:
--file config-file .config file to change (default .config)
--keep-case|-k Keep next symbols' case (dont' upper-case it)
$myname doesn't check the validity of the .config file. This is done at next
make time.
By default, $myname will upper-case the given symbol. Use --keep-case to keep
the case of all following symbols unchanged.
$myname uses 'CONFIG_' as the default symbol prefix. Set the environment
variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" $myname ...
EOL
exit 1
}
checkarg() {
ARG="$1"
if [ "$ARG" = "" ] ; then
usage
fi
case "$ARG" in
${CONFIG_}*)
ARG="${ARG/${CONFIG_}/}"
;;
esac
if [ "$MUNGE_CASE" = "yes" ] ; then
ARG="`echo $ARG | tr a-z A-Z`"
fi
}
txt_append() {
local anchor="$1"
local insert="$2"
local infile="$3"
local tmpfile="$infile.swp"
# sed append cmd: 'a\' + newline + text + newline
cmd="$(printf "a\\%b$insert" "\n")"
sed -e "/$anchor/$cmd" "$infile" >"$tmpfile"
# replace original file with the edited one
mv "$tmpfile" "$infile"
}
txt_subst() {
local before="$1"
local after="$2"
local infile="$3"
local tmpfile="$infile.swp"
sed -e "s$SED_DELIM$before$SED_DELIM$after$SED_DELIM" "$infile" >"$tmpfile"
# replace original file with the edited one
mv "$tmpfile" "$infile"
}
txt_delete() {
local text="$1"
local infile="$2"
local tmpfile="$infile.swp"
sed -e "/$text/d" "$infile" >"$tmpfile"
# replace original file with the edited one
mv "$tmpfile" "$infile"
}
set_var() {
local name=$1 new=$2 before=$3
name_re="^($name=|# $name is not set)"
before_re="^($before=|# $before is not set)"
if test -n "$before" && grep -Eq "$before_re" "$FN"; then
txt_append "^$before=" "$new" "$FN"
txt_append "^# $before is not set" "$new" "$FN"
elif grep -Eq "$name_re" "$FN"; then
txt_subst "^$name=.*" "$new" "$FN"
txt_subst "^# $name is not set" "$new" "$FN"
else
echo "$new" >>"$FN"
fi
}
undef_var() {
local name=$1
txt_delete "^$name=" "$FN"
txt_delete "^# $name is not set" "$FN"
}
if [ "$1" = "--file" ]; then
FN="$2"
if [ "$FN" = "" ] ; then
usage
fi
shift 2
else
FN=.config
fi
if [ "$1" = "" ] ; then
usage
fi
MUNGE_CASE=yes
while [ "$1" != "" ] ; do
CMD="$1"
shift
case "$CMD" in
--keep-case|-k)
MUNGE_CASE=no
continue
;;
--refresh)
;;
--*-after|-E|-D|-M)
checkarg "$1"
A=$ARG
checkarg "$2"
B=$ARG
shift 2
;;
-*)
checkarg "$1"
shift
;;
esac
case "$CMD" in
--enable|-e)
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
;;
--disable|-d)
set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
;;
--module|-m)
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
;;
--set-str)
# sed swallows one level of escaping, so we need double-escaping
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\""
shift
;;
--set-val)
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
shift
;;
--undefine|-u)
undef_var "${CONFIG_}$ARG"
;;
--state|-s)
if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
echo n
else
V="$(grep "^${CONFIG_}$ARG=" $FN)"
if [ $? != 0 ] ; then
echo undef
else
V="${V/#${CONFIG_}$ARG=/}"
V="${V/#\"/}"
V="${V/%\"/}"
V="${V//\\\"/\"}"
echo "${V}"
fi
fi
;;
--enable-after|-E)
set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A"
;;
--disable-after|-D)
set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
;;
--module-after|-M)
set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
;;
# undocumented because it ignores --file (fixme)
--refresh)
yes "" | make oldconfig
;;
*)
echo "bad command: $CMD" >&2
usage
;;
esac
done

View file

@ -20,7 +20,7 @@ config SPL_UNIT_TEST
config UT_LIB
bool "Unit tests for library functions"
depends on UNIT_TEST
default y
default y if !SANDBOX_VPL
help
Enables the 'ut lib' command which tests library functions like
memcat(), memcyp(), memmove() and ASN1 compiler/decoder.
@ -99,5 +99,6 @@ config UT_UNICODE
source "test/dm/Kconfig"
source "test/env/Kconfig"
source "test/lib/Kconfig"
source "test/optee/Kconfig"
source "test/overlay/Kconfig"

View file

@ -17,6 +17,9 @@ obj-$(CONFIG_$(SPL_)CMDLINE) += command_ut.o
obj-$(CONFIG_$(SPL_)UT_COMPRESSION) += compression.o
obj-y += dm/
obj-$(CONFIG_FUZZ) += fuzz/
ifndef CONFIG_SANDBOX_VPL
obj-$(CONFIG_UNIT_TEST) += lib/
endif
obj-$(CONFIG_$(SPL_)CMDLINE) += print_ut.o
obj-$(CONFIG_$(SPL_)CMDLINE) += str_ut.o
obj-$(CONFIG_UT_TIME) += time_ut.o
@ -25,7 +28,6 @@ obj-y += ut.o
ifeq ($(CONFIG_SPL_BUILD),)
obj-$(CONFIG_UNIT_TEST) += boot/
obj-$(CONFIG_UNIT_TEST) += common/
obj-$(CONFIG_UNIT_TEST) += lib/
obj-y += log/
obj-$(CONFIG_$(SPL_)UT_UNICODE) += unicode_ut.o
endif

23
test/lib/Kconfig Normal file
View file

@ -0,0 +1,23 @@
# SPDX-License-Identifier: GPL-2.0+
# Copyright 2022 Google LLC
if SANDBOX
config TEST_KCONFIG
bool "Enable detection of Kconfig macro errors"
help
This is used to test that the IF_ENABLED_INT() macro causes a build error
if the value is used when the CONFIG Is not enabled.
config TEST_KCONFIG_ENABLE
bool "Option to enable"
help
This is the option that controls whether the value is present.
config TEST_KCONFIG_VALUE
int "Value associated with the option"
depends on TEST_KCONFIG_ENABLE
help
This is the value whgch is present if TEST_KCONFIG_ENABLE is enabled.
endif # SANDBOX

View file

@ -2,11 +2,13 @@
#
# (C) Copyright 2018
# Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
ifeq ($(CONFIG_SPL_BUILD),)
obj-y += cmd_ut_lib.o
obj-y += abuf.o
obj-$(CONFIG_EFI_LOADER) += efi_device_path.o
obj-$(CONFIG_EFI_SECURE_BOOT) += efi_image_region.o
obj-y += hexdump.o
obj-$(CONFIG_SANDBOX) += kconfig.o
obj-y += lmb.o
obj-y += longjmp.o
obj-$(CONFIG_CONSOLE_RECORD) += test_print.o
@ -19,3 +21,6 @@ obj-$(CONFIG_UT_LIB_RSA) += rsa.o
obj-$(CONFIG_AES) += test_aes.o
obj-$(CONFIG_GETOPT) += getopt.o
obj-$(CONFIG_UT_LIB_CRYPT) += test_crypt.o
else
obj-$(CONFIG_SANDBOX) += kconfig_spl.o
endif

58
test/lib/kconfig.c Normal file
View file

@ -0,0 +1,58 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Test of linux/kconfig.h macros
*
* Copyright 2022 Google LLC
* Written by Simon Glass <sjg@chromium.org>
*/
#include <common.h>
#include <test/lib.h>
#include <test/test.h>
#include <test/ut.h>
static int lib_test_is_enabled(struct unit_test_state *uts)
{
ulong val;
ut_asserteq(1, IS_ENABLED(CONFIG_CMDLINE))
ut_asserteq(0, IS_ENABLED(CONFIG__UNDEFINED))
ut_asserteq(1, CONFIG_IS_ENABLED(CMDLINE))
ut_asserteq(0, CONFIG_IS_ENABLED(OF_PLATDATA))
ut_asserteq(0, CONFIG_IS_ENABLED(_UNDEFINED))
ut_asserteq(0xc000,
IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED, CONFIG_BLOBLIST_ADDR));
ut_asserteq(0xc000,
CONFIG_IF_ENABLED_INT(BLOBLIST_FIXED, BLOBLIST_ADDR));
/*
* This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the
* value is used. Disable for SPL so that the errors in kconfig_spl.c
* are detected, since otherwise a build error when building U-Boot may
* cause SPL to not be built.
*/
if (!IS_ENABLED(CONFIG_SANDBOX_SPL) &&
IS_ENABLED(CONFIG_TEST_KCONFIG)) {
val = IF_ENABLED_INT(CONFIG_TEST_KCONFIG_ENABLE,
CONFIG_TEST_KCONFIG_VALUE);
printf("value %ld\n", val);
}
/*
* This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the
* value is used. Disable for SPL so that the errors in kconfig_spl.c
* are detected, since otherwise a build error when building U-Boot may
* cause SPL to not be built.
*/
if (!IS_ENABLED(CONFIG_SANDBOX_SPL) &&
CONFIG_IS_ENABLED(TEST_KCONFIG)) {
val = CONFIG_IF_ENABLED_INT(TEST_KCONFIG_ENABLE,
TEST_KCONFIG_VALUE);
printf("value2 %ld\n", val);
}
return 0;
}
LIB_TEST(lib_test_is_enabled, 0);

44
test/lib/kconfig_spl.c Normal file
View file

@ -0,0 +1,44 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Test of linux/kconfig.h macros for SPL
*
* Copyright 2022 Google LLC
* Written by Simon Glass <sjg@chromium.org>
*/
#include <common.h>
#include <test/lib.h>
#include <test/test.h>
#include <test/ut.h>
static int lib_test_spl_is_enabled(struct unit_test_state *uts)
{
ulong val;
ut_asserteq(0, CONFIG_IS_ENABLED(CMDLINE))
ut_asserteq(1, CONFIG_IS_ENABLED(OF_PLATDATA))
ut_asserteq(0, CONFIG_IS_ENABLED(_UNDEFINED))
/*
* This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the
* value is used.
*/
if (IS_ENABLED(CONFIG_TEST_KCONFIG)) {
val = IF_ENABLED_INT(CONFIG_TEST_KCONFIG_ENABLE,
CONFIG_TEST_KCONFIG_VALUE);
printf("value %ld\n", val);
}
/*
* This fails if CONFIG_TEST_KCONFIG_ENABLE is not enabled, since the
* value is used.
*/
if (CONFIG_IS_ENABLED(TEST_KCONFIG)) {
val = CONFIG_IF_ENABLED_INT(TEST_KCONFIG_ENABLE,
TEST_KCONFIG_VALUE);
printf("value2 %ld\n", val);
}
return 0;
}
LIB_TEST(lib_test_spl_is_enabled, 0);

View file

@ -0,0 +1,39 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright 2022 Google LLC
# Written by Simon Glass <sjg@chromium.org>
import pytest
import u_boot_utils as util
# This is needed for Azure, since the default '..' directory is not writeable
TMPDIR = '/tmp/test_kconfig'
@pytest.mark.slow
@pytest.mark.boardspec('sandbox')
def test_kconfig(u_boot_console):
"""Test build failures when IF_ENABLED_INT() option is not enabled"""
cons = u_boot_console
# This detects build errors in test/lib/kconfig.c
out = util.run_and_log(
cons, ['./tools/buildman/buildman', '-m', '--board', 'sandbox',
'-a', 'TEST_KCONFIG', '-o', TMPDIR], ignore_errors=True)
assert 'invalid_use_of_IF_ENABLED_INT' in out
assert 'invalid_use_of_CONFIG_IF_ENABLED_INT' in out
@pytest.mark.slow
@pytest.mark.boardspec('sandbox_spl')
def test_kconfig_spl(u_boot_console):
"""Test build failures when IF_ENABLED_INT() option is not enabled"""
cons = u_boot_console
# This detects build errors in test/lib/kconfig_spl.c
out = util.run_and_log(
cons, ['./tools/buildman/buildman', '-m', '--board', 'sandbox_spl',
'-a', 'TEST_KCONFIG', '-o', TMPDIR], ignore_errors=True)
assert 'invalid_use_of_IF_ENABLED_INT' in out
# There is no CONFIG_SPL_TEST_KCONFIG, so the CONFIG_IF_ENABLED_INT()
# line should not generate an error
assert 'invalid_use_of_CONFIG_IF_ENABLED_INT' not in out