summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Larsen <Chris.Larsen@imgtec.com>2014-09-16 02:56:39 +0400
committerMatt Redfearn <matt.redfearn@imgtec.com>2015-08-26 11:50:44 +0300
commitc993210476acb3855a49f78496f22cbc94f6c4b2 (patch)
tree24b86377c401be031603ca2b791b377bd03a6587
parentde2e956201b97a34610f6f2a4f2b7f509e6bd99b (diff)
downloadCI20_u-boot-c993210476acb3855a49f78496f22cbc94f6c4b2.tar.xz
Add boota (Android boot command) to U-Boot.
- boota takes the memory address of the image to be loaded (in hex).
-rw-r--r--arch/mips/lib/bootm.c89
-rw-r--r--common/Makefile1
-rwxr-xr-xcommon/cmd_boota.c111
-rw-r--r--include/command.h3
-rw-r--r--include/configs/ci20.h1
-rw-r--r--include/fastboot.h339
6 files changed, 544 insertions, 0 deletions
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 66340ea47..985f6d06e 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -248,3 +248,92 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
/* does not return */
return 1;
}
+
+#ifdef CONFIG_CMD_BOOTA
+
+// I really wanted to put all this code into a separate
+// arch/mips/lib/boota.c file but do_boota_linux() uses too much of the
+// same code used by do_bootm_linux() and all (most?) of the utility
+// routines are local to this file so do_boota_linux() ended up here.
+
+#include <fastboot.h>
+
+extern void flush_cache_all(void);
+
+// TODO: This is a bunch of cruft from X-Boot. All these things
+// should be replaced with either U-Boot definitions, or the values
+// should be calculated at run time. I suspect that the correct place
+// to get this stuff from is the boot.img header.
+//
+// In the case of CFG_KERNEL_DST, it seems that the corresponding
+// address from the the uImage file used to build boot.img is
+// 0x80010000:
+//
+// $ file uImage
+// uImage: u-boot legacy uImage, Linux-3.0.8-gb006f40, Linux/MIPS,
+// OS Kernel Image (gzip), 3762679 bytes, Thu Aug 7 16:22:16 2014,
+// Load Address: 0x80010000, Entry Point: 0x805FF400,
+// Header CRC: 0xC31FEAAA, Data CRC: 0xABB89D18
+//
+// Don't yet have a guess about what should replace CFG_RAMDISK_DST.
+#define CFG_KERNEL_DST 0x80f00000 /* Load Linux kernel to this addr */
+#define CFG_RAMDISK_DST 0x81a00000 /* initrd address */
+
+bootm_headers_t images; /* pointers to os/initrd/fdt images */
+
+void do_boota_linux(bootm_headers_t * images, const char *addr,
+ struct fastboot_boot_img_hdr *fb_hdr)
+{
+ unsigned page_mask;
+ unsigned kernel_actual;
+ unsigned ramdisk_actual;
+ char initrd_param[64];
+ char cmdline[256];
+ void (*kernel) (int, char **, char **, ulong);
+
+ /* init kernel, ramdisk and prepare parameters */
+ page_mask = fb_hdr->page_size - 1;
+ kernel_actual = (fb_hdr->kernel_size + page_mask) & (~page_mask);
+ ramdisk_actual = (fb_hdr->ramdisk_size + page_mask) & (~page_mask);
+ fb_hdr->kernel_addr = (unsigned int)(addr + fb_hdr->page_size);
+ fb_hdr->ramdisk_addr = fb_hdr->kernel_addr + kernel_actual;
+
+#ifdef DEBUG
+ printf(" page_mask: 0x%x\n", page_mask);
+ printf(" kernel size: 0x%x\n", kernel_actual);
+ printf(" kernel address: 0x%x\n", fb_hdr->kernel_addr);
+ printf(" ramdisk size: 0x%x\n", ramdisk_actual);
+ printf("ramdisk address: 0x%x\n", fb_hdr->ramdisk_addr);
+#endif /* DEBUG */
+
+ memcpy((char *)CFG_KERNEL_DST, (char *)fb_hdr->kernel_addr,
+ fb_hdr->kernel_size);
+
+ memcpy((char *)CFG_RAMDISK_DST, (char *)fb_hdr->ramdisk_addr,
+ fb_hdr->ramdisk_size);
+
+ sprintf(initrd_param, " rd_start=0x%X rd_size=0x%X",
+ CFG_RAMDISK_DST, fb_hdr->ramdisk_size);
+#ifdef DEBUG
+ printf("initrd_param: \"%s\"\n", initrd_param);
+#endif /* DEBUG */
+
+ boot_cmdline_linux(NULL);
+ // TODO: These extra lines are being added to support old
+ // kernels which expect these two parameters to be included
+ // on the command line.
+ sprintf(cmdline, "rd_start=0x%X", CFG_RAMDISK_DST);
+ linux_cmdline_set(cmdline, strlen(cmdline));
+ sprintf(cmdline, "rd_size=0x%X", fb_hdr->ramdisk_size);
+ linux_cmdline_set(cmdline, strlen(cmdline));
+
+ boot_prep_linux(images);
+
+ kernel = (void (*)(int, char **, char **))CFG_KERNEL_DST;
+
+ // TODO: Replace with boot_jump_linux(images)?
+ flush_cache_all();
+ (*kernel) (linux_argc, linux_argv, linux_env, 0ul);
+}
+
+#endif /* CONFIG_CMD_BOOTA */
diff --git a/common/Makefile b/common/Makefile
index 288690bca..d899559d9 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -27,6 +27,7 @@ COBJS-$(CONFIG_SYS_GENERIC_BOARD) += board_r.o
# core command
COBJS-y += cmd_boot.o
COBJS-$(CONFIG_CMD_BOOTM) += cmd_bootm.o
+COBJS-$(CONFIG_CMD_BOOTA) += cmd_boota.o
COBJS-y += cmd_help.o
COBJS-y += cmd_version.o
diff --git a/common/cmd_boota.c b/common/cmd_boota.c
new file mode 100755
index 000000000..83b09cc8e
--- /dev/null
+++ b/common/cmd_boota.c
@@ -0,0 +1,111 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * Boot an image which is generated by android mkbootimg tool
+ *
+ * (C) Copyright 2000-2003
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * Misc boot support
+ */
+#include <common.h>
+#include <command.h>
+#include <net.h>
+
+#ifdef CONFIG_CMD_BOOTA
+DECLARE_GLOBAL_DATA_PTR;
+
+#include <fastboot.h>
+
+void do_boota_linux(bootm_headers_t *, const char *,
+ struct fastboot_boot_img_hdr *);
+
+/*
+ * If everything is successful, this function will never return because
+ * the kernel was launched. Even if control never returns, the kernel
+ * may have other failures which keep the system from coming up fully.
+ */
+int do_boota(cmd_tbl_t * cmdtp, int flag, int argc, char *const argv[])
+{
+ ulong addr;
+
+ if (argc < 2)
+ return cmd_usage(cmdtp);
+
+ addr = simple_strtoul(argv[1], NULL, 16);
+
+ // This logic stolen from init_boot_linux() in
+ // boot/usb/jz4780_poll.c from the X-Boot code for urboard.
+ struct fastboot_boot_img_hdr fb_hdr;
+ memcpy(&fb_hdr, (struct fastboot_boot_img_hdr *)addr,
+ sizeof(struct fastboot_boot_img_hdr));
+
+ if (memcmp(fb_hdr.magic, FASTBOOT_BOOT_MAGIC, 8)) {
+ puts("boota: bad boot image magic, maybe not a boot.img?\n");
+ return 1;
+ }
+#ifdef DEBUG
+ printf("---------------------\n");
+ printf("kernel_size: 0x%x\n", fb_hdr.kernel_size);
+ printf("kernel_addr: 0x%x\n\n", fb_hdr.kernel_addr);
+
+ printf("ramdisk_size: 0x%x\n", fb_hdr.ramdisk_size);
+ printf("ramdisk_addr: 0x%x\n\n", fb_hdr.ramdisk_addr);
+
+ printf("second_size: 0x%x\n", fb_hdr.second_size);
+ printf("second_addr: 0x%x\n\n", fb_hdr.second_addr);
+
+ printf("tags_addr: 0x%x\n\n", fb_hdr.tags_addr);
+
+ printf("page_size: 0x%x\n\n", fb_hdr.page_size);
+
+ if (fb_hdr.unused[0] || fb_hdr.unused[1]) {
+ printf("***** ERROR unused: 0x%x 0x%x\n",
+ fb_hdr.unused[0], fb_hdr.unused[1]);
+ return 1;
+ }
+
+ printf("name: \"%s\"\n\n", fb_hdr.name);
+
+ printf("cmdline: \"%s\"\n", fb_hdr.cmdline);
+#endif /* DEBUG */
+
+ // TODO: Need to incorporate more code from do_bootm() to
+ // initialize 'images'. Eventually, I expect the call to
+ // do_boota_linx() to mirror the call to do_bootm_linux().
+
+ /* init kernel, ramdisk and prepare parameters */
+ do_boota_linux(&images, (char *)addr, &fb_hdr);
+
+ printf("%s, %d: We should not come here ... \n", __FILE__, __LINE__);
+
+ return 0;
+}
+
+U_BOOT_CMD(boota, 2, 1, do_boota,
+ "boota - boot android bootimg from memory",
+ "<addr>\n - boot application image stored in memory\n"
+ "\t'addr' should be the address of boot image which is kernel+ramdisk.img\n");
+#endif
diff --git a/include/command.h b/include/command.h
index f782779d8..5ad6719ad 100644
--- a/include/command.h
+++ b/include/command.h
@@ -93,6 +93,9 @@ static inline int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
return 0;
}
#endif
+#ifdef CONFIG_CMD_BOOTA
+extern int do_boota(cmd_tbl_t * cmdtp, int flag, int argc, char *const argv[]);
+#endif
extern int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
diff --git a/include/configs/ci20.h b/include/configs/ci20.h
index a1c292bb4..6acf416df 100644
--- a/include/configs/ci20.h
+++ b/include/configs/ci20.h
@@ -190,6 +190,7 @@
*/
#define CONFIG_CMD_BDI /* bdinfo */
#define CONFIG_CMD_BOOTD /* bootd */
+#define CONFIG_CMD_BOOTA /* boota */
#define CONFIG_CMD_CONSOLE /* coninfo */
#define CONFIG_CMD_DHCP /* DHCP support */
#define CONFIG_CMD_ECHO /* echo arguments */
diff --git a/include/fastboot.h b/include/fastboot.h
new file mode 100644
index 000000000..2e9408f04
--- /dev/null
+++ b/include/fastboot.h
@@ -0,0 +1,339 @@
+/*
+ * (C) Copyright 2008 - 2009
+ * Windriver, <www.windriver.com>
+ * Tom Rix <Tom.Rix@windriver.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * The logical naming of flash comes from the Android project
+ * Thse structures and functions that look like fastboot_flash_*
+ * They come from bootloader/legacy/include/boot/flash.h
+ *
+ * The boot_img_hdr structure and associated magic numbers also
+ * come from the Android project. They are from
+ * system/core/mkbootimg/bootimg.h
+ *
+ * Here are their copyrights
+ *
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef FASTBOOT_H
+#define FASTBOOT_H
+
+#include <common.h>
+#include <command.h>
+
+/* This is the interface file between the common cmd_fastboot.c and
+ the board specific support.
+
+ To use this interface, define CONFIG_FASTBOOT in your board config file.
+ An example is include/configs/omap3430labrador.h
+ ...
+ #define CONFIG_FASTBOOT 1 / * Using fastboot interface * /
+ ...
+
+ An example of the board specific spupport for omap3 is found at
+ cpu/omap3/fastboot.c
+
+*/
+
+/* From fastboot client.. */
+#define FASTBOOT_INTERFACE_CLASS 0xff
+#define FASTBOOT_INTERFACE_SUB_CLASS 0x42
+#define FASTBOOT_INTERFACE_PROTOCOL 0x03
+
+#define FASTBOOT_VERSION "0.5"
+
+/* The fastboot client uses a value of 2048 for the
+ page size of it boot.img file format.
+ Reset this in your board config file as needed. */
+#ifndef CFG_FASTBOOT_MKBOOTIMAGE_PAGE_SIZE
+#define CFG_FASTBOOT_MKBOOTIMAGE_PAGE_SIZE 2048
+#endif
+
+struct cmd_fastboot_interface {
+ /* This function is called when a buffer has been
+ recieved from the client app.
+ The buffer is a supplied by the board layer and must be unmodified.
+ The buffer_size is how much data is passed in.
+ Returns 0 on success
+ Returns 1 on failure
+
+ Set by cmd_fastboot */
+ int (*rx_handler) (const unsigned char *buffer,
+ unsigned int buffer_size);
+
+ /* This function is called when an exception has
+ occurred in the device code and the state
+ off fastboot needs to be reset
+
+ Set by cmd_fastboot */
+ void (*reset_handler) (void);
+
+ /* A getvar string for the product name
+ It can have a maximum of 60 characters
+
+ Set by board */
+ char *product_name;
+
+ /* A getvar string for the serial number
+ It can have a maximum of 60 characters
+
+ Set by board */
+ char *serial_no;
+
+ /* Nand block size
+ Supports the write option WRITE_NEXT_GOOD_BLOCK
+
+ Set by board */
+ unsigned int nand_block_size;
+
+ /* Nand oob size
+ Set by board */
+ unsigned int nand_oob_size;
+
+ /* Transfer buffer, for handling flash updates
+ Should be multiple of the nand_block_size
+ Care should be take so it does not overrun bootloader memory
+ Controlled by the configure variable CFG_FASTBOOT_TRANSFER_BUFFER
+
+ Set by board */
+ unsigned char *transfer_buffer;
+
+ /* How big is the transfer buffer
+ Controlled by the configure variable
+ CFG_FASTBOOT_TRANSFER_BUFFER_SIZE
+
+ Set by board */
+ unsigned int transfer_buffer_size;
+
+};
+
+/* Android-style flash naming */
+typedef struct fastboot_ptentry fastboot_ptentry;
+
+/* flash partitions are defined in terms of blocks
+** (flash erase units)
+*/
+struct fastboot_ptentry {
+ /* The logical name for this partition, null terminated */
+ char name[16];
+ /* The start wrt the nand part, must be multiple of nand block size */
+ unsigned int start;
+ /* The length of the partition, must be multiple of nand block size */
+ unsigned int length;
+ /* Controls the details of how operations are done on the partition
+ See the FASTBOOT_PTENTRY_FLAGS_*'s defined below */
+ unsigned int flags;
+};
+
+/* Lower byte shows if the read/write/erase operation in
+ repeated. The base address is incremented.
+ Either 0 or 1 is ok for a default */
+
+#define FASTBOOT_PTENTRY_FLAGS_REPEAT(n) (n & 0x0f)
+#define FASTBOOT_PTENTRY_FLAGS_REPEAT_MASK 0x0000000F
+
+/* Writes happen a block at a time.
+ If the write fails, go to next block
+ NEXT_GOOD_BLOCK and CONTIGOUS_BLOCK can not both be set */
+#define FASTBOOT_PTENTRY_FLAGS_WRITE_NEXT_GOOD_BLOCK 0x00000010
+
+/* Find a contiguous block big enough for a the whole file
+ NEXT_GOOD_BLOCK and CONTIGOUS_BLOCK can not both be set */
+#define FASTBOOT_PTENTRY_FLAGS_WRITE_CONTIGUOUS_BLOCK 0x00000020
+
+/* Sets the ECC to hardware before writing
+ HW and SW ECC should not both be set. */
+#define FASTBOOT_PTENTRY_FLAGS_WRITE_HW_ECC 0x00000040
+
+/* Sets the ECC to software before writing
+ HW and SW ECC should not both be set. */
+#define FASTBOOT_PTENTRY_FLAGS_WRITE_SW_ECC 0x00000080
+
+/* Write the file with write.i */
+#define FASTBOOT_PTENTRY_FLAGS_WRITE_I 0x00000100
+
+/* Write the file with write.yaffs */
+#define FASTBOOT_PTENTRY_FLAGS_WRITE_YAFFS 0x00000200
+
+/* Write the file as a series of variable/value pairs
+ using the setenv and saveenv commands */
+#define FASTBOOT_PTENTRY_FLAGS_WRITE_ENV 0x00000400
+
+/* Status values */
+#define FASTBOOT_OK 0
+#define FASTBOOT_ERROR -1
+#define FASTBOOT_DISCONNECT 1
+#define FASTBOOT_INACTIVE 2
+
+/* Android bootimage file format */
+#define FASTBOOT_BOOT_MAGIC "ANDROID!"
+#define FASTBOOT_BOOT_MAGIC_SIZE 8
+#define FASTBOOT_BOOT_NAME_SIZE 16
+#define FASTBOOT_BOOT_ARGS_SIZE 512
+
+struct fastboot_boot_img_hdr {
+ unsigned char magic[FASTBOOT_BOOT_MAGIC_SIZE];
+
+ unsigned kernel_size; /* size in bytes */
+ unsigned kernel_addr; /* physical load addr */
+
+ unsigned ramdisk_size; /* size in bytes */
+ unsigned ramdisk_addr; /* physical load addr */
+
+ unsigned second_size; /* size in bytes */
+ unsigned second_addr; /* physical load addr */
+
+ unsigned tags_addr; /* physical addr for kernel tags */
+ unsigned page_size; /* flash page size we assume */
+ unsigned unused[2]; /* future expansion: should be 0 */
+
+ unsigned char name[FASTBOOT_BOOT_NAME_SIZE]; /* asciiz product name */
+
+ unsigned char cmdline[FASTBOOT_BOOT_ARGS_SIZE];
+
+ unsigned id[8]; /* timestamp / checksum / sha1 / etc */
+};
+
+#ifdef CONFIG_FASTBOOT
+/* A board specific test if u-boot should go into the fastboot command
+ ahead of the bootcmd
+ Returns 0 to continue with normal u-boot flow
+ Returns 1 to execute fastboot */
+extern int fastboot_preboot(void);
+
+/* Initizes the board specific fastboot
+ Returns 0 on success
+ Returns 1 on failure */
+extern int fastboot_init(struct cmd_fastboot_interface *interface);
+
+/* Cleans up the board specific fastboot */
+extern void fastboot_shutdown(void);
+
+/*
+ * Handles board specific usb protocol exchanges
+ * Returns 0 on success
+ * Returns 1 on disconnects, break out of loop
+ * Returns 2 if no USB activity detected
+ * Returns -1 on failure, unhandled usb requests and other error conditions
+*/
+extern int fastboot_poll(void);
+
+/* Is this high speed (2.0) or full speed (1.1) ?
+ Returns 0 on full speed
+ Returns 1 on high speed */
+extern int fastboot_is_highspeed(void);
+
+/* Return the size of the fifo */
+extern int fastboot_fifo_size(void);
+
+/* Send a status reply to the client app
+ buffer does not have to be null terminated.
+ buffer_size must be not be larger than what is returned by
+ fastboot_fifo_size
+ Returns 0 on success
+ Returns 1 on failure */
+extern int fastboot_tx_status(const char *buffer, unsigned int buffer_size);
+
+/*
+ * Send some data to the client app
+ * buffer does not have to be null terminated.
+ * buffer_size can be larger than what is returned by
+ * fastboot_fifo_size
+ * Returns number of bytes written
+ */
+extern int fastboot_tx(unsigned char *buffer, unsigned int buffer_size);
+
+/* A board specific variable handler.
+ The size of the buffers is governed by the fastboot spec.
+ rx_buffer is at most 57 bytes
+ tx_buffer is at most 60 bytes
+ Returns 0 on success
+ Returns 1 on failure */
+extern int fastboot_getvar(const char *rx_buffer, char *tx_buffer);
+
+/* The Android-style flash handling */
+
+/* tools to populate and query the partition table */
+extern void fastboot_flash_add_ptn(fastboot_ptentry * ptn);
+extern fastboot_ptentry *fastboot_flash_find_ptn(const char *name);
+extern fastboot_ptentry *fastboot_flash_get_ptn(unsigned n);
+extern unsigned int fastboot_flash_get_ptn_count(void);
+extern void fastboot_flash_dump_ptn(void);
+
+extern int fastboot_flash_init(void);
+extern int fastboot_flash_erase(fastboot_ptentry * ptn);
+extern int fastboot_flash_read_ext(fastboot_ptentry * ptn,
+ unsigned extra_per_page, unsigned offset,
+ void *data, unsigned bytes);
+#define fastboot_flash_read(ptn, offset, data, bytes) \
+ flash_read_ext(ptn, 0, offset, data, bytes)
+extern int fastboot_flash_write(fastboot_ptentry * ptn, unsigned extra_per_page,
+ const void *data, unsigned bytes);
+
+#else
+
+/* Stubs for when CONFIG_FASTBOOT is not defined */
+#define fastboot_preboot() 0
+#define fastboot_init(a) 1
+#define fastboot_shutdown()
+#define fastboot_poll() 1
+#define fastboot_is_highspeed() 0
+#define fastboot_fifo_size() 0
+#define fastboot_tx_status(a, b) 1
+#define fastboot_getvar(a,b) 1
+#define fastboot_tx(a, b) 1
+
+#define fastboot_flash_add_ptn(a)
+#define fastboot_flash_find_ptn(a) NULL
+#define fastboot_flash_get_ptn(a) NULL
+#define fastboot_flash_get_ptn_count() 0
+#define fastboot_flash_dump_ptn()
+#define fastboot_flash_init()
+#define fastboot_flash_erase(a) 1
+#define fastboot_flash_read_ext(a, b, c, d, e) 0
+#define fastboot_flash_read(a, b, c, d, e) 0
+#define fastboot_flash_write(a, b, c, d) 0
+
+#endif /* CONFIG_FASTBOOT */
+#endif /* FASTBOOT_H */