# Booting U-Boot from the console UART



## balanga (Jul 27, 2018)

I'm trying to follow some instructions  from the section 
*Using UART*
which show how to load U-Boot over the console UART using X-MODEM... This is what you need to do:-


```
$ sx -kb /path/to/u-boot-spl.bin < /dev/ttyUSB0 > /dev/ttyUSB0
$ sx -kb --ymodem /path/to/u-boot.img < /dev/ttyUSB0 > /dev/ttyUSB0
```

I believe `sx` is xmodem and is part of the comms/lrzsz  pkg but when I run `sx` I get Command not found.

Any guidance would be much appreciated.


----------



## Phishfry (Jul 27, 2018)

https://www.freebsd.org/cgi/man.cgi?cu(1)



> *~C*         Fork a child process on the local system to perform special pro-
> tocols such as XMODEM.  The child program will be run with    the
> following arrangement of file descriptors:
> 
> ...


----------



## Phishfry (Jul 27, 2018)

You might need this port: comms/lrzsz/


----------



## balanga (Jul 27, 2018)

Phishfry said:


> https://www.freebsd.org/cgi/man.cgi?cu(1)



Unfortunately there is no example so I'll try to interpret the options as best as I can in the hope that I make some progress


> cu -l /dev/cuaU0 -s 115200 ~C  sx -kb /path/to/u-boot-spl.bin < /dev/cuaU0 > /dev/cuaU0


Not sure what u-boot-spl.bin is but I guess it could be any file at this point since I'm only trying to check the transfer mechanism now.


----------



## balanga (Jul 27, 2018)

balanga said:


> ```
> cu -l /dev/cuaU0 -s 115200 ~C sx -kb /path/to/u-boot-spl.bin < /dev/cuaU0 > /dev/cuaU0
> ```


This returns:-

Unknown user: C.


----------



## Phishfry (Jul 27, 2018)

sx is a program you are inlining. Does it exist?
You might need to substitute from the above port for sz/sx from GNU instructions. Then read alot.

I have never used any of this. Good Luck


----------



## Phishfry (Jul 28, 2018)

Just like with this thread, minicomm is a better terminal than `cu`.
https://forums.freebsd.org/threads/help-with-c-kermit.61767/#post-356130
.
I believe it is a better choice here.
https://www.freebsd.org/cgi/man.cgi?minicom

So download the comms/lrzsz port to get `rz` and use these instructions:
http://k.japko.eu/serial-transfers.html

Notice this old but maybe relevant thread. They talk of linking. to `rz`.
https://s2-forums.vandyke.com/showthread.php?t=739

Here is another tact you  could try.
Right up your alley, a graphical version. comms/cutecom


----------



## balanga (Jul 28, 2018)

I already had  comms/lrzsz  installed and it did take me a bit of time to work out that what everyone called rx (rz) sx (sz), FreeBSD calls lrz and lsz... Confusing or what?

Oops... that should be:-

rx -> lrx
rz -> lrz
sx -> lsx
sz -> lsz


----------



## balanga (Jul 28, 2018)

Phishfry said:


> So download the comms/lrzsz port to get `rz` and use these instructions:
> http://k.japko.eu/serial-transfers.html


I tried following this one but eventually an error msg flashed up for about a nano second - couldn't find any logs although I tried setting up /var/log/minicom.log

After twenty attempts I eventually made out:-


> this program was never meant to be used as setuid


... ?


----------



## Chris_H (Jul 28, 2018)

Gaining access to system devices, has always been _root_ thing, and for good reason. It probably  would have been better handled in the same way allowing access to normal users is handled for `/dev/cd0` -- putting the users in that (device) group.
Xorg, and the various X screen-savers go the setuid(2) route, tho. It may well be possible to change the way comms/minicom is dealt with, where hardware access is concerned. You might want to file a bug report on bugzilla, to see if the Maintainer can better assist you. 

--Chris


----------

