mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* i.MX6ul USB serial downloader and Barebox
@ 2019-02-21 10:01 Patrick Schneider
  2019-02-21 10:21 ` Ahmad Fatoum
  2019-02-21 10:41 ` Sascha Hauer
  0 siblings, 2 replies; 9+ messages in thread
From: Patrick Schneider @ 2019-02-21 10:01 UTC (permalink / raw)
  To: barebox

Hi guys,
I'm trying to find out if the following is possible:
In a production environment, there is only the USB connection present, no console access to the device. 
The USB serial downloader mode starts and I am able to load a barebox image to the i.MX6ul RAM. That works either with MFGTools or uuu.
But how to proceed from there? Is there any way to really flash the barebox image and also the rootFS into a onboard NAND over the USB serial downloader mode with barebox in RAM?
All examples, guides and tutorials use u-boot so I'm kinda stuck here.

Thanks and regards,
Patrick

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i.MX6ul USB serial downloader and Barebox
  2019-02-21 10:01 i.MX6ul USB serial downloader and Barebox Patrick Schneider
@ 2019-02-21 10:21 ` Ahmad Fatoum
  2019-02-21 10:41 ` Sascha Hauer
  1 sibling, 0 replies; 9+ messages in thread
From: Ahmad Fatoum @ 2019-02-21 10:21 UTC (permalink / raw)
  To: barebox

Hello Patrick,

On 2/21/19 11:01 AM, Patrick Schneider wrote:
> Hi guys,
> I'm trying to find out if the following is possible:
> In a production environment, there is only the USB connection present, no console access to the device. 
> The USB serial downloader mode starts and I am able to load a barebox image to the i.MX6ul RAM. That works either with MFGTools or uuu.
> But how to proceed from there? Is there any way to really flash the barebox image and also the rootFS into a onboard NAND over the USB serial downloader mode with barebox in RAM?
> All examples, guides and tutorials use u-boot so I'm kinda stuck here.

You can
- configure a barebox update handler in your board's code
- export it as Android Fastboot gadget on that USB port
- configure the environment so the gadget is active by default

that way the flashing sequence is:
- use imx-usb-load to load the barebox
- use fastboot to flash the barebox persistently
- use fastboot to flash the rootfs


Cheers
Ahmad 

> 
> Thanks and regards,
> Patrick
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 


-- 
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-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i.MX6ul USB serial downloader and Barebox
  2019-02-21 10:01 i.MX6ul USB serial downloader and Barebox Patrick Schneider
  2019-02-21 10:21 ` Ahmad Fatoum
@ 2019-02-21 10:41 ` Sascha Hauer
  2019-02-21 12:01   ` AW: " Patrick Schneider
  1 sibling, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2019-02-21 10:41 UTC (permalink / raw)
  To: Patrick Schneider; +Cc: barebox

Hi Patrick,

On Thu, Feb 21, 2019 at 10:01:27AM +0000, Patrick Schneider wrote:
> Hi guys,
> I'm trying to find out if the following is possible: In a production
> environment, there is only the USB connection present, no console
> access to the device.  The USB serial downloader mode starts and I am
> able to load a barebox image to the i.MX6ul RAM. That works either
> with MFGTools or uuu.

I recommend imx-usb-loader which is part of barebox ;)

> But how to proceed from there? Is there any way
> to really flash the barebox image and also the rootFS into a onboard
> NAND over the USB serial downloader mode with barebox in RAM?  All
> examples, guides and tutorials use u-boot so I'm kinda stuck here.

barebox can do fastboot. "usbgagdet -A /dev/mmc0(foo)" will export
/dev/mmc0 as a fastboot partition to the host. Add the -a option and
you'll get a console device on the host.

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-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* AW: i.MX6ul USB serial downloader and Barebox
  2019-02-21 10:41 ` Sascha Hauer
@ 2019-02-21 12:01   ` Patrick Schneider
  2019-02-21 13:31     ` Sascha Hauer
  0 siblings, 1 reply; 9+ messages in thread
From: Patrick Schneider @ 2019-02-21 12:01 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sascha,
thanks for the reply.
It seems that I am lacking something in the usb configuration. I am always getting:

couldn't find an available UDC
usbgadget: No such device

$ fastboot devices -l

Delivers nothing on my windows host side.
Before I proceed, wouldn't it be also possible to just plug a usb-stick and copy rootfs and barebox.bin from there?
Unfortunately

$ usb

Also doesn't recognize my plugged in usb-stick.
The USB port functions normally under linux itself. 

Regards,
Patrick

> Hi Patrick,
> 
> On Thu, Feb 21, 2019 at 10:01:27AM +0000, Patrick Schneider wrote:
> > Hi guys,
> > I'm trying to find out if the following is possible: In a production
> > environment, there is only the USB connection present, no console
> > access to the device.  The USB serial downloader mode starts and I am
> > able to load a barebox image to the i.MX6ul RAM. That works either
> > with MFGTools or uuu.
> 
> I recommend imx-usb-loader which is part of barebox ;)
> 
> > But how to proceed from there? Is there any way to really flash the
> > barebox image and also the rootFS into a onboard NAND over the USB
> > serial downloader mode with barebox in RAM?  All examples, guides and
> > tutorials use u-boot so I'm kinda stuck here.
> 
> barebox can do fastboot. "usbgagdet -A /dev/mmc0(foo)" will export
> /dev/mmc0 as a fastboot partition to the host. Add the -a option and you'll
> get a console device on the host.
> 
> 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-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i.MX6ul USB serial downloader and Barebox
  2019-02-21 12:01   ` AW: " Patrick Schneider
@ 2019-02-21 13:31     ` Sascha Hauer
  2019-02-21 14:30       ` AW: " Patrick Schneider
  0 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2019-02-21 13:31 UTC (permalink / raw)
  To: Patrick Schneider; +Cc: barebox

On Thu, Feb 21, 2019 at 12:01:40PM +0000, Patrick Schneider wrote:
> Hi Sascha,
> thanks for the reply.
> It seems that I am lacking something in the usb configuration. I am always getting:
> 
> couldn't find an available UDC
> usbgadget: No such device

I don't know which hardware you are on, but you may have to enable the
USB controller in the device tree. If otg mode is configured there you
also have to do a "otg.mode=peripheral" to turn the controller into
gadget mode.

> 
> $ fastboot devices -l
> 
> Delivers nothing on my windows host side.
> Before I proceed, wouldn't it be also possible to just plug a usb-stick and copy rootfs and barebox.bin from there?
> Unfortunately
> 
> $ usb
> 
> Also doesn't recognize my plugged in usb-stick.
> The USB port functions normally under linux itself.

If that's the same port as you do fastboot on then you might have to do
a "otg.mode=host" to turn the controller into host mode.

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-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* AW: i.MX6ul USB serial downloader and Barebox
  2019-02-21 13:31     ` Sascha Hauer
@ 2019-02-21 14:30       ` Patrick Schneider
  2019-02-22  7:57         ` Sascha Hauer
  0 siblings, 1 reply; 9+ messages in thread
From: Patrick Schneider @ 2019-02-21 14:30 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sascha,

$ otg.mode=host

Did the trick for me. Now I can flash the nand from usb-stick data on /dev/disk0.0
Works like a charm, thanks!

Regards,
Patrick 

> > Hi Sascha,
> > thanks for the reply.
> > It seems that I am lacking something in the usb configuration. I am always
> getting:
> >
> > couldn't find an available UDC
> > usbgadget: No such device
> 
> I don't know which hardware you are on, but you may have to enable the
> USB controller in the device tree. If otg mode is configured there you also
> have to do a "otg.mode=peripheral" to turn the controller into gadget mode.
> 
> >
> > $ fastboot devices -l
> >
> > Delivers nothing on my windows host side.
> > Before I proceed, wouldn't it be also possible to just plug a usb-stick and
> copy rootfs and barebox.bin from there?
> > Unfortunately
> >
> > $ usb
> >
> > Also doesn't recognize my plugged in usb-stick.
> > The USB port functions normally under linux itself.
> 
> If that's the same port as you do fastboot on then you might have to do a
> "otg.mode=host" to turn the controller into host mode.
> 
> 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-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i.MX6ul USB serial downloader and Barebox
  2019-02-21 14:30       ` AW: " Patrick Schneider
@ 2019-02-22  7:57         ` Sascha Hauer
  2019-02-22  8:12           ` AW: " Patrick Schneider
  0 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2019-02-22  7:57 UTC (permalink / raw)
  To: Patrick Schneider; +Cc: barebox

On Thu, Feb 21, 2019 at 02:30:36PM +0000, Patrick Schneider wrote:
> Hi Sascha,
> 
> $ otg.mode=host
> 
> Did the trick for me. Now I can flash the nand from usb-stick data on /dev/disk0.0
> Works like a charm, thanks!

Well if you like that, try otg.mode=peripheral and
https://www.barebox.org/doc/latest/user/usb.html#usb-gadget-autostart-support
With this you can bootstrap the whole device from the host with a simple
script and no further interaction.

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-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* AW: i.MX6ul USB serial downloader and Barebox
  2019-02-22  7:57         ` Sascha Hauer
@ 2019-02-22  8:12           ` Patrick Schneider
  2019-02-22  8:33             ` Sascha Hauer
  0 siblings, 1 reply; 9+ messages in thread
From: Patrick Schneider @ 2019-02-22  8:12 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi again,
thanks for that suggestion, I'll look into that, because 'no console interaction' would indeed be the preferable way to go here.
But in the production process we also need to burn some ocotp fuses (which we would do by automated console commands atm).
Is it possible to send commands over usb in gadget mode?

Regards,
Patrick

> > Hi Sascha,
> >
> > $ otg.mode=host
> >
> > Did the trick for me. Now I can flash the nand from usb-stick data on
> > /dev/disk0.0 Works like a charm, thanks!
> 
> Well if you like that, try otg.mode=peripheral and
> https://www.barebox.org/doc/latest/user/usb.html#usb-gadget-autostart-
> support
> With this you can bootstrap the whole device from the host with a simple
> script and no further interaction.
> 
> 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-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: i.MX6ul USB serial downloader and Barebox
  2019-02-22  8:12           ` AW: " Patrick Schneider
@ 2019-02-22  8:33             ` Sascha Hauer
  0 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2019-02-22  8:33 UTC (permalink / raw)
  To: Patrick Schneider; +Cc: barebox

On Fri, Feb 22, 2019 at 08:12:49AM +0000, Patrick Schneider wrote:
> Hi again,
> thanks for that suggestion, I'll look into that, because 'no console
> interaction' would indeed be the preferable way to go here.  But in
> the production process we also need to burn some ocotp fuses (which we
> would do by automated console commands atm).  Is it possible to send
> commands over usb in gadget mode?

Yes. One possibility is to use "fastboot oem exec <cmd>". This can be a
bit tricky since the fastboot string length is very limited (64 bytes I
think). The other possibility is to create a multi gadget which also
creates a console. See the global.usbgadget.acm option. With this you
can remote control barebox via a USB serial console. You might want to
look into the labgrid project which integrates all this nicely.

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-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-02-22  8:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21 10:01 i.MX6ul USB serial downloader and Barebox Patrick Schneider
2019-02-21 10:21 ` Ahmad Fatoum
2019-02-21 10:41 ` Sascha Hauer
2019-02-21 12:01   ` AW: " Patrick Schneider
2019-02-21 13:31     ` Sascha Hauer
2019-02-21 14:30       ` AW: " Patrick Schneider
2019-02-22  7:57         ` Sascha Hauer
2019-02-22  8:12           ` AW: " Patrick Schneider
2019-02-22  8:33             ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox