Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
magic-lantern
magic-lantern
Commits
36a718cba670
Commit
703acb10
authored
Dec 06, 2009
by
hudson@kremvax.wan
Browse files
Found cf_device and use it to re-write CF bootblock to create a "BOOTDISK"
parent
2b803823a36a
Changes
2
Hide whitespace changes
Inline
Side-by-side
bootflags.c
View file @
36a718cb
...
...
@@ -6,6 +6,31 @@
#include "menu.h"
#include "config.h"
/* CF device structure */
struct
cf_device
{
// If block has the top bit set the physical blocks will be read
// instead of from the first partition. Cool.
int
(
*
read_block
)(
struct
cf_device
*
dev
,
uintptr_t
block
,
size_t
num_blocks
,
void
*
buf
);
int
(
*
write_block
)(
struct
cf_device
*
dev
,
uintptr_t
block
,
size_t
num_blocks
,
const
void
*
buf
);
void
*
io_control
;
void
*
soft_reset
;
};
extern
struct
cf_device
*
const
cf_device
;
/** Shadow copy of the NVRAM boot flags stored at 0xF8000000 */
#define NVRAM_BOOTFLAGS ((void*) 0xF8000000)
...
...
@@ -54,14 +79,45 @@ bootflag_display(
}
// gcc mempcy has odd alignment issues?
static
inline
void
my_memcpy
(
uint8_t
*
dest
,
const
uint8_t
*
src
,
size_t
len
)
{
while
(
len
--
>
0
)
*
dest
++
=
*
src
++
;
}
void
bootflag_write_bootblock
(
void
)
{
gui_stop_menu
();
//bmp_printf( FONT_LARGE, 0, 30, "Not yet" );
bmp_hexdump
(
FONT_MED
,
0
,
30
,
boot_flags
,
sizeof
(
*
boot_flags
)
);
void
*
(
*
AllocateUncacheableMemory
)(
size_t
)
=
(
void
*
)
0xff99b3a8
;
void
(
*
FreeUncacheableMemory
)(
const
void
*
)
=
(
void
*
)
0xff99b3dc
;
uint8_t
*
block
=
AllocateUncacheableMemory
(
0x200
);
bmp_printf
(
FONT_MED
,
0
,
40
,
"mem=%08x read=%08x"
,
block
,
cf_device
->
read_block
);
int
rc
=
cf_device
->
read_block
(
cf_device
,
0x0
,
1
,
block
);
msleep
(
100
);
bmp_printf
(
FONT_MED
,
600
,
40
,
"read=%d"
,
rc
);
bmp_hexdump
(
FONT_SMALL
,
0
,
60
,
block
,
0x100
);
// Update the first partition header to include the magic
// strings
my_memcpy
(
block
+
0x47
,
(
uint8_t
*
)
"EOS_DEVELOP"
,
0xB
);
my_memcpy
(
block
+
0x5C
,
(
uint8_t
*
)
"BOOTDISK"
,
0x8
);
rc
=
cf_device
->
write_block
(
cf_device
,
0x0
,
1
,
block
);
bmp_printf
(
FONT_MED
,
600
,
60
,
"write=%d"
,
rc
);
FreeUncacheableMemory
(
block
);
}
#if 0
void
bootflag_display_all(
...
...
@@ -124,7 +180,7 @@ powersave_toggle( void )
struct
menu_entry
boot_menus
[]
=
{
{
.
display
=
menu_print
,
.
priv
=
"
Show flags
"
,
.
priv
=
"
Write MBR
"
,
.
select
=
bootflag_write_bootblock
,
},
...
...
stubs-5d2.110.S
View file @
36a718cb
...
...
@@ -269,3 +269,6 @@ NSTUB( 0x14B9C, err_battery_ptr )
/**
Look
for
strings
like
%
Y
:
%
m
:
%
d
; they are calls to strftime */
NSTUB
(
0
xFF86A310
,
strftime
)
NSTUB
(
0
xFF86513C
,
LoadCalendarFromRTC
)
/**
Find
fsuGetPart
*/
NSTUB
(
0
x1F4F4
,
cf_device
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment