···11+/***************************************************************************
22+ * __________ __ ___.
33+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
44+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
55+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
66+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
77+ * \/ \/ \/ \/ \/
88+ * $Id$
99+ *
1010+ * Copyright (C) 2021 Aidan MacDonald
1111+ *
1212+ * This program is free software; you can redistribute it and/or
1313+ * modify it under the terms of the GNU General Public License
1414+ * as published by the Free Software Foundation; either version 2
1515+ * of the License, or (at your option) any later version.
1616+ *
1717+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
1818+ * KIND, either express or implied.
1919+ *
2020+ ****************************************************************************/
2121+2222+#ifndef __INSTALLER_X1000_H__
2323+#define __INSTALLER_X1000_H__
2424+2525+/* This API is for the bootloader recovery menu and Rockbox utility to handle
2626+ * bootloader installation, backup, and restore.
2727+ *
2828+ * Currently the installer can only handle NAND flash, although the X1000 can
2929+ * boot from NOR flash or SD/MMC. Support for other storage media can be added
3030+ * when there is a target that needs it.
3131+ *
3232+ * Bootloader updates are tarballs, and they can "monkey patch" the flash in
3333+ * a customizable way (but fixed at compile time).
3434+ *
3535+ * Backup and restore simply takes the range of eraseblocks touched by the
3636+ * monkey patch and copies them to or from a regular file.
3737+ */
3838+3939+enum {
4040+ IERR_SUCCESS = 0,
4141+ IERR_OUT_OF_MEMORY,
4242+ IERR_FILE_NOT_FOUND,
4343+ IERR_FILE_IO,
4444+ IERR_BAD_FORMAT,
4545+ IERR_NAND_OPEN,
4646+ IERR_NAND_READ,
4747+ IERR_NAND_WRITE,
4848+};
4949+5050+extern int install_bootloader(const char* filename);
5151+extern int backup_bootloader(const char* filename);
5252+extern int restore_bootloader(const char* filename);
5353+extern const char* installer_strerror(int rc);
5454+5555+#endif /* __INSTALLER_X1000_H__ */