Uobjcoll-arm-trusted-firmware build error

Just tested make uobjcoll and it works!

make everything and make native fail because of uboot build failure. I am thinking if there is perhaps some pre-requisite we are msising for the uboot build?

Maybe we need to apt-get install autoconf in the Dockerfile? I can’t test if it will fix the problem since build native is working for me even from a clean container build, but some initial searching on stack overflow indicates that autoconf is a prereq.

Hmm…adding that to plat/st/stm32mp1_uobjcoll/Dockerfile did not seem to work…

RUN apt-get update -y && \
    apt-get -yqq install make autoconf build-essential \
    git libssl-dev bc \
    device-tree-compiler flex bison \
    gcc-10-arm-linux-gnueabihf \
    gcc-10-multilib-arm-linux-gnueabihf \
	binutils-arm-linux-gnueabihf && \
    apt-get clean && rm -rf /var/lib/apt/lists/* && \
    apt-get upgrade gcc

Am I missing something above?

Nope, everything looks good there.

I looked into the u-boot/scripts/kconfig/conf.c file, and it might actually be a permissions issue. That error message happens when the conf_write_autoconf() function in confdata.c returns 1, which only happens when a couple of fopens return a null pointer:

int conf_write_autoconf(void)
{
	struct symbol *sym;
	const char *name;
	FILE *out, *tristate, *out_h;
	int i;

	sym_clear_all_valid();

	file_write_dep("include/config/auto.conf.cmd");

	if (conf_split_config())
		return 1;

	out = fopen(".tmpconfig", "w");
	if (!out)
		return 1;

	tristate = fopen(".tmpconfig_tristate", "w");
	if (!tristate) {
		fclose(out);
		return 1;
	}

	out_h = fopen(".tmpconfig.h", "w");
	if (!out_h) {
		fclose(out);
		fclose(tristate);
		return 1;
	}

	conf_write_heading(out, &kconfig_printer_cb, NULL);

	conf_write_heading(tristate, &tristate_printer_cb, NULL);

	conf_write_heading(out_h, &header_printer_cb, NULL);

	for_all_symbols(i, sym) {
		sym_calc_value(sym);
		if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
			continue;

		/* write symbol to auto.conf, tristate and header files */
		conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);

		conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1);

		conf_write_symbol(out_h, sym, &header_printer_cb, NULL);
	}
	fclose(out);
	fclose(tristate);
	fclose(out_h);

	name = getenv("KCONFIG_AUTOHEADER");
	if (!name)
		name = "include/generated/autoconf.h";
	if (rename(".tmpconfig.h", name))
		return 1;
	name = getenv("KCONFIG_TRISTATE");
	if (!name)
		name = "include/config/tristate.conf";
	if (rename(".tmpconfig_tristate", name))
		return 1;
	name = conf_get_autoconfig_name();
	/*
	 * This must be the last step, kbuild has a dependency on auto.conf
	 * and this marks the successful completion of the previous steps.
	 */
	if (rename(".tmpconfig", name))
		return 1;

	return 0;
}

It might also be the case that the .tmp... files arent being generated. I could fork the repo and add a bunch of print statements to conf_write_autoconf so we know which one is failing if that helps narrow what’s causing the issue.

Ok I have invited you to my fork of uobjcoll-arm-trusted-firmware. My working branch is feature-actionpipeline:

Feel free to make any changes as you see fit there (if you need to). Also probably forking the uboot repo and adding your debug statements sound ike a good idea…should definitely help us identify what is happening on my side…

Thanks @yeeb!

feature-actionpipeline is no longer valid per this merge:

Let us work on this thread and see if we need to add any tasks to fix this issue.

Thanks!

@yeeb: what development environment/version are you running? WSL or native Ubuntu?

Ok I added some debugging harness to conf.c and confdata.c and here is what I came up with:

uberspark@a1b8f69ac4a7:~/uobjcoll-arm-trusted-firmware/plat/st/stm32mp1_uobjcoll/_build/u-boot$ make DEVICE_TREE=stm32mp157c-ev1 all
scripts/kconfig/conf  --syncconfig Kconfig

conf_write_autoconf:976

conf_split_config:852

conf_split_config:857

conf_split_config:920:path=mtd/spi/nand.h

conf_split_config:920:path=cmd/poweroff.h

conf_split_config:920:path=arm/smc/mailbox.h

conf_split_config:920:path=display/boardinfo.h

conf_split_config:920:path=cmd/bootm.h

conf_split_config:920:path=cmd/ext4.h

conf_split_config:920:path=sys/arm/mmu.h

conf_split_config:920:path=sf/default/mode.h

conf_split_config:920:path=stm32/reset.h

conf_split_config:920:path=sys/thumb/build.h

conf_split_config:920:path=bootstage/record/count.h

conf_split_config:920:path=video/bpp8.h

conf_split_config:920:path=cmd/bootcount.h

conf_split_config:920:path=led/gpio.h

conf_split_config:920:path=image/sparse/fillbuf/size.h

conf_split_config:920:path=cmd/fastboot.h

conf_split_config:920:path=loglevel.h

conf_split_config:920:path=cmd/usb.h

conf_split_config:920:path=optee/load/addr.h

conf_split_config:920:path=sys/malloc/len.h

conf_split_config:920:path=of/board/setup.h

conf_split_config:920:path=zlib.h

conf_split_config:920:path=remoteproc/optee.h

conf_split_config:920:path=stm32/serial.h

conf_split_config:920:path=scmi/agent.h

conf_split_config:920:path=dm/mtd.h

conf_split_config:920:path=mtdids/default.h

conf_split_config:920:path=of/libfdt.h

conf_split_config:920:path=cmd/editenv.h

conf_split_config:920:path=cmd/memtest.h

conf_split_config:920:path=dm/hwspinlock.h

conf_split_config:920:path=env/ubi/volume/redund.h

conf_split_config:920:path=preboot.h

conf_split_config:920:path=fastboot/flash.h

conf_split_config:920:path=version/variable.h

conf_split_config:920:path=video/mipi/dsi.h

conf_split_config:920:path=bootp/pxe/clientarch.h

conf_split_config:920:path=use/arch/memcpy.h

conf_split_config:920:path=blk.h

conf_split_config:920:path=usb.h

conf_split_config:920:path=tpl/loglevel.h

conf_split_config:920:path=arm/asm/unified.h

conf_split_config:920:path=of/libfdt/overlay.h

conf_split_config:920:path=dm/regulator/stpmic1.h

conf_split_config:920:path=efi/get/time.h

conf_split_config:920:path=reset/scmi.h

conf_split_config:920:path=cmd/nvedit/info.h

conf_split_config:920:path=of/separate.h

conf_split_config:920:path=console/mux.h

conf_split_config:920:path=generate/smbios/table.h

conf_split_config:920:path=mtd/partitions.h

conf_split_config:920:path=sys/arm/cache/writeback.h

conf_split_config:920:path=stm32/etzpc.h

conf_split_config:920:path=fastboot/mmc/boot/support.h

conf_split_config:920:path=gzip.h

conf_split_config:920:path=nr/dram/banks.h

conf_split_config:920:path=stm32/rcc.h

conf_split_config:920:path=sha1.h

conf_split_config:920:path=fastboot/gpt/name.h

conf_split_config:920:path=dm/regulator.h

conf_split_config:920:path=mtd.h

conf_split_config:920:path=remoteproc.h

conf_split_config:920:path=fdt/fixup/partitions.h

conf_split_config:920:path=env/offset/redund.h

conf_split_config:920:path=mtd/ubi/wl/threshold.h

conf_split_config:920:path=errno/str.h

conf_split_config:920:path=hash.h

conf_split_config:920:path=cmd/console.h

conf_split_config:920:path=efi/unicode/capitalization.h

conf_split_config:920:path=dm/mailbox.h

conf_split_config:920:path=default/fdt/file.h

conf_split_config:920:path=env/ubi/vid/offset.h

conf_split_config:920:path=of/translate.h

conf_split_config:920:path=bootstage/stash/addr.h

conf_split_config:920:path=smbios/manufacturer.h

conf_split_config:920:path=use/preboot.h

conf_split_config:920:path=video/stm32/max/xres.h

conf_split_config:920:path=have/private/libgcc.h

conf_split_config:920:path=bootm/plan9.h

conf_split_config:920:path=mtdparts/spinand0/boot.h

conf_split_config:920:path=cmd/bdi.h

conf_split_config:920:path=arm.h

conf_split_config:920:path=create/arch/symlink.h

conf_split_config:920:path=dm/seq/alias.h

conf_split_config:920:path=sys/vendor.h

conf_split_config:920:path=pre/console/buffer.h

conf_split_config:920:path=usb/storage.h

conf_split_config:920:path=arch/misc/init.h

conf_split_config:920:path=wdt/stm32mp.h

conf_split_config:920:path=cmd/date.h

conf_split_config:920:path=cmd/bootefi/hello/compile.h

conf_split_config:920:path=efi/loader.h

conf_split_config:920:path=spi.h

conf_split_config:920:path=cmd/ping.h

conf_split_config:920:path=usb/gadget/vendor/num.h

conf_split_config:920:path=dtc.h

conf_split_config:920:path=video/stm32/max/yres.h

conf_split_config:920:path=fit/external/offset.h

conf_split_config:920:path=pre/con/buf/sz.h

conf_split_config:938:path=pre/con

conf_split_config:955

conf_split_config:960:res=1

*** Error during update of the configuration.

As you can see the script fails at conf_split_config line 938 (which contains my fprintf debug output). This is on the if condition where there is a mkdir(path, 0755) which is failing on the path parameter pre/con. So, I am thinking there is some issue with mkdir not creating the parent directory in this case…

Wierd!

Some more debugging:

conf_split_config:920:path=pre/con/buf/sz.h
errmsg: No such file or directory
errmsg: Input/output error

conf_split_config:945:path=pre/con; stat_val=-1, mkdir_val=-1

Getting no directory for the stat call and when we try to do a mkdir in response there is an input/output error.

Any thoughts?

I’m using Windows WSL 16.04.6 LTS 64-bit. Hopefully it isn’t that slight version difference that’s causing the problem lol

I’m at a loss tbh. I just tried building off of your fork and it was successful.
Doesn’t an input/output error usually mean hardware issues? I’m not familiar with the error but maybe there is a problem with the docker mount.

Haha. Hopefully not. Btw, what is the Docker Desktop version you are using? and what is the version of WSL? v1 or v2?

I’m using Docker Desktop 3.1.0 and WSL v2

Using WSL v2 solved the issue for me!

I am mounting my source files off the NT filesystem, and am guessing there is some issue with uboot build and the way WSL v1 mounts work. I noticed similar issues building linux off the NT filesystem so this is likely an issue with WSL v1.

In any case given WSL v2 is now mainstream, we should primarily target that development environment on Windows.

Great! I’ll add a short thing to the README specifying that WSL v2 is necessary if building with WSL.

Sounds good. Thanks @yeeb!

Hi @yeeb,

Did you get a chance to get to this? If so, I can merge and close this topic thread. Thanks!

Hey @amitvasudevan,

I added the README, sorry forgot to reply.

I committed it to your fork, https://github.com/amitvasudevan/uobjcoll-arm-trusted-firmware/tree/uobjcoll.

Oops wrong branch :stuck_out_tongue:

No worries, I will cherry-pick it into a changeset that I have been working on and add it on that.

Thanks @yeeb!

Ok this is merged upstream as part of this task: Uobjcoll-arm-trusted-firmware: fixes and tests with native and uobjcoll builds

Closing topic thread since this is resolved now.

Thanks @yeeb!