mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Markus Pargmann <mpa@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] Documentation: Update USB fastboot section
Date: Fri, 19 Feb 2016 15:01:22 +0100	[thread overview]
Message-ID: <1455890482-28261-1-git-send-email-mpa@pengutronix.de> (raw)

Add some documentation about fastboot 'flash' command and some useful
example how to use it to boot an initrd.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 Documentation/user/usb.rst | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/Documentation/user/usb.rst b/Documentation/user/usb.rst
index 9eb1437135a2..24bb8d8b1fb9 100644
--- a/Documentation/user/usb.rst
+++ b/Documentation/user/usb.rst
@@ -113,6 +113,11 @@ The Fastboot gadget supports the following commands:
 **NOTE** ``fastboot erase`` is not yet implemented. This means flashing MTD partitions
 does not yet work.
 
+``fastboot flash`` additionally supports image types UBI and Barebox. For UBI
+Images and a MTD device as target, ubiformat is called. For a Barebox image
+with an available barebox update handler for the fastboot exported device, the
+barebox_update is called.
+
 The barebox Fastboot gadget supports the following non standard extensions:
 
 - ``fastboot getvar all``
@@ -126,6 +131,53 @@ The barebox Fastboot gadget supports the following non standard extensions:
   command returns successfully when the barebox command was successful and it fails when
   the barebox command fails.
 
+**Example booting kernel/devicetree/initrd with fastboot**
+
+In Barebox start the fastboot gadget:
+
+.. code-block:: sh
+
+  usbgadget -A /kernel(kernel)c,/initrd(initrd)c,/devicetree(devicetree)c
+
+On the host you can use this script to start a kernel with kernel, devicetree
+and initrd:
+
+.. code-block:: sh
+
+  #!/bin/bash
+
+  set -e
+  set -v
+
+  if [ "$#" -lt 3 ]
+  then
+          echo "USAGE: $0 <KERNEL> <DT> <INITRD> [<ARGS>]"
+          exit 0
+  fi
+
+  kernel=$1
+  dt=$2
+  initrd=$3
+
+  shift 3
+
+  fastboot -i 7531 flash kernel $kernel
+  fastboot -i 7531 flash devicetree $dt
+  fastboot -i 7531 flash initrd $initrd
+
+
+  fastboot -i 7531 oem exec 'global linux.bootargs.fa'$ct'=rdinit=/sbin/init'
+  if [ $# -gt 0 ]
+  then
+          ct=1
+          for i in $*
+          do
+                  fastboot -i 7531 oem exec 'global linux.bootargs.fa'$ct'='"\"$i\""
+                  ct=$(($ct + 1))
+          done
+  fi
+  timeout -k 5 3 fastboot -i 7531 oem exec -- bootm -o /devicetree -r /initrd /kernel
+
 USB Composite Multifunction Gadget
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-- 
2.7.0


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

             reply	other threads:[~2016-02-19 14:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-19 14:01 Markus Pargmann [this message]
2016-02-23  7:43 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455890482-28261-1-git-send-email-mpa@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox