mirror of
https://github.com/fail0verflow/mini.git
synced 2024-11-28 06:04:19 +01:00
add a DEFINE to let the installer write to the boot2 area
This commit is contained in:
parent
09823ee038
commit
7e40961741
9
nand.c
9
nand.c
@ -36,6 +36,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
//#define NAND_DEBUG 1
|
//#define NAND_DEBUG 1
|
||||||
#define NAND_SUPPORT_WRITE 1
|
#define NAND_SUPPORT_WRITE 1
|
||||||
#define NAND_SUPPORT_ERASE 1
|
#define NAND_SUPPORT_ERASE 1
|
||||||
|
#ifdef ALLOW_BOOT2_WRITES
|
||||||
|
#define NAND_MIN_PAGE 0x40
|
||||||
|
#else
|
||||||
|
#define NAND_MIN_PAGE 0x200
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef NAND_DEBUG
|
#ifdef NAND_DEBUG
|
||||||
# include "gecko.h"
|
# include "gecko.h"
|
||||||
@ -201,7 +206,7 @@ void nand_write_page(u32 pageno, void *data, void *ecc) {
|
|||||||
NAND_debug("nand_write_page(%u, %p, %p)\n", pageno, data, ecc);
|
NAND_debug("nand_write_page(%u, %p, %p)\n", pageno, data, ecc);
|
||||||
|
|
||||||
// this is a safety check to prevent you from accidentally wiping out boot1 or boot2.
|
// this is a safety check to prevent you from accidentally wiping out boot1 or boot2.
|
||||||
if ((pageno < 0x200) || (pageno >= NAND_MAX_PAGE)) {
|
if ((pageno < NAND_MIN_PAGE) || (pageno >= NAND_MAX_PAGE)) {
|
||||||
gecko_printf("Error: nand_write to page %d forbidden\n", pageno);
|
gecko_printf("Error: nand_write to page %d forbidden\n", pageno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -222,7 +227,7 @@ void nand_erase_block(u32 pageno) {
|
|||||||
NAND_debug("nand_erase_block(%d)\n", pageno);
|
NAND_debug("nand_erase_block(%d)\n", pageno);
|
||||||
|
|
||||||
// this is a safety check to prevent you from accidentally wiping out boot1 or boot2.
|
// this is a safety check to prevent you from accidentally wiping out boot1 or boot2.
|
||||||
if ((pageno < 0x200) || (pageno >= NAND_MAX_PAGE)) {
|
if ((pageno < NAND_MIN_PAGE) || (pageno >= NAND_MAX_PAGE)) {
|
||||||
gecko_printf("Error: nand_erase to page %d forbidden\n", pageno);
|
gecko_printf("Error: nand_erase to page %d forbidden\n", pageno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user