Welcome! Log In Create A New Profile

Advanced

kwboot

Posted by balanga 
kwboot
June 20, 2018 02:31AM
Apologies if this off-topic, but I thought someone here might be able to give me some insight on my problem...

I've been trying to get kwboot working on FreeBSD for a while without any success and wondered if anyone familiar with serial port programming could suggest what I might need to change to get it working...

The program compiles without any problem, but won't write to the serial port. I believe it uses standard C code rather than any Linuxisms so in theory it should be platform independent, although there might possibly be something in the header file - kwbimage.h which is not compatible between Linux and FreeBSD.

I use the following to build kwboot:-

wget https://github.com/LeMaker/u-boot/raw/master/tools/kwboot.c
wget https://github.com/LeMaker/u-boot/raw/master/tools/kwbimage.h
gcc -o kwboot kwboot.c
Re: kwboot
June 20, 2018 03:35AM
balanga,

kwboot has nothing to do with Linux or FreeBSD. These kernels do not come in to play until later.

The ARM boxes such as these Kirkwood plugs power on sequence is:

- Power on
- BootROM starts
- BootROM senses the serial port for a special handshake sequence, and if sucessful, starts receiving uboot image from the serial port using xmodem protocol.
- After bootROM has received the complete uboot image, it starts running uboot.
- The above sequence is the same always, regardless of what kernel you will boot later.


The special handshake sequence is a series of bytes sent by kwboot from another box, where you run kwboot.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: kwboot
June 20, 2018 04:00AM
bodhi Wrote:
-------------------------------------------------------
> balanga,
>
> - BootROM starts
> - BootROM senses the serial port for a special
> handshake sequence, and if sucessful, starts
> receiving uboot image from the serial port using
> xmodem protocol.
>
> The special handshake sequence is a series of
> bytes sent by kwboot from another box, where you
> run kwboot.

This 'special handshake sequence' seems to be the problem. My FreeBSD compiled kwboot seems to be incapable of sending it successfully.

cu and minicom both work fine on FreeBSD so I know there is nothing wrong with the serial connection.
Re: kwboot
June 20, 2018 06:38PM
balanga Wrote:
-------------------------------------------------------
> bodhi Wrote:
> -------------------------------------------------------
> > balanga,
> >
> > - BootROM starts
> > - BootROM senses the serial port for a special
> > handshake sequence, and if sucessful, starts
> > receiving uboot image from the serial port
> using
> > xmodem protocol.
> >
> > The special handshake sequence is a series of
> > bytes sent by kwboot from another box, where
> you
> > run kwboot.
>
> This 'special handshake sequence' seems to be the
> problem. My FreeBSD compiled kwboot seems to be
> incapable of sending it successfully.
>
> cu and minicom both work fine on FreeBSD so I know
> there is nothing wrong with the serial connection.

Please post the log your attempt to connect with kwboot.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: kwboot
June 21, 2018 12:55AM
bodhi Wrote:
-------------------------------------------------------
> > cu and minicom both work fine on FreeBSD so I
> know
> > there is nothing wrong with the serial
> connection.
>
> Please post the log your attempt to connect with
> kwboot.


It simply stops with the prompt:-

Please reboot the target into UART boot mode.../

Switching the dock on has no effect. I've tried many many times. On Debian it just works as it should, so I'm guessing there must be something in the code which does not work on FreeBSD.
Re: kwboot
June 21, 2018 01:08AM
balanga,

> >
> > Please post the log your attempt to connect
> with
> > kwboot.
>
>
> It simply stops with the prompt:-
>
> Please reboot the target into UART boot
> mode.../

>

That's not a log! When I ask for a log, please post it. That's how we save time going back and forth. I want to see the log for every question, if possible. This is a technical forum format, not IRC! I usually can only answer questions daily, but not hourly.

Look at the date of the kwboot.c code to see how old it is. Perhaps it is really old. You might want to get it from my u-boot GitHub, as a minimum. Or get it from the latest u-boot GitHub (master branch or tag).
./tools/kwboot.c

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: kwboot
June 21, 2018 01:57AM
There is no log as such, I only ran kwboot from the command line...
./kwboot -t -B 115200 /dev/cuaU0 -b uboot.2017.05-tld-2.goflexhome.mtd0.kwb -p

just as I do on Debian except it transfers the image under Debian but just waits under FreeBSD.

I built kwboot using:-
wget https://github.com/LeMaker/u-boot/raw/master/tools/kwboot.c
wget https://github.com/LeMaker/u-boot/raw/master/tools/kwbimage.h
gcc -o kwboot kwboot.c

I see from you GitHub that these files have been updated, but I am unable to build kwboot because a number headers such as <compiler.h> <image.h> etc are not avaiable.
Re: kwboot
June 21, 2018 03:58AM
balanga,

> There is no log as such

The log is what you see on your terminal, verbatim, ie. copy/paste.

In a troubleshooting session, I want to see what you see, not what you think you see. Because it is often misleading.

I would like to avoid misunterstanding the problem from your interpretation. I want to see exactly what you see on the screen. Even if nothing happened when you execute a command. Just post that log (copy/paste what on the screen) and then say "nothing came out" after this.

So after all you have said above, I'm still not sure I understood 100% what's your problem was.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: kwboot
June 22, 2018 04:43AM
I'm trying to run kwboot through the gdb degugger and would like to identify the exact point at which it stops. I was not previously aware of this special handshake sequence which I presume is not getting sent or acknowledged..

I'm not much of a programmer so have not been able to locate this handshake. It does not appear to be documented in the code. Any clues about finding it would be appreciated...
Re: kwboot
June 22, 2018 03:43PM
balanga,

Quote

I'm trying to run kwboot through the gdb degugger and would like to identify the exact point at which it stops. I was not previously aware of this special handshake sequence which I presume is not getting sent or acknowledged..

You are really wasting time doing this. We knew that your GF Home can be kwboot using another Linux box. And kwboot works the same way in any *nix system. So the setup on your FreeBSD probably has problem.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: kwboot
June 23, 2018 12:59AM
If you are trying to build kwboot your are going about all wrong. First clone bodhi's GitHub repository:

# git clone https://github.com/mibodhi/u-boot-kirkwood.git

Then run the following steps:
# cd u-boot-kirkwood.git
# cp configs/pogo_v4_defconfig .config
# make oldconfig
# make tools-only

When this completes kwboot will be in the u-boot-kirkwood/tools directory.

Ray
Re: kwboot
June 25, 2018 01:31AM
rayknight Wrote:
-------------------------------------------------------
> If you are trying to build kwboot your are going
> about all wrong. First clone bodhi's GitHub
> repository:
>
> # git clone
> https://github.com/mibodhi/u-boot-kirkwood.git
>
> Then run the following steps:
> # cd u-boot-kirkwood.git
> # cp configs/pogo_v4_defconfig .config
> # make oldconfig
> # make tools-only
>
> When this completes kwboot will be in the
> u-boot-kirkwood/tools directory.
>
> Ray

Many thanks for the help. Just a little query... What should be the cwd when I run make? Is there a typo in the first step?
I don't have a u-boot-kirkwood.git directory. Did you mean cd u-boot-kirkwood/.git ? There is no Makefile there so I wouldn't expect make to work.
Re: kwboot
June 25, 2018 02:07AM
That's a typo. It should be:

# cd u-boot-kirkwood

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: kwboot
June 25, 2018 03:10AM
bodhi Wrote:
-------------------------------------------------------
> That's a typo. It should be:
>
>
> # cd u-boot-kirkwood
>

Thanks.

Just wondered if I need to run make using a specific shell, since I get a few hundred errors when running 'make oldconfig'...

Most of the errors are of the form:-

Need an operator
eg
unexport LC_ALL

Variable/Value missing from "export"
eg
export LC_COLLATE LC_NUMERIC

Missing dependency operator
eg
ifeq ("$(origin V)", "command line")

I'm running this under FreeBSD, so assuming the Makefile is Posix compliant I would have thought it should work. Do I need to run this under bash or some other specific shell or is there some step I've missed out?
Re: kwboot
June 25, 2018 03:46AM
> Just wondered if I need to run make using a
> specific shell, since I get a few hundred errors
> when running 'make oldconfig'...

Remember this is Linux source tree. I don't know what adjustment you'd need for FreeBSD.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: kwboot
June 25, 2018 06:38AM
bodhi Wrote:
-------------------------------------------------------
> > Just wondered if I need to run make using a
> > specific shell, since I get a few hundred
> errors
> > when running 'make oldconfig'...
>
> Remember this is Linux source tree. I don't know
> what adjustment you'd need for FreeBSD.

It turns out to be quite simple - I need to use GNU make, ie gmake instead of FreeBSD's make.
Re: kwboot
June 25, 2018 06:43AM
rayknight Wrote:
-------------------------------------------------------
> # cp configs/pogo_v4_defconfig .config
> # make oldconfig

> Ray

This seems to generate a million questions and I don't know what to answer to any of them. Is there a means of automatically accepting the defaults?
Re: kwboot
July 26, 2018 11:05AM
Trying again a month later....

cd /tmp
git clone https://github.com/mibodhi/u-boot-kirkwood.git 
cd u-boot-kirkwood 
cp configs/pogo_v4_defconfig .config 
gmake oldconfig

Then prompt for Architecture select with a choice of [1-12] with a pointer (>) at 9. Sandbox (SANDBOX) (NEW) and I'm not sure whether to choose (2) for ARM or (11) x86. because I don't really know whether the target is the device I want to put U-Boot on or the system I want to run kwboot on...

I selected (2) then a question about ARM_SMCCC, SEMIHOSTING, L2cache,BOO0_HOOK, ARM64_SUPPORT, then I have to choose from 95 options, none of which I understand. the a further 100 questions, none of whch I understood either.

After several minutes of pressing enter a configuration was written to .config.

I guess I must have done something wrong.



Edited 2 time(s). Last edit at 07/26/2018 01:45PM by balanga.
Re: kwboot
August 01, 2018 12:26AM
Re: kwboot
August 01, 2018 03:59AM
Hi syong,

Welcome back to the forum:)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: kwboot
August 02, 2018 05:55AM
syong Wrote:
-------------------------------------------------------
> @balanga,
>
> Try this:
>
> https://forum.doozan.com/read.php?3,26098,26811#msg-26811


@syong,

Thanks for the pointer. It looks like someone has this working on NetBSD so I'd expect it to work on FreeBSD.

Can you give me a step by step guide to getting it compiled - I'm not much of a programmer really.

I was hoping to simply run 'git clone' and then 'make' but it seems much more complicated than that.
Re: kwboot
August 12, 2018 06:20PM
Not seeming to make any progress.... Looking on Github there is the u-boot git - https://github.com/u-boot/u-boot which contains kwboot under tools, but I can't figure out where to get started. I only want to build kwboot. Any clues would be appreciated.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: