[PATCH 1/2] partition: include partuuid string in debug string
When debugging partitions detected by barebox, knowing the partuuid can be useful. Include it in the dev_dbg output. Signed-off-by: Ahmad Fatoum --- common/partitions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/partitions.c b/common/partitions.c index 574b31fbbe9b..4162e86804db 100644 --- a/common/partitions.c +++ b/common/partitions.c @@ -54,8 +54,8 @@ static int register_one_partition(struct block_device *blk, partition_name = basprintf("%s.%d", blk->cdev.name, no); if (!partition_name) return -ENOMEM; - dev_dbg(blk->dev, "Registering partition %s on drive %s\n", - partition_name, blk->cdev.name); + dev_dbg(blk->dev, "Registering partition %s on drive %s (partuuid=%s)\n", + partition_name, blk->cdev.name, part->partuuid); cdev = devfs_add_partition(blk->cdev.name, start, size, 0, partition_name); if (IS_ERR(cdev)) { -- 2.23.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 2/2] fs: devfs-core: do a case-insensitive compare of partuuids
partuuids are represented as hexadecimal strings, where case doesn't matter. barebox formats them as lower case internally, forcing the partuuid device tree property to be lower case too. Use strcasecmp to be case-insensitive. Signed-off-by: Ahmad Fatoum --- fs/devfs-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/devfs-core.c b/fs/devfs-core.c index 2b93a951f269..e2cefb6d4e21 100644 --- a/fs/devfs-core.c +++ b/fs/devfs-core.c @@ -104,7 +104,7 @@ struct cdev *cdev_by_partuuid(const char *partuuid) return NULL; list_for_each_entry(cdev, &cdev_list, list) { - if (!strcmp(cdev->partuuid, partuuid)) + if (!strcasecmp(cdev->partuuid, partuuid)) return cdev; } return NULL; -- 2.23.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH] sandbox: add_image: output errno string on mmap failure
Signed-off-by: Robert Karszniewicz --- arch/sandbox/os/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c index 86118822a..1b2daa396 100644 --- a/arch/sandbox/os/common.c +++ b/arch/sandbox/os/common.c @@ -264,7 +264,7 @@ static int add_image(char *str, char *devname_template, int *devname_number) PROT_READ | (readonly ? 0 : PROT_WRITE), MAP_SHARED, fd, 0); if ((void *)hf->base == MAP_FAILED) - printf("warning: mmapping %s failed\n", filename); + printf("warning: mmapping %s failed: %s\n", filename, strerror(errno)); ret = barebox_register_filedev(hf); if (ret) -- 2.11.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: MFGTools from NXP
Hello, Thanks for your reply. Yes ttyACM is ok now for Linux i can connect to it. But fastboot still does not detect the board. Thanks, Mihaita On Fri, Oct 18, 2019 at 2:46 PM Ahmad Fatoum wrote: > > Hello, > > On 10/17/19 10:40 AM, Mihaita Ivascu wrote: > > Yes I have tried with 2019.01.0 barebox but no change. On linux I > > cannot even connect with PUTTY even though /dev/ttyACM0 is present. On > > Windows at least I can connect via PUTTY > > There's A Linux PuTTY client? Have you tried with a more traditional client, > e.g. screen or microcom? > > > On both OSes fastboot does not list any device. But the board is > > detected in device manager/dmesg. > > :/ > I don't know why it doesn't work for you. I've used so far at least barebox > v2018.12.0, v2019.03.0 and v2019.09.0 on my i.MX6UL board and all were > correctly > detected by the fastboot installed on my system (1:7.0.+r33-1 in debian 9.11). > > If you want to debug it, you should start by looking into why the ttyACM > doesn't work for you. > > Cheers > Ahmad > > > > > > Best regards, > > Mihaita Ivascu > > > > On Wed, Oct 16, 2019 at 2:46 PM Ahmad Fatoum > > wrote: > >> > >> On 10/16/19 2:44 PM, Mihaita Ivascu wrote: > >>> 2018.04.0 > >> > >> I've v2019.09.0 and did the same steps you described and it works for me. > >> Can you try with a newer version? > >> > >>> > >>> On Wed, Oct 16, 2019 at 2:41 PM Ahmad Fatoum > >>> wrote: > > On 10/16/19 2:35 PM, Mihaita Ivascu wrote: > > No it does not. Still no devices listed. > > Strange. What barebox version? > > > > > Thanks, > > Mihaita > > > > On Wed, Oct 16, 2019 at 1:36 PM Ahmad Fatoum > > wrote: > >> > >> On 10/16/19 1:28 PM, Mihaita Ivascu wrote: > >>> On Wed, Oct 16, 2019 at 11:53 AM Ahmad Fatoum > >>> > >>> wrote: > > > On 10/16/19 11:48 AM, Mihaita Ivascu wrote: > > On Wed, Oct 16, 2019 at 11:26 AM Ahmad Fatoum > > > >>> wrote: > >> > >> On 10/16/19 11:21 AM, Mihaita Ivascu wrote: > >>> Hello, > >>> > >>>Thanks for your answer. Yes i am able to connect via PUTTY to > >>> the > >>> target. > >>>Then I should use some adb commands in order to push the new > >>> barebox/firmware ? do you know where I could find some examples? > >> > >> fastboot device -l works normally on Linux. You need to check what > >> you > >>> need > >> to do on Windows to do the same. You should only need the Fastboot > >>> utility > >> for this. > >> > > [mi] Yes I have both fastboot and adb installed on both Windows and > > Linux machines. In both cases it does not list any device. > >The board is detected as fastboot android is windows device > > manager. But the fastboot and adb does not list it. same for Linux. > > Please see attachment > > Let's focus on Linux. You don't see a device there? > What does barebox say? Does it say 'multi_bind: creating Fastboot > >>> function'? > What does you Linux host's dmesg say? > > >>> > >>> barebox@Phytec phyCORE-i.MX6 Ultra Lite SOM:/ usbgadget -aA > >>> udc0: registering UDC driver [g_multi] > >>> multi_bind: creating Fastboot function > >>> multi_bind: creating ACM function > >>> g_multi usbgadget: Multifunction Composite Gadget > >>> g_multi usbgadget: userspace failed to provide iSerialNumber > >>> g_multi usbgadget: g_multi ready > >>> barebox@Phytec phyCORE-i.MX6 Ultra Lite SOM:/ g_multi usbgadget: > >>> high-speed > >>> config #1: Multifunction Composite Gadget > >>> > >>> dmesg: > >>> > >>> [ 25.602275] usb 1-1.3: USB disconnect, device number 3 > >>> [ 28.359930] usb 1-1.3: new high-speed USB device number 5 using > >>> ehci-pci > >>> [ 28.452971] usb 1-1.3: New USB device found, idVendor=1d6b, > >>> idProduct=0104 > >>> [ 28.452976] usb 1-1.3: New USB device strings: Mfr=0, Product=2, > >>> SerialNumber=0 > >>> [ 28.452980] usb 1-1.3: Product: Phytec phyCORE-i.MX6 Ultra Lite SOM > >>> [ 28.457925] cdc_acm 1-1.3:1.1: ttyACM0: USB ACM device > >>> > >>> > >>> So I see the device on Linux. But fastboot does not list any device on > >>> Linux. > >> > >> sudo doesn't change this? > >> > >>> > > > >>> > >>>Also I have a question: purpose of this activity is for me to > >>> be > >>> able to flash some imx6ul boards that have no firmware: no > >>> barebox. > >>>So I know hardware config for the port is otg mode but as I > >>> have no > >>> barebox running them before I am wondering if I will be able to > >>> connect via PUTTY if I do not set the ACM gadget from barebox?
[PATCH 2/2] commands: passwd: suggest sandbox for offline password generation
Users might want to generate the password while the target is offline. We don't provide a dedicated host tool for that, but barebox sandbox can be used. Document this possibility. While at it, remove a misplaced single quite and slash in the help text. Signed-off-by: Ahmad Fatoum --- commands/Kconfig | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/Kconfig b/commands/Kconfig index 0189b4715bb9..a6db52ae54b7 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -1389,8 +1389,10 @@ config CMD_PASSWD help Set password - 'Interactively asks for a password. The digest of this password will be - stored in /env/etc//passwd. This is then used by the 'login' command. + Interactively asks for a password. The digest of this password will be + stored in /env/etc/passwd. This is then used by the 'login' command. + + Passwords can be generated on the host machine using barebox sandbox. Entering an empty string will disable the password function. -- 2.23.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 1/2] hwrng: dev-random: always use /dev/urandom
/dev/random can block long after boot time. It seems there's a consensus that /dev/urandom is safe to use except for very early boot, which isn't when barebox sandbox is usually run. To make the HWRNG more useful, always use /dev/urandom. Signed-off-by: Ahmad Fatoum --- arch/sandbox/board/dev-random.c| 7 +-- arch/sandbox/mach-sandbox/include/mach/linux.h | 1 - drivers/hw_random/Kconfig | 6 +++--- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/sandbox/board/dev-random.c b/arch/sandbox/board/dev-random.c index f65e5ef6e5ed..60295e9fced2 100644 --- a/arch/sandbox/board/dev-random.c +++ b/arch/sandbox/board/dev-random.c @@ -4,10 +4,6 @@ devrandom_t *devrandom_init(void) { devrandom_t *fds = xzalloc(sizeof(*fds)); - fds->randomfd = linux_open("/dev/random", false); - if (fds->randomfd < 0) - return ERR_PTR(-EPERM); - fds->urandomfd = linux_open("/dev/urandom", false); if (fds->urandomfd < 0) return ERR_PTR(-EPERM); @@ -17,8 +13,7 @@ devrandom_t *devrandom_init(void) { int devrandom_read(devrandom_t *devrandom, void *buf, size_t len, int wait) { - if (wait) - return linux_read(devrandom->randomfd, buf, len); + (void)wait; /* /dev/urandom won't block */ return linux_read(devrandom->urandomfd, buf, len); } diff --git a/arch/sandbox/mach-sandbox/include/mach/linux.h b/arch/sandbox/mach-sandbox/include/mach/linux.h index 1e64d41c6a5e..9759a376ecb3 100644 --- a/arch/sandbox/mach-sandbox/include/mach/linux.h +++ b/arch/sandbox/mach-sandbox/include/mach/linux.h @@ -52,7 +52,6 @@ int barebox_libftdi1_update(struct ft2232_bitbang *ftbb); void barebox_libftdi1_close(void); typedef struct { - int randomfd; int urandomfd; } devrandom_t; devrandom_t *devrandom_init(void); diff --git a/drivers/hw_random/Kconfig b/drivers/hw_random/Kconfig index c57928204d30..242a7ef27828 100644 --- a/drivers/hw_random/Kconfig +++ b/drivers/hw_random/Kconfig @@ -15,11 +15,11 @@ config HWRNG_MXC_RNGC Generator hardware found on some Freescale i.MX processors. config HWRNG_DEV_RANDOM - tristate "Linux /dev/random and /dev/urandom RNG" + tristate "Linux /dev/urandom RNG" depends on SANDBOX default y help - This driver allows use of the host provided /dev/random - and /dev/urandom as barebox HWRNGs. + This driver allows use of the host provided /dev/urandom + as barebox HWRNGs. endif -- 2.23.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH v3 1/3] MIPS: reloc: remove init of relocated bss
It will be done in main_entry() any way. Signed-off-by: Oleksij Rempel --- arch/mips/lib/reloc.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c index 9a9e404f7e..798a68680d 100644 --- a/arch/mips/lib/reloc.c +++ b/arch/mips/lib/reloc.c @@ -110,7 +110,7 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size) { unsigned long addr, length, bss_len; u32 relocaddr, new_stack; - uint8_t *buf, *bss_start; + uint8_t *buf; unsigned int type; long off; @@ -149,10 +149,6 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size) /* Ensure the icache is coherent */ flush_cache_all(); - /* Clear the .bss section */ - bss_start = (uint8_t *)((unsigned long)__bss_start + off); - memset(bss_start, 0, bss_len); - __asm__ __volatile__ ( "move $a0, %0\n" " move$a1, %1\n" -- 2.23.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH v3 3/3] MIPS: reloc: init bss and cpu
We need it to make flush_cache_all() work properly. Signed-off-by: Oleksij Rempel --- arch/mips/lib/reloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c index 798a68680d..df9760e38c 100644 --- a/arch/mips/lib/reloc.c +++ b/arch/mips/lib/reloc.c @@ -115,6 +115,8 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size) long off; bss_len = (unsigned long)&__bss_stop - (unsigned long)__bss_start; + memset(__bss_start, 0, bss_len); + cpu_probe(); length = barebox_image_size + bss_len; relocaddr = ALIGN_DOWN(ram_size - length, SZ_64K); -- 2.23.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH v3 2/3] MIPS: move r4k_cache_init in to cpu_probe function
Signed-off-by: Oleksij Rempel --- arch/mips/boot/main_entry.c | 6 -- arch/mips/include/asm/cache.h | 1 + arch/mips/lib/cpu-probe.c | 5 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/mips/boot/main_entry.c b/arch/mips/boot/main_entry.c index 4ae4457e7e..2c18bc81c3 100644 --- a/arch/mips/boot/main_entry.c +++ b/arch/mips/boot/main_entry.c @@ -77,12 +77,6 @@ void __bare_init main_entry(void *fdt, u32 fdt_size) cpu_probe(); - if (cpu_has_4k_cache) { - extern void r4k_cache_init(void); - - r4k_cache_init(); - } - trap_init(); malloc_end = (unsigned long)_stext; diff --git a/arch/mips/include/asm/cache.h b/arch/mips/include/asm/cache.h index cceba0acc0..4bb39b1cd4 100644 --- a/arch/mips/include/asm/cache.h +++ b/arch/mips/include/asm/cache.h @@ -2,5 +2,6 @@ #define _ASM_MIPS_CACHE_H void flush_cache_all(void); +void r4k_cache_init(void); #endif /* _ASM_MIPS_CACHE_H */ diff --git a/arch/mips/lib/cpu-probe.c b/arch/mips/lib/cpu-probe.c index 2556a8b240..ddabddd466 100644 --- a/arch/mips/lib/cpu-probe.c +++ b/arch/mips/lib/cpu-probe.c @@ -9,6 +9,8 @@ */ #include #include +#include +#include #include #include #include @@ -163,6 +165,9 @@ void cpu_probe(void) cpu_probe_ingenic(c); break; } + + if (cpu_has_4k_cache) + r4k_cache_init(); } unsigned long mips_stack_top; -- 2.23.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 1/2] serial: efi-stdio: replace globals with handles in priv struct
Despite assigning efi_sys_table->{con_in,con_out} to priv->{in,out}, some functions still use the global efi_sys_table->{con_in,con_out}. Let's restrict globals access to the probe function and have the priv struct completely describe input and output used in the callbacks. No functional change. Signed-off-by: Ahmad Fatoum --- drivers/serial/efi-stdio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c index 2ca89fa4f861..a8cc967b32a2 100644 --- a/drivers/serial/efi-stdio.c +++ b/drivers/serial/efi-stdio.c @@ -116,7 +116,7 @@ static int efi_read_key(struct efi_console_priv *priv, bool wait) if (wait) BS->wait_for_event(1, priv->in->wait_for_key, &index); -efiret = priv->in->read_key_stroke(efi_sys_table->con_in, &k); +efiret = priv->in->read_key_stroke(priv->in, &k); if (EFI_ERROR(efiret)) return -efi_errno(efiret); @@ -133,7 +133,8 @@ static int efi_read_key(struct efi_console_priv *priv, bool wait) static void efi_console_putc(struct console_device *cdev, char c) { uint16_t str[2] = {}; - struct efi_simple_text_output_protocol *con_out = efi_sys_table->con_out; + struct efi_console_priv *priv = to_efi(cdev); + struct efi_simple_text_output_protocol *con_out = priv->out; str[0] = c; -- 2.23.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 2/2] serial: efi-stdio: Add simple_text_input_ex_protocol backend
EFI implementations differ in how simple_text_input_protocol treats ctrl+alpha combinations. OVMF (used with QEMU) returns a Unicode control character, the UEFI on the Dell Latitude 7490 on the other hand ignores the ctrl completely and returns just the letter rendering utilities like barebox edit unusable. To fix this, the simple_text_input_ex_protocol can be leveraged as it additionally provides the state of modifier keys. Extend efi-stdio to use it where possible. Cc: Michael Olbrich Signed-off-by: Ahmad Fatoum --- drivers/serial/efi-stdio.c | 75 +- drivers/serial/efi-stdio.h | 58 + 2 files changed, 123 insertions(+), 10 deletions(-) create mode 100644 drivers/serial/efi-stdio.h diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c index a8cc967b32a2..9e825181e6f9 100644 --- a/drivers/serial/efi-stdio.c +++ b/drivers/serial/efi-stdio.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include "efi-stdio.h" #define EFI_SHIFT_STATE_VALID 0x8000 #define EFI_RIGHT_CONTROL_PRESSED 0x0004 @@ -71,6 +73,7 @@ struct efi_console_priv { struct efi_simple_text_output_protocol *out; struct efi_simple_input_interface *in; + struct efi_simple_text_input_ex_protocol *inex; struct console_device cdev; int lastkey; u16 efi_console_buffer[CONFIG_CBSIZE]; @@ -105,29 +108,65 @@ static struct efi_ctrlkey ctrlkeys[] = { { 0x17, 27 /* escape key */ }, }; +static int xlate_keypress(struct efi_input_key *k) +{ + int i; + + /* 32 bit modifier keys + 16 bit scan code + 16 bit unicode */ + for (i = 0; i < ARRAY_SIZE(ctrlkeys); i++) { + if (ctrlkeys[i].scan_code == k->scan_code) + return ctrlkeys[i].bb_key; + + } + + return k->unicode_char & 0xff; +} + static int efi_read_key(struct efi_console_priv *priv, bool wait) { unsigned long index; efi_status_t efiret; - struct efi_input_key k; - int i; + struct efi_key_data kd; /* wait until key is pressed */ if (wait) BS->wait_for_event(1, priv->in->wait_for_key, &index); -efiret = priv->in->read_key_stroke(priv->in, &k); -if (EFI_ERROR(efiret)) - return -efi_errno(efiret); + if (priv->inex) { + efiret = priv->inex->read_key_stroke_ex(priv->inex, &kd); - /* 32 bit modifier keys + 16 bit scan code + 16 bit unicode */ - for (i = 0; i < ARRAY_SIZE(ctrlkeys); i++) { - if (ctrlkeys[i].scan_code == k.scan_code) - return ctrlkeys[i].bb_key; + if (efiret == EFI_NOT_READY) + return -EAGAIN; + + if (!EFI_ERROR(efiret)) { + if ((kd.state.shift_state & EFI_SHIFT_STATE_VALID) && + (kd.state.shift_state & EFI_CONTROL_PRESSED)) { + int ch = tolower(kd.key.unicode_char & 0xff); + + if (isalpha(ch)) + return CHAR_CTRL(ch); + if (ch == '\0') /* ctrl is pressed on its own */ + return -EAGAIN; + } + if (kd.key.unicode_char || kd.key.scan_code) + return xlate_keypress(&kd.key); + + /* Some broken firmwares offer simple_text_input_ex_protocol, +* but never handle any key. Treat those as if +* read_key_stroke_ex failed and fall through +* to the basic simple_text_input_protocol. +*/ + dev_dbg(priv->cdev.dev, "Falling back to simple_text_input_protocol\n"); + } } - return k.unicode_char & 0xff; + efiret = priv->in->read_key_stroke(priv->in, &kd.key); + + if (EFI_ERROR(efiret)) + return -efi_errno(efiret); + + return xlate_keypress(&kd.key); } static void efi_console_putc(struct console_device *cdev, char c) @@ -332,8 +371,12 @@ static void efi_set_mode(struct efi_console_priv *priv) static int efi_console_probe(struct device_d *dev) { + efi_guid_t inex_guid = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID; + struct efi_simple_text_input_ex_protocol *inex; struct console_device *cdev; struct efi_console_priv *priv; + efi_status_t efiret; + int i; priv = xzalloc(sizeof(*priv)); @@ -341,6 +384,18 @@ static int efi_console_probe(struct device_d *dev) priv->out = efi_sys_table->con_out; priv->in = efi_sys_table->con_in; + efiret = BS->open_protocol((void *)efi_sys_table->con_in_handle, +&inex_guid, +(void **)&inex, +
Re: barebox 2019.07 ubiformat
Hi Renaud, On Fri, Oct 18, 2019 at 03:09:00PM +, Barbier, Renaud wrote: > Looking at the Linux nand_ecc, there is something specific for512 bytes size > ecc: > > if (eccsize_mult == 2 && (i & 0x4) == 0) > rp16 ^= tmppar; > > code[2] = > + (invparity[par & 0xf0] << 7) | > + (invparity[par & 0x0f] << 6) | > + (invparity[par & 0xcc] << 5) | > + (invparity[par & 0x33] << 4) | > + (invparity[par & 0xaa] << 3) | > + (invparity[par & 0x55] << 2) | > + (invparity[rp17] << 1) | > + (invparity[rp16] << 0); > > In barebox we have: > ecc_code[2] = ((~reg1) << 2) | 0x03; > > So I guess there is a small change to do to support 512 bytes. What we have in barebox currently seems to be the nand_ecc.c version of Linux-2.6.25. A git log of that file from v2.6.25 to master has: 260dc003e9fd mtd: nand: fix 512 byte software ecc support So yes, we do not seem to have 512 byte software ecc support. I'd say just update nand_ecc.c to a recent Kernel version. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3] libfile: copy_file: prevent spurious error message
On Fri, Oct 18, 2019 at 07:15:27PM +0200, Robert Karszniewicz wrote: > In all this haste, I forgot my question. > > What error codes should be used? For each goto its own code, in sequence, > starting from -1? Please propagate the error code returned from the call that failed. i.e. something like: r = read(srcfd, rw_buf, RW_BUF_SIZE); if (r < 0) { perror("read"); ret = r; goto out; } Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox