* Add new command 'nanddump' for the console shell
* Avoid dumping non-mtd files because writesize = 0 - Properly close the file when failing * Better doc/pieces documentation
This commit is contained in:
1 parent
c1d909c415
commit
3728cdea31
4 files changed
+88
-2
No files matched your search
@@ -68,3 +68,12 @@ This file tries to collect a bunch of common questions/answers about flashing
|
||||
information of different pieces of the firmware. This can be faked, because
|
||||
you can flash n770 stuff on n800 and viceversa, but it's not recommended
|
||||
because it wouldn't work :)
|
||||
|
||||
|
||||
<b>*) Can I unpack fiasco blobs?</b>
|
||||
|
||||
Actually the fiasco format is not yet supported and not planned in
|
||||
short term. There is no real need for supporting a proprietary
|
||||
format image containing a proprietary system.
|
||||
|
||||
We can just use tarballs containing the desired pieces.
|
||||
+37
@@ -4,3 +4,40 @@ Fiasco firmware pieces
|
||||
The firmware for the maemo devices is composed by a set of pieces containing
|
||||
the required parts to update the whole system following a partition layout
|
||||
defined by NOLO on the internal flash memory.
|
||||
|
||||
Nokia provides a blob packed with a proprietary format called 'FIASCO'. This
|
||||
blob contains the following pieces:
|
||||
|
||||
- omap-nand - only flashable via serial jtag
|
||||
- xloader - first part of nolo
|
||||
- secondary - second part of nolo (usb support and launches kernel)
|
||||
- kernel - the kernel
|
||||
- initfs - initial system that initializes everything and runs rootfs
|
||||
- rootfs - the whole system image
|
||||
|
||||
Some of these pieces are versioned to match board specific features
|
||||
(mostly xloader and secondary ones).
|
||||
|
||||
This format is not supported by 0xFFFF at this moment, but there are no
|
||||
plans for doing it in short term. This is because we only need to flash
|
||||
separated pieces. We can just distribute tarballs containing the pieces
|
||||
and meta information with a whole Free OS for the internet tablets.
|
||||
|
||||
To flash an initfs partition and reboot:
|
||||
|
||||
$ 0xFFFF -p initfs%initfs.jffs2 -R
|
||||
|
||||
The format of the argument is [piece-type] % [file-name] (% [version-string]).
|
||||
|
||||
Pieces can be automatically identified by using the '-I' flag:
|
||||
|
||||
$ 0xFFFF -I initfs.jffs2
|
||||
initfs.jffs2: initfs
|
||||
|
||||
You can dump these pieces from the internal memory of the internet
|
||||
tablet by using the mtd-utils over /dev/mtd* or just running:
|
||||
|
||||
n770$ 0xFFFF -e /media/mmc1
|
||||
|
||||
There is another way for dumping pieces with extra parameters and options,
|
||||
read doc/dumping for more information.
|
||||
+33
-1
@@ -33,11 +33,14 @@ void cmd_exit(char *line)
|
||||
void cmd_help(char *line)
|
||||
{
|
||||
printf("connect connects via usb to nolo\n");
|
||||
printf("reboot reboots remote host\n");
|
||||
printf("info shows info of the remote system\n");
|
||||
printf("linfo shows info of the local system\n");
|
||||
printf("shell opens a shell (/bin/sh)\n");
|
||||
printf("badblocks [dev] checks bad blocks on mtd (/dev/mtd1)\n");
|
||||
printf("dump [dir] dumps the contents of /dev/mtd to dir\n");
|
||||
printf("nanddump [dev] [start] [len] [out] [ignore-badblocks] [ignore-oob]\n");
|
||||
printf(" f.ex: nanddump /dev/mtd0 0x0 0x4000 xloader.bin 1 1\n");
|
||||
printf("exit exits the shell\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
@@ -51,6 +54,24 @@ void cmd_info(char *line)
|
||||
get_rd_flags();
|
||||
}
|
||||
|
||||
void cmd_nanddump(char *line)
|
||||
{
|
||||
char dev[128];
|
||||
int from;
|
||||
int length;
|
||||
char out[128];
|
||||
int ignbb;
|
||||
int ignoob = -1;
|
||||
sscanf(line, "%127s 0x%x 0x%x %127s %d %d", &dev, &from, &length, &out, &ignbb, &ignoob);
|
||||
if (ignoob == -1) {
|
||||
printf("Invalid arguments.\n");
|
||||
printf("nanddump [dev] [start] [len] [out] [ignore-badblocks] [ignore-oob]\n");
|
||||
printf(" f.ex: nanddump /dev/mtd0 0x0 0x4000 xloader.bin 1 1\n");
|
||||
} else {
|
||||
nanddump(dev, from, length, out, ignbb, ignoob);
|
||||
}
|
||||
}
|
||||
|
||||
void cmd_dump(char *line)
|
||||
{
|
||||
if (!line[0]) {
|
||||
@@ -76,12 +97,17 @@ void cmd_connect(char *line)
|
||||
connect_via_usb();
|
||||
}
|
||||
|
||||
void cmd_reboot(char *line)
|
||||
{
|
||||
reboot_board();
|
||||
}
|
||||
|
||||
void cmd_shell(char *line)
|
||||
{
|
||||
system("/bin/sh");
|
||||
}
|
||||
|
||||
#define CMDS 9
|
||||
#define CMDS 11
|
||||
#define IS_CMD(x) !strcmp(console_commands[i].name, x)
|
||||
#define CALL_CMD(x) console_commands[x].callback((char *)line)
|
||||
#define FOREACH_CMD(x) for(x=0;x<CMDS;x++)
|
||||
@@ -93,11 +119,13 @@ struct cmd_t {
|
||||
{ .name = "exit", .callback = &cmd_exit },
|
||||
{ .name = "q", .callback = &cmd_exit },
|
||||
{ .name = "connect", .callback = &cmd_connect },
|
||||
{ .name = "reboot", .callback = &cmd_reboot },
|
||||
{ .name = "badblocks", .callback = &cmd_badblocks},
|
||||
{ .name = "help", .callback = &cmd_help },
|
||||
{ .name = "?", .callback = &cmd_help },
|
||||
{ .name = "info", .callback = &cmd_info },
|
||||
{ .name = "dump", .callback = &cmd_dump },
|
||||
{ .name = "nanddump", .callback = &cmd_nanddump },
|
||||
{ .name = "shell", .callback = &cmd_shell }
|
||||
};
|
||||
|
||||
@@ -125,6 +153,10 @@ int console_prompt()
|
||||
write(1, "0xFFFF> ", 8);
|
||||
line[0] = '\0';
|
||||
fgets(line, 1024, stdin);
|
||||
if (feof(stdin)) {
|
||||
write(1, "\n", 1);
|
||||
break;
|
||||
}
|
||||
if (line[0]) line[strlen(line)-1] = '\0';
|
||||
line[1023] = '\0';
|
||||
} while(console_command(line));
|
||||
|
||||
+9
-1
@@ -124,6 +124,9 @@ int mtd_open(char *file, mtd_info_t *meminfo, int *oobinfochanged,
|
||||
|
||||
int mtd_close(int fd, struct nand_oobinfo *old_oobinfo, int oobinfochanged)
|
||||
{
|
||||
if (fd == -1)
|
||||
return 1;
|
||||
|
||||
/* reset oobinfo */
|
||||
if (oobinfochanged == 1) {
|
||||
if (ioctl (fd, MEMSETOOBSEL, &old_oobinfo) != 0) {
|
||||
@@ -264,6 +267,12 @@ int nanddump(char *mtddev, unsigned long start_addr, unsigned long length, char
|
||||
|
||||
fd = mtd_open(mtddev, &meminfo, &oobinfochanged, &old_oobinfo, &eccstats, flags);
|
||||
|
||||
if (meminfo.writesize == 0) {
|
||||
printf("What the fuck.. this is not an MTD device!\n");
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Read the real oob length */
|
||||
oob.length = meminfo.oobsize;
|
||||
fprintf(stderr, "Block size %u, page size %u, OOB size %u\n",
|
||||
@@ -271,7 +280,6 @@ int nanddump(char *mtddev, unsigned long start_addr, unsigned long length, char
|
||||
fprintf(stderr, "Size %u, flags %u, type 0x%x\n",
|
||||
meminfo.size, meminfo.flags, (int)meminfo.type);
|
||||
|
||||
|
||||
if (flags & M_OMITECC) { // (noecc)
|
||||
switch (ioctl(fd, MTDFILEMODE, (void *) MTD_MODE_RAW)) {
|
||||
case -ENOTTY:
|
||||
|
||||
Reference in new issue
Block a user