1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006-2007 Dave Chapman
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
33 /* The maximum number of images in a firmware partition - a guess... */
43 struct ipod_directory_t
{
44 enum firmwaretype_t ftype
;
46 uint32_t devOffset
; /* Offset of image relative to one sector into bootpart*/
55 /* A fake partition type - DOS partition tables can't include HFS partitions */
56 #define PARTTYPE_HFS 0xffff
59 uint32_t start
; /* first sector (LBA) */
60 uint32_t size
; /* number of sectors */
68 int sectors_per_track
;
70 struct ipod_directory_t ipod_directory
[MAX_IMAGES
];
73 off_t start
; /* Offset in bytes of firmware partition from start of disk */
74 off_t fwoffset
; /* Offset in bytes of start of firmware images from start of disk */
75 struct partinfo_t pinfo
[4];
82 unsigned char* bootloader
;
87 void print_error(char* msg
);
88 int ipod_open(struct ipod_t
* ipod
, int silent
);
89 int ipod_reopen_rw(struct ipod_t
* ipod
);
90 int ipod_close(struct ipod_t
* ipod
);
91 int ipod_seek(struct ipod_t
* ipod
, unsigned long pos
);
92 ssize_t
ipod_read(struct ipod_t
* ipod
, unsigned char* buf
, int nbytes
);
93 ssize_t
ipod_write(struct ipod_t
* ipod
, unsigned char* buf
, int nbytes
);
94 int ipod_alloc_buffer(unsigned char** sectorbuf
, int bufsize
);
96 /* In fat32format.c */
97 int format_partition(struct ipod_t
* ipod
, int partition
);