Re: [PATCH v1 1/1] tools/netconsole: Add support for socat

2021-11-18 Thread Ferry Toth

Hi,

Op 17-11-2021 om 18:15 schreef Andy Shevchenko:

socat is a very powerful tool to work with socets (and not only)
in UNIX systems. Let's add support for it in netconsole.

Signed-off-by: Andy Shevchenko 

Tested-by: Ferry Toth 

---
  tools/netconsole | 12 ++--
  1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/netconsole b/tools/netconsole
index 1a0ef22244e3..155453320f73 100755
--- a/tools/netconsole
+++ b/tools/netconsole
@@ -34,7 +34,7 @@ if [ -z "${ip}" ] || [ -n "$4" ] ; then
usage "Invalid number of arguments"
  fi
  
-for nc in netcat nc ; do

+for nc in socat netcat nc ; do
type ${nc} >/dev/null 2>&1 && break
  done
  
@@ -47,6 +47,10 @@ if type ncb 2>/dev/null ; then

# see if ncb is in $PATH
exec ncb ${board_out_port}
  
+elif [ "${nc}" = "socat" ] ; then

+   # socat does support broadcast
+   while ${nc} STDIO "UDP4-LISTEN:${board_out_port}"; do :; done
+
  elif [ -x ${0%/*}/ncb ] ; then
# maybe it's in the same dir as the netconsole script
exec ${0%/*}/ncb ${board_out_port}
@@ -59,5 +63,9 @@ else
  fi
  ) &
  pid=$!
-${nc} -u ${ip} ${board_in_port}
+if [ "${nc}" = "socat" ] ; then
+   ${nc} - "UDP4:${ip}:${board_in_port}"
+else
+   ${nc} -u ${ip} ${board_in_port}
+fi
  kill ${pid} 2>/dev/null


Re: [PATCH v1 2/2] x86: edison: Don't take SD card detect pin into consideration

2021-10-20 Thread Ferry Toth

Hi,
Op 15-10-2021 om 19:11 schreef Andy Shevchenko:

There are two PCB designs in the wild which use the opposite
signaling for SD card detect. This makes U-Boot working in one case
and failing in the other. Quirk this out by disconnecting SD card
detect pin from the PCB by switching to mode 3.


Tested-by: Ferry Toth  @ Intel Edison-Arduino board


BugLink: https://github.com/edison-fw/meta-intel-edison/issues/136
Signed-off-by: Andy Shevchenko 
---
  arch/x86/dts/edison.dts | 12 
  1 file changed, 12 insertions(+)

diff --git a/arch/x86/dts/edison.dts b/arch/x86/dts/edison.dts
index 2c8cf6c07102..04e8a4e457c8 100644
--- a/arch/x86/dts/edison.dts
+++ b/arch/x86/dts/edison.dts
@@ -94,6 +94,7 @@
sdcard: mmc@ff3fa000 {
compatible = "intel,sdhci-tangier";
reg = <0xff3fa000 0x1000>;
+   cd-inverted;
};
  
  	pmu: power@ff00b000 {

@@ -131,6 +132,17 @@
compatible = "intel,pinctrl-tangier";
reg = <0xff0c 0x8000>;
  
+		/*

+* Disconnect SD card detect, so it won't affect the reality
+* on two different PCB designs where it's using the opposite
+* signaling: Edison/Arduino uses Active Low, while SparkFun
+* went with Active High.
+*/
+   sd_cd@0 {
+   pad-offset = <37>;
+   mode-func = <3>;
+   };
+
/*
 * Initial configuration came from the firmware.
 * Which quite likely has been used in the phones, where I2C #8,





CONFIG: btrfs requires sha256

2020-11-13 Thread Ferry Toth

In v2021.01-rc2 enabling CONFIG_FS_BTRFS=y produces:

x86_64-poky-linux-ld.bfd: fs/built-in.o: in function `hash_sha256':
u-boot/1_2021.01-rc2-r0/git/fs/btrfs/crypto/hash.c:25: undefined 
reference to `sha256_starts'
x86_64-poky-linux-ld.bfd: 
u-boot/1_2021.01-rc2-r0/git/fs/btrfs/crypto/hash.c:26: undefined 
reference to `sha256_update'
x86_64-poky-linux-ld.bfd: 
u-boot/1_2021.01-rc2-r0/git/fs/btrfs/crypto/hash.c:27: undefined 
reference to `sha256_finish'


Enabling CONFIG_SHA256=y resolves this, however it is not a dependency.



Re: U-Boot fails dfu on edison

2020-09-14 Thread Ferry Toth

Op 03-09-2020 om 17:49 schreef Andy Shevchenko:

On Thu, Sep 03, 2020 at 06:05:44PM +0300, Andy Shevchenko wrote:

On Thu, Sep 03, 2020 at 08:21:23AM -0600, Simon Glass wrote:

On Thu, 3 Sep 2020 at 07:51, Andy Shevchenko  wrote:

On Thu, Sep 3, 2020 at 4:40 PM Andy Shevchenko
 wrote:

On Thu, Sep 03, 2020 at 07:15:59AM -0600, Simon Glass wrote:


...


Hmm... Have you read this [1]? It may give some hints I think.

[1]: https://edison-fw.github.io/edison-wiki/u-boot-update (look into 
known-bugs section)


Any ideas please?


See above.


Just in case my script [2] to prepare a U-Boot image file suitable for xFSTK.

[2]: https://gist.github.com/andy-shev/2c388310f2773ead647d9c1a3f1c813f


Thanks, that gets me a bit closer. Here are my steps:

1. Start with the original 2014 U-Boot from 'flashall.sh --recovery'
2. Boot it and use dfu-util to flash the latest 2020 U-Boot as per edison.rst
3. Set env vars as guessed from the link you provided:

setenv dfu_alt_info "ifwi${hardware_id} raw 0 8192 mmcpart
1;ifwib${hardware_id} raw 0 8192 mmcpart 2;u-boot0 part 0
1;u-boot-env0 part 0 2;u-boot1 part 0 3;u-boot-env1 part 0 4;boot part
0 7;rootfs part 0 8;update part 0 9;home part 0 10;vmlinuz fat 0
7;initrd fat 0 7"
setenv do_dfu_alt_info_ifwi 'setenv dfu_alt_info "ifwi${hardware_id}
raw 0 8192 mmcpart 1;ifwib${hardware_id} raw 0 8192 mmcpart 2"'
setenv do_dfu_alt_info_mmc 'setenv dfu_alt_info "ifwi${hardware_id}
raw 0 8192 mmcpart 1;ifwib${hardware_id} raw 0 8192 mmcpart 2;u-boot0
part 0 1;u-boot-env0 part 0 2;u-boot1 part 0 3;u-boot-env1 part 0
4;boot part 0 7;rootfs part 0 8;update part 0 9;home part 0 10;vmlinuz
fat 0 7;initrd fat 0 7"'
setenv do_flash_ifwi 'run do_dfu_alt_info_ifwi ; dfu 0 raw 3'
setenv do_force_flash_os 'run do_dfu_alt_info_mmc ; sleep 1 ; setenv
do_flash_os_done 1 ; saveenv ; dfu 0 raw 3'


^^^


4. Reboot and see:

U-Boot 2020.10-rc3-00012-g9f04a634ef3 (Sep 03 2020 - 07:06:30 -0600)

CPU:   Genuine Intel(R) CPU   4000  @  500MHz
DRAM:  980.6 MiB
WDT:   Started with servicing (60s timeout)
MMC:   mmc@ff3fc000: 0, mmc@ff3fa000: 1
Loading Environment from MMC... OK
In:serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0
Target:ifwi
Partitioning already done...
Partitioning already done...
Saving Environment to MMC... Writing to redundant MMC(0)... OK
dfu_fill_entity: Device raw not (yet) supported!



So I am still missing something?


Yes. You haven't read the Issue #3 [3] mentioned in the known-bug section in 
[1].

[3]: https://github.com/intel/edison-u-boot/issues/3


For your convenience copy'n'paste of my comments from [3].

~~~
You need to change mmc word (note that mmcpart word is left untouched) to raw
word in description of partitions. It's done, for example, in
do_dfu_alt_info_mmc environment variable.

Command is kept the same:
dfu 0 mmc 0

~~~
There is no rawpart keyword in DFU if I remember correctly. You need to use
mmcpart instead. I have updated above comment to accent on this.

~~~


This Yocto recipe build U-Boot and the env variables as the original 
flashall.sh script expects:

https://github.com/edison-fw/meta-intel-edison/tree/zeus/meta-intel-edison-bsp/recipes-bsp/u-boot/files/target_env

These are concat with this one:
https://github.com/edison-fw/meta-intel-edison/blob/zeus/meta-intel-edison-bsp/recipes-bsp/u-boot/files/edison.env

Scripts and U_Boot built in this way are built and tested up to U-Boot 
2020.07.









Re: Warnings on Edison

2020-05-22 Thread Ferry Toth

Op 20-05-2020 om 16:16 schreef Andy Shevchenko:

On Wed, May 20, 2020 at 09:35:34AM -0400, Tom Rini wrote:

...


as Edison still works.


I believe no-one who is building it from sources for Edison uses that old
ACPICA tools.


Building with Yocto we are on 20190215
https://github.com/westeri/meta-acpi/tree/master/recipes-bsp/acpica


Re: [PATCH v1] dfu: Reset timeout in case of DFU request

2020-01-30 Thread Ferry Toth

Op 29-01-2020 om 16:23 schreef Andy Shevchenko:

In case dfu command is being executed with timeout option,
the timer may expire in the middle of DFU operation. If there
is DFU request coming, we may simple reset timeout value
to prevent aborting of ongoing DFU operation.

Signed-off-by: Andy Shevchenko 
---
  drivers/usb/gadget/f_dfu.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index 6756155133..a4a57ba5f5 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -596,6 +596,11 @@ dfu_handle(struct usb_function *f, const struct 
usb_ctrlrequest *ctrl)
debug("req_type: 0x%x ctrl->bRequest: 0x%x f_dfu->dfu_state: 0x%x\n",
   req_type, ctrl->bRequest, f_dfu->dfu_state);
  
+#ifdef CONFIG_DFU_TIMEOUT

+   /* Forbid aborting by timeout. Next dfu command may update this */
+   dfu_set_timeout(0);
+#endif
+
if (req_type == USB_TYPE_STANDARD) {
if (ctrl->bRequest == USB_REQ_GET_DESCRIPTOR &&
(w_value >> 8) == DFU_DT_FUNC) {


Tested-by: Ferry Toth 


Re: [U-Boot] [PATCH v1 2/2] x86: edison: Switch to CONFIG_OF_SEPARATE

2019-01-10 Thread Ferry Toth

Op 08-01-19 om 15:17 schreef Andy Shevchenko:

There is no need for Intel Edison to have CONFIG_OF_EMBED to be enabled.
Replace it with CONFIG_OF_SEPARATE.

There is no functional change since u-boot.bin always contains DTB
either embedded or attached.

Signed-off-by: Andy Shevchenko 

Tested-by: Ferry Toth 

---
  configs/edison_defconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/edison_defconfig b/configs/edison_defconfig
index e376c0cea6..dc7d86aafe 100644
--- a/configs/edison_defconfig
+++ b/configs/edison_defconfig
@@ -26,7 +26,7 @@ CONFIG_CMD_EXT4=y
  CONFIG_CMD_EXT4_WRITE=y
  CONFIG_CMD_FAT=y
  CONFIG_CMD_FS_GENERIC=y
-CONFIG_OF_EMBED=y
+CONFIG_OF_SEPARATE=y
  CONFIG_DEFAULT_DEVICE_TREE="edison"
  CONFIG_ENV_IS_IN_MMC=y
  CONFIG_CPU=y




___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 2/2] x86: edison: Switch to CONFIG_OF_SEPARATE

2019-01-10 Thread Ferry Toth

Op 08-01-19 om 15:17 schreef Andy Shevchenko:

There is no need for Intel Edison to have CONFIG_OF_EMBED to be enabled.
Replace it with CONFIG_OF_SEPARATE.

There is no functional change since u-boot.bin always contains DTB
either embedded or attached.

Signed-off-by: Andy Shevchenko 

Tested-by: Ferry Toth 

---
  configs/edison_defconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/edison_defconfig b/configs/edison_defconfig
index e376c0cea6..dc7d86aafe 100644
--- a/configs/edison_defconfig
+++ b/configs/edison_defconfig
@@ -26,7 +26,7 @@ CONFIG_CMD_EXT4=y
  CONFIG_CMD_EXT4_WRITE=y
  CONFIG_CMD_FAT=y
  CONFIG_CMD_FS_GENERIC=y
-CONFIG_OF_EMBED=y
+CONFIG_OF_SEPARATE=y
  CONFIG_DEFAULT_DEVICE_TREE="edison"
  CONFIG_ENV_IS_IN_MMC=y
  CONFIG_CPU=y




___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3] x86: lib: Implement standalone __udivdi3 etc instead of libgcc ones

2017-12-02 Thread Ferry Toth
Op Wed, 29 Nov 2017 16:23:31 +0100, schreef Stefan Roese:

> This patch removes the inclusion of the libgcc math functions and
> replaces them by functions coded in C, taken from the coreboot project.
> This makes U-Boot building more independent from the toolchain installed
> / available on the build system.

Thanks Stefan,

Great work, I'll try to test that soon.

BTW I eventually have been able to work around the problem in Yocto. The 
work around involved creating a seperate .conf file for u-boot which 
includes multilib support. I couldn't add multilib support to my 
rootfs .conf file because that broke building the sdk. Of course the 
effect is to build a complete seperate target infrastructure (x86_64 + 
ml) just to build one binary. 

This patch will save people a lot of grief I'm sure.
 
> The code taken from coreboot is authored from Vadim Bendebury
>  on 2014-11-28 and committed with commit ID
> e63990ef [libpayload: provide basic 64bit division implementation]
> (coreboot git repository located here [1]).
> 
> I modified the code so that its checkpatch clean without any functional
> changes.
> 
> [1] git://github.com/coreboot/coreboot.git
> 
> Signed-off-by: Stefan Roese 
> Cc: Simon Glass 
> Cc: Bin Meng 
> ---
> v3:
> - Completely get rid of all libgcc references in arch/x86/lib/Makefile,
>   also for the standalone applications
>   
> v2:
> - Added coreboot git repository link to commit message
> 
>  arch/x86/config.mk|   3 --
>  arch/x86/lib/Makefile |   8 +---
>  arch/x86/lib/div64.c  | 113
>  ++
>  arch/x86/lib/gcc.c|  29 -
>  4 files changed, 114 insertions(+), 39 deletions(-)
>  create mode 100644 arch/x86/lib/div64.c delete mode 100644
>  arch/x86/lib/gcc.c
> 
> diff --git a/arch/x86/config.mk b/arch/x86/config.mk index
> 8835dcf36f..472ada5490 100644 --- a/arch/x86/config.mk +++
> b/arch/x86/config.mk @@ -34,9 +34,6 @@ PLATFORM_RELFLAGS +=
> -ffunction-sections -fvisibility=hidden
>  PLATFORM_LDFLAGS += -Bsymbolic -Bsymbolic-functions PLATFORM_LDFLAGS +=
>  -m $(if $(IS_32BIT),elf_i386,elf_x86_64)
>  
> -LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3 -LDFLAGS_FINAL +=
> --wrap=__moddi3 --wrap=__umoddi3 -
>  # This is used in the top-level Makefile which does not include #
>  PLATFORM_LDFLAGS LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions
>  -shared --no-undefined
> diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index
> fe00d7573f..7d729ea0f7 100644 --- a/arch/x86/lib/Makefile +++
> b/arch/x86/lib/Makefile @@ -18,7 +18,6 @@ obj-$(CONFIG_SEABIOS) +=
> coreboot_table.o
>  obj-y+= early_cmos.o obj-$(CONFIG_EFI) += efi/
>  obj-y+= e820.o
> -obj-y+= gcc.o
>  obj-y+= init_helpers.o obj-y += interrupts.o obj-y   += lpc-
uclass.o
> @@ -49,12 +48,7 @@ endif
>  obj-$(CONFIG_HAVE_FSP) += fsp/
>  obj-$(CONFIG_SPL_BUILD) += spl.o
>  
> -extra-$(CONFIG_USE_PRIVATE_LIBGCC) += lib.a -
> -NORMAL_LIBGCC = $(shell $(CC) $(PLATFORM_CPPFLAGS)
> -print-libgcc-file-name) -OBJCOPYFLAGS := --prefix-symbols=__normal_
> -$(obj)/lib.a: $(NORMAL_LIBGCC) FORCE -   $(call if_changed,objcopy)
> +lib-$(CONFIG_USE_PRIVATE_LIBGCC) += div64.o
>  
>  ifeq ($(CONFIG_$(SPL_)X86_64),)
>  obj-$(CONFIG_EFI_APP) += crt0_ia32_efi.o reloc_ia32_efi.o
> diff --git a/arch/x86/lib/div64.c b/arch/x86/lib/div64.c new file mode
> 100644 index 00..4efed74037 --- /dev/null +++
> b/arch/x86/lib/div64.c @@ -0,0 +1,113 @@
> +/*
> + * This file is copied from the coreboot repository as part of + * the
> libpayload project:
> + *
> + * Copyright 2014 Google Inc.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause + */
> +
> +#include 
> +
> +union overlay64 {
> + u64 longw;
> + struct {
> + u32 lower;
> + u32 higher;
> + } words;
> +};
> +
> +u64 __ashldi3(u64 num, unsigned int shift)
> +{
> + union overlay64 output;
> +
> + output.longw = num;
> + if (shift >= 32) {
> + output.words.higher = output.words.lower << (shift - 32); 
+   
> output.words.lower = 0;
> + } else {
> + if (!shift)
> + return num;
> + output.words.higher = (output.words.higher << shift) | 
+   
> (output.words.lower >> (32 - shift));
> + output.words.lower = output.words.lower << shift;
> + }
> + return output.longw;
> +}
> +
> +u64 __lshrdi3(u64 num, unsigned int shift)
> +{
> + union overlay64 output;
> +
> + output.longw = num;
> + if (shift >= 32) {
> + output.words.lower = output.words.higher >> (shift - 32); 
+   
> output.words.higher = 0;
> + } else {
> + if (!shift)
> + return num;
> + output.words.lower = output.words.lower >> shift | 
+   
> (output.words.higher << (32 - shift));
> + output.words.higher =