From a983859291e29e2cfe26df8e00814b546d865b5c Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Mon, 26 Sep 2016 21:22:21 +0100 Subject: imx233: add capability to boot OF or updater instead of Rockbox This commit adds the necessary code in the dualboot stub (bootloader) to let rockbox control the boot process. In particular, rockbox can now choose if the next boot will be normal (boot rockbox or OF on magic key), to OF or to updater. The intents (to be added in follow-up commits) are: 1) Let the user more easily reboot to the OF. On some targets it is not trivial, especially in USB mode. 2) Automatically reboot to updater when the user drop firmware.sb at the root of the drive (currently, the user needs to do that in OF USB mode) 3) Document this OF magic Change-Id: I86df651dec048c318c6a22de74abb8c6b41aa9ad --- firmware/target/arm/imx233/dualboot-imx233.h | 53 ++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 firmware/target/arm/imx233/dualboot-imx233.h (limited to 'firmware/target/arm/imx233/dualboot-imx233.h') diff --git a/firmware/target/arm/imx233/dualboot-imx233.h b/firmware/target/arm/imx233/dualboot-imx233.h new file mode 100644 index 0000000000..59b6b2f93c --- /dev/null +++ b/firmware/target/arm/imx233/dualboot-imx233.h @@ -0,0 +1,53 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright © 2011 by Amaury Pouly + * + * 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef DUALBOOT_IMX233_H +#define DUALBOOT_IMX233_H + +#include "config.h" + +/* IMPORTANT NOTE This file is used by both Rockbox (firmware and bootloader) + * and the dualboot stub. The stub #include this file directly with + * COMPILE_DUALBOOT_STUB defined, so make sure this file is independent and does + * not requires anything from the firmware */ +#ifndef COMPILE_DUALBOOT_STUB +#include "stdint.h" +#endif + +#ifdef HAVE_DUALBOOT_STUB +/* See dualboot-imx233.c for documentation */ + +enum imx233_dualboot_field_t +{ + DUALBOOT_CAP_BOOT, /* boot capability: 1 => BOOT field supports OF and UPDATER */ + DUALBOOT_BOOT, /* boot mode: IMX23_BOOT_x */ +}; + +#define IMX233_BOOT_NORMAL 0 /* boot Rockbox (or OF if magic button) */ +#define IMX233_BOOT_OF 1 /* boot OF */ +#define IMX233_BOOT_UPDATER 2 /* boot updater */ + +/* get field value (or 0 if not present) */ +unsigned imx233_dualboot_get_field(enum imx233_dualboot_field_t field); +/* write field value */ +void imx233_dualboot_set_field(enum imx233_dualboot_field_t field, unsigned val); +#endif /* HAVE_DUALBOOT_STUB */ + +#endif /* DUALBOOT_IMX233_H */ -- cgit v1.2.3