18 Commits
Author SHA1 Message Date
Pali Rohár bf24ca2345 Release version 0.9 2021-01-05 19:16:39 +01:00
Pali Rohár 5c845a947e usb-device: Specify alternate id for cold flashing 2021-01-05 15:51:10 +01:00
Pali Rohár 673ccaf71d usb-device: Add N900 U-Boot mode (TTY via USB) to device list 2021-01-05 15:32:20 +01:00
Pali Rohár 9bc4b8c26f usb-device: Check that usb device provides required interface/alternate settings 2021-01-05 15:04:31 +01:00
Pali Rohár e6422cf5a2 usb-device: Remove dead usb_set_configuration() code
It is on worng place, must be called prior usb_claim_interface() and currently no device use it.
2021-01-05 14:38:02 +01:00
Pali Rohár a6effa8f62 usb-device: Remove 0x0421/0x3f00 from list
It was some internal Nokia development board with just temporary device id. Not a real RX-34 device.
2021-01-05 13:45:01 +01:00
Pali Rohár e16a79f75e usb-device: Fix interface id for Nokia N9 Sync mode and disable it as it use unsupported ADL protocol 2021-01-05 13:28:29 +01:00
Pali Rohár 93bd73d451 usb-device: Fix iterating over supported list of devices 2021-01-05 12:35:40 +01:00
Pali Rohár 0e5ceffa42 disk: Fix detecting Nokia N9 device 2021-01-05 12:32:34 +01:00
Pali Rohár ca080dd33f usb-device: Add device ids for Nokia N950 and Nokia N9 2020-12-26 01:40:57 +01:00
Pali Rohár 4ae1f13624 usb-device: Fix range or printable characters 2020-11-29 21:56:29 +01:00
Pali Rohár 69a7c2705e usb-device: Fix error message for usb_set_altinterface 2020-11-29 21:55:17 +01:00
Devendranath Thadi 8d053c9074 Travis-ci: added support for ppc64le
Signed-off-by: Devendranath Thadi <devendranath.thadi3@gmail.com>
2020-11-17 09:02:09 +00:00
Pali Rohár f37c2cd7e8 all: Fix delays for all operations 2020-04-25 20:04:51 +02:00
Pali Rohár e94279eecb local: Do not show error message about missing dump files which were skipped 2020-01-15 23:38:29 +01:00
Pali Rohár 52793b733d disk: Check if reading from block device failed 2019-09-30 17:42:16 +02:00
Sevan Janiyan 4bd0a47b22 Rewrap 2019-09-30 00:39:24 +01:00
Sevan Janiyan adeca0dd45 Grammar 2019-09-30 00:38:57 +01:00
19 changed files with 81 additions and 220 deletions

No files matched your search

+4
View File
@@ -2,6 +2,10 @@ sudo: false
language: c
arch:
- AMD64
- ppc64le
compiler:
- gcc
- clang
+13 -13
View File
@@ -10,24 +10,24 @@
_/ ___|_.|__|
'`
0xFFFF is Open Free Fiasco Firmware Flasher for Maemo devices. It support
generating and unpacking FIASCO images on local computer. Useful for editing
Maemo firmware package for future flash. It support via USB flashing any image
type to Maemo device and also \"cold\" flashing which means flashing dead device
with erased bootloader. There is support for booting kernel via USB without
flashing to NAND and also changing configuration of Maemo device (enable/disable
R&D mode, changing HW revision strings, ...).
0xFFFF is the Open Free Fiasco Firmware Flasher for Maemo devices. It supports
generating and unpacking FIASCO images. It is useful for editing Maemo firmware
packages before flashing. It supports flashing via USB any image type to a
Maemo device and also \"cold\" flashing which means flashing dead device with
erased bootloader. There is support for booting kernel via USB without flashing
to NAND and also changing configuration of Maemo device (enable/disable R&D
mode, changing HW revision strings, ...).
0xFFFF is alternative tool to proprietary Nokia flasher-3.5 and fiasco-gen.
0xFFFF generate compatible FIASCO images and also accept FIASCO images generated
by Nokia fiasco-gen.
0xFFFF is an alternative tool to proprietary Nokia flasher-3.5 and fiasco-gen.
0xFFFF generates compatible FIASCO images and also accepts FIASCO images
generated by Nokia fiasco-gen.
Use it with CARE. This is an experimental tool and it can brick your device.
It's not supposed to be stable, so nokia will probably release incompatible
It's not supposed to be stable, so Nokia will probably release incompatible
bootloaders to break this tool. USE IT AT YOUR OWN RISK.
PLEASE. Read carefully all the documentation inside doc/* for more information
before building or using the flasher to avoid questions, problems or so.
PLEASE. Read all the documentation inside doc/* carefully before building or
using the flasher to avoid questions, problems or so.
https://github.com/pali/0xFFFF
+1 -1
View File
@@ -1,4 +1,4 @@
VERSION = 0.8
VERSION = 0.9
PREFIX = /usr/local
# NetBSD stuff
-27
View File
@@ -1,27 +0,0 @@
0xffff (0.8-1) fremantle; urgency=low
* New upstream version
-- Pali Rohár <pali.rohar@gmail.com> Sun, 08 Jul 2018 12:43:42 +0200
0xffff (0.7-1) fremantle; urgency=low
* New upstream version
-- Pali Rohár <pali.rohar@gmail.com> Sun, 25 Dec 2016 11:47:44 +0100
0xffff (0.6.1-1) experimental; urgency=medium
* New upstream release
- Contains a few security related fixes (memory corruptions & leaks)
- Support for -t (filter by type) for -e (dump images)
- reattach kernel driver
- minor fixes
-- Sebastian Reichel <sre@debian.org> Thu, 11 Dec 2014 21:52:53 +0100
0xffff (0.6-1) unstable; urgency=low
* This is new rewritten version of original 0xFFFF 0.5 tool
-- Pali Rohár <pali.rohar@gmail.com> Sun, 07 Apr 2013 15:01:50 +0200
-1
View File
@@ -1 +0,0 @@
7
-89
View File
@@ -1,89 +0,0 @@
Source: 0xffff
Section: user/system
Priority: extra
Maintainer: Pali Rohár <pali.rohar@gmail.com>
Standards-Version: 3.9.8
Build-Depends: debhelper (>= 7),
libusb-dev
Homepage: https://github.com/pali/0xFFFF
Vcs-Git: https://github.com/pali/0xFFFF.git
Vcs-Browser: https://github.com/pali/0xFFFF/tree/maemo
Package: 0xffff
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}, mtd-utils
Description: Open Free Fiasco Firmware Flasher
The ‘Open Free Fiasco Firmware Flasher’ aka 0xFFFF utility implements
a free userspace handler for the NOLO bootloader and extended features
for flashing, dumping and getting information for the Nokia Internet
Tablets. Thus it's a free alternative to Nokia's closed source flashing
utility called flasher.
.
Supported operations currently include, but are not limited to:
* generating and unpacking FIASCO images on local device
* editing Maemo firmware packages
* flashing any kind image type to Maemo devices via USB
* "cold" flashing for devices with bricked bootloaders
* direct kernel boot without flashing it to NAND
* changing configuration of Maemo device (R&D flags, HW revision strings, ...)
.
Supported are the Nokia 770, N800, N810, N810w, N900, N950 and N9.
XSBC-Maemo-Display-Name: 0xFFFF
XB-Maemo-Icon-26:
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAGXRFWHRTb2Z0
d2FyZQBB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dZ11HKJ/4HwdiMHyg0/2cYW8nG+X1IDefzxUI8P9ySP2KITj3
4PMnpqT4ozZrP3bWxq7rUlmle0tsVv6xgWkg/Bg7IxPr/2K8Nbb/CTAAF12f
5l7y6xMAAAAASUVORK5CYII=
-31
View File
@@ -1,31 +0,0 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://github.com/pali/0xFFFF
Files: *
Copyright: 2007-2012 pancake <pancake@youterm.com>
2011 Michael Buesch <mb@bu3sch.de>
2011-2013 Pali Rohár <pali.rohar@gmail.com>
License: GPL-3+
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 3 of the License, or (at your option) any later
version.
.
On Debian systems, the complete text of the GPL-3 can be found in
/usr/share/common-licenses/GPL-3.
Files: debian/*
Copyright: Sebastian Reichel <sre@debian.org>
License: ISC
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
Vendored
-3
View File
@@ -1,3 +0,0 @@
doc/
TODO
README
-7
View File
@@ -1,7 +0,0 @@
#!/usr/bin/make -f
%:
dh $@
override_dh_auto_install:
dh_auto_install -- PREFIX=/usr
-1
View File
@@ -1 +0,0 @@
3.0 (quilt)
-4
View File
@@ -1,4 +0,0 @@
version=3
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/0xFFFF-$1\.tar\.gz/,pgpsigurlmangle=s/$/.asc/ \
https://github.com/pali/0xFFFF/releases .*/0xffff_(\d\S+)\.orig\.tar\.gz
+7 -7
View File
@@ -191,14 +191,14 @@ static int send_2nd(usb_dev_handle * udev, struct image * image) {
if ( ret != sizeof(omap_peripheral_msg) )
ERROR_RETURN("Sending OMAP peripheral boot message failed", -1);
SLEEP(5000);
MSLEEP(5);
printf("Sending 2nd X-Loader image size...\n");
ret = usb_bulk_write(udev, USB_WRITE_EP, (char *)&image->size, 4, WRITE_TIMEOUT);
if ( ret != 4 )
ERROR_RETURN("Sending 2nd X-Loader image size failed", -1);
SLEEP(5000);
MSLEEP(5);
printf("Sending 2nd X-Loader image...\n");
printf_progressbar(0, image->size);
@@ -217,7 +217,7 @@ static int send_2nd(usb_dev_handle * udev, struct image * image) {
printf_progressbar(sent, image->size);
}
SLEEP(50000);
MSLEEP(50);
return 0;
}
@@ -237,7 +237,7 @@ static int send_secondary(usb_dev_handle * udev, struct image * image) {
ERROR_RETURN("Sending X-Loader init message failed", -1);
printf("Waiting for X-Loader response...\n");
SLEEP(5000);
MSLEEP(5);
ret = usb_bulk_read(udev, USB_READ_EP, (char *)&buffer, 4, READ_TIMEOUT); /* 4 bytes - dummy value */
if ( ret != 4 )
ERROR_RETURN("No response", -1);
@@ -260,7 +260,7 @@ static int send_secondary(usb_dev_handle * udev, struct image * image) {
}
printf("Waiting for X-Loader response...\n");
SLEEP(5000);
MSLEEP(5);
ret = usb_bulk_read(udev, USB_READ_EP, (char *)&buffer, 4, READ_TIMEOUT); /* 4 bytes - dummy value */
if ( ret != 4 )
ERROR_RETURN("No response", -1);
@@ -296,7 +296,7 @@ static int ping_timeout(usb_dev_handle * udev) {
break;
}
SLEEP(5000);
MSLEEP(5);
--try_read;
}
@@ -413,7 +413,7 @@ int leave_cold_flash(struct usb_device_info * dev) {
if ( ret != sizeof(omap_memory_msg) )
ERROR_RETURN("Sending OMAP memory boot message failed", -1);
SLEEP(1000000);
MSLEEP(250);
return 0;
}
+7 -2
View File
@@ -270,6 +270,11 @@ int disk_dump_dev(int fd, const char * file) {
size = read(fd, global_buf, need);
if ( size == 0 )
break;
if ( size < 0 ) {
PRINTF_ERROR("Reading from block device failed");
close(fd2);
return -1;
}
if ( write(fd2, global_buf, size) != size ) {
PRINTF_ERROR("Dumping image failed");
close(fd2);
@@ -409,8 +414,8 @@ int disk_init(struct usb_device_info * dev) {
/* TODO: change 1 to 0 when disk_flash_dev will be implemented */
/* RX-51 and RM-680 export MyDocs in first usb device and just first partion, so host system see whole device without MBR table */
if ( dev->device == DEVICE_RX_51 || dev->device == DEVICE_RM_680 )
/* RX-51, RM-680 and RM-696 export MyDocs in first usb device and just first partion, so host system see whole device without MBR table */
if ( dev->device == DEVICE_RX_51 || dev->device == DEVICE_RM_680 || dev->device == DEVICE_RM_696 )
fd = disk_open_dev(maj1, min1, -1, 1);
/* Other devices can export SD card as first partition and export whole mmc device, so host system will see MBR table */
else if ( maj2 != -1 && min2 != -1 )
+1 -1
View File
@@ -22,7 +22,7 @@ extern int verbose;
#define ALLOC_ERROR() do { ERROR("Cannot allocate memory"); } while (0)
#define ALLOC_ERROR_RETURN(...) do { ALLOC_ERROR(); return __VA_ARGS__; } while (0)
#define SLEEP(usec) do { struct timespec _t = { 0, (usec) }; nanosleep(&_t, NULL); } while (0)
#define MSLEEP(msec) do { nanosleep(&(struct timespec){ (msec / 1000), (1000L * 1000L * (msec % 1000)) }, NULL); } while (0)
static inline void * MEMMEM(void *haystack, size_t haystacklen, const void *needle, size_t needlelen) {
for ( size_t i = 0; i < haystacklen; ++i ) {
+3 -1
View File
@@ -421,6 +421,8 @@ int main(int argc, char **argv) {
enum device detected_device = DEVICE_UNKNOWN;
int16_t detected_hwrev = -1;
struct stat st;
int i;
char buf[512];
char * ptr = NULL;
@@ -1259,7 +1261,7 @@ int main(int argc, char **argv) {
for ( i = 0; i < IMAGE_COUNT; ++i ) {
if ( ! image_tmp_name(i) )
if ( ! image_tmp_name(i) || ( stat(image_tmp_name(i), &st) < 0 && errno == ENOENT ) )
continue;
buf[0] = 0;
+5
View File
@@ -361,6 +361,11 @@ int mkii_reboot_device(struct usb_device_info * dev, int update) {
if ( ret != 1 || msg->data[0] != 0 )
ERROR_RETURN("Cannot send reboot command", -1);
if (dev->data & MKII_UPDATE_MODE)
MSLEEP(100);
else
MSLEEP(3000);
return 0;
}
+1 -1
View File
@@ -541,7 +541,7 @@ int nolo_flash_image(struct usb_device_info * dev, struct image * image) {
}
SLEEP(0xc350); // 0.5s
MSLEEP(50);
}
+39 -30
View File
@@ -46,16 +46,21 @@
#endif
static struct usb_flash_device usb_devices[] = {
{ 0x0421, 0x0096, -1, -1, -1, FLASH_DISK, { DEVICE_RX_44, 0 } },
{ 0x0421, 0x0105, 2, 1, -1, FLASH_NOLO, { DEVICE_SU_18, DEVICE_RX_34, DEVICE_RX_44, DEVICE_RX_48, DEVICE_RX_51, DEVICE_RM_680, DEVICE_RM_696, 0 } },
{ 0x0421, 0x0106, 0, -1, -1, FLASH_COLD, { DEVICE_RX_51, DEVICE_RM_680, DEVICE_RM_696, 0 } },
{ 0x0421, 0x0189, -1, -1, -1, FLASH_DISK, { DEVICE_RX_48, 0 } },
{ 0x0421, 0x01c7, -1, -1, -1, FLASH_DISK, { DEVICE_RX_51, 0 } },
{ 0x0421, 0x01c8, 1, 1, -1, FLASH_MKII, { DEVICE_RX_51, DEVICE_RM_680, 0 } },
{ 0x0421, 0x03d1, -1, -1, -1, FLASH_DISK, { DEVICE_RM_680, 0 } },
{ 0x0421, 0x0431, -1, -1, -1, FLASH_DISK, { DEVICE_SU_18, DEVICE_RX_34, 0 } },
{ 0x0421, 0x04c3, -1, -1, -1, FLASH_DISK, { DEVICE_RX_34, 0 } },
{ 0x0421, 0x3f00, 2, 1, -1, FLASH_NOLO, { DEVICE_RX_34, 0 } },
/* vend prod i a protocol devices */
{ 0x0421, 0x0096, -1, -1, FLASH_DISK, { DEVICE_RX_44, 0 } },
{ 0x0421, 0x0105, 2, 1, FLASH_NOLO, { DEVICE_SU_18, DEVICE_RX_34, DEVICE_RX_44, DEVICE_RX_48, DEVICE_RX_51, DEVICE_RM_680, DEVICE_RM_696, 0 } },
{ 0x0421, 0x0106, 0, 0, FLASH_COLD, { DEVICE_RX_51, DEVICE_RM_680, DEVICE_RM_696, 0 } },
{ 0x0421, 0x0189, -1, -1, FLASH_DISK, { DEVICE_RX_48, 0 } },
{ 0x0421, 0x01c7, -1, -1, FLASH_DISK, { DEVICE_RX_51, 0 } },
{ 0x0421, 0x01c8, 1, 1, FLASH_MKII, { DEVICE_RX_51, DEVICE_RM_680, 0 } },
{ 0x0421, 0x01c8, 1, 0, FLASH_UNKN, { DEVICE_RX_51, 0 } }, /* U-Boot mode (TTY via USB) */
{ 0x0421, 0x03d1, -1, -1, FLASH_DISK, { DEVICE_RM_680, 0 } },
{ 0x0421, 0x03d2, 1, 1, FLASH_MKII, { DEVICE_RM_680, 0 } },
{ 0x0421, 0x0431, -1, -1, FLASH_DISK, { DEVICE_SU_18, DEVICE_RX_34, 0 } },
{ 0x0421, 0x04c3, -1, -1, FLASH_DISK, { DEVICE_RX_34, 0 } },
{ 0x0421, 0x0518, -1, -1, FLASH_DISK, { DEVICE_RM_696, 0 } },
{ 0x0421, 0x0519, -1, -1, FLASH_UNKN, { DEVICE_RM_696, 0 } }, /* RNDIS/Ethernet mode */
{ 0x0421, 0x051a, 2, 1, FLASH_UNKN, { DEVICE_RM_696, 0 } }, /* Sync mode (ADL protocol) */
};
static const char * usb_flash_protocols[] = {
@@ -134,7 +139,7 @@ static void usb_descriptor_info_print(usb_dev_handle * udev, struct usb_device *
buf[0] = 0;
for ( i = 0; i < ret; i+=2 ) {
sscanf(buf+i, "%2x", &x);
if ( x > 32 && x < 128 )
if ( x > 31 && x < 127 )
buf2[i/2] = x;
else {
buf2[0] = 0;
@@ -150,14 +155,29 @@ static void usb_descriptor_info_print(usb_dev_handle * udev, struct usb_device *
static struct usb_device_info * usb_device_is_valid(struct usb_device * dev) {
int i;
size_t i;
char product[1024];
struct usb_device_info * ret = NULL;
for ( i = 0; usb_devices[i].vendor; ++i ) {
for ( i = 0; i < sizeof(usb_devices)/sizeof(usb_devices[0]); ++i ) {
if ( dev->descriptor.idVendor == usb_devices[i].vendor && dev->descriptor.idProduct == usb_devices[i].product ) {
if ( usb_devices[i].protocol == FLASH_UNKN )
continue;
if ( dev->descriptor.bNumConfigurations < 1 )
continue;
if ( usb_devices[i].interface != -1 ) {
if ( usb_devices[i].interface >= dev->config[0].bNumInterfaces )
continue;
if ( usb_devices[i].alternate != -1 ) {
if ( usb_devices[i].alternate >= dev->config[0].interface[usb_devices[i].interface].num_altsetting )
continue;
}
}
printf("\b\b ");
PRINTF_END();
PRINTF_ADD("Found ");
@@ -195,18 +215,7 @@ static struct usb_device_info * usb_device_is_valid(struct usb_device * dev) {
if ( usb_devices[i].alternate >= 0 ) {
PRINTF_LINE("Setting alternate USB interface...");
if ( usb_set_altinterface(udev, usb_devices[i].alternate) < 0 ) {
PRINTF_ERROR("usb_claim_interface failed");
fprintf(stderr, "\n");
usb_reattach_kernel_driver(udev, usb_devices[i].interface);
usb_close(udev);
return NULL;
}
}
if ( usb_devices[i].configuration >= 0 ) {
PRINTF_LINE("Setting USB configuration...");
if ( usb_set_configuration(udev, usb_devices[i].configuration) < 0 ) {
PRINTF_ERROR("usb_set_configuration failed");
PRINTF_ERROR("usb_set_altinterface failed");
fprintf(stderr, "\n");
usb_reattach_kernel_driver(udev, usb_devices[i].interface);
usb_close(udev);
@@ -230,13 +239,13 @@ static struct usb_device_info * usb_device_is_valid(struct usb_device * dev) {
ret->device = DEVICE_RX_44;
else if ( strcmp(product, "Nokia N810 Internet Tablet WiMAX Edition") == 0 || strcmp(product, "Nokia-RX48 (Update mode)") == 0 )
ret->device = DEVICE_RX_48;
else if ( strcmp(product, "N900 (Storage Mode)") == 0 || strcmp(product, "Nokia N900 (Update mode)") == 0 || strcmp(product, "N900 (PC-Suite Mode)") == 0 )
else if ( strcmp(product, "N900 (Storage Mode)") == 0 || strcmp(product, "Nokia N900 (Update mode)") == 0 || strcmp(product, "N900 (PC-Suite Mode)") == 0 || strcmp(product, "N900 (U-Boot)") == 0 )
ret->device = DEVICE_RX_51;
else if ( strcmp(product, "Nokia N950") == 0 || strcmp(product, "Sync Mode") == 0 || strcmp(product, "N950 (Update mode)") == 0 )
else if ( strcmp(product, "Nokia N950") == 0 || strcmp(product, "N950 (Update mode)") == 0 )
ret->device = DEVICE_RM_680;
else if ( strcmp(product, "N9 (Update mode)") == 0 || strcmp(product, "Nxy (Update mode)") == 0 )
else if ( strcmp(product, "Nokia N9") == 0 || strcmp(product, "N9 (Update mode)") == 0 || strcmp(product, "Nokia N9 RNDIS/Ethernet") == 0 )
ret->device = DEVICE_RM_696;
else if ( strcmp(product, "Nokia USB ROM") == 0 )
else if ( strcmp(product, "Nokia USB ROM") == 0 || strcmp(product, "Sync Mode") == 0 || strcmp(product, "Nxy (Update mode)") == 0 )
ret->device = DEVICE_ANY;
else
ret->device = DEVICE_UNKNOWN;
@@ -361,7 +370,7 @@ struct usb_device_info * usb_open_and_wait_for_device(void) {
if ( ret )
break;
SLEEP(0xc350); // 0.5s
MSLEEP(50);
}
-1
View File
@@ -49,7 +49,6 @@ struct usb_flash_device {
uint16_t product;
int interface;
int alternate;
int configuration;
enum usb_flash_protocol protocol;
enum device devices[DEVICE_COUNT];
};