mirror of
https://github.com/vivier/EMILE.git
synced 2025-04-11 07:37:22 +00:00
libmap: move emile_checksum() to map_checksum()
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
91a43e63c2
commit
081c7f96ee
@ -11,7 +11,7 @@ LDFLAGS = $(CROSS_COMPILE_LDFLAGS)
|
||||
|
||||
LIBRARY = libemile.a
|
||||
|
||||
SOURCES = emile_checksum.c emile_first_get_param.c \
|
||||
SOURCES = emile_first_get_param.c \
|
||||
emile_first_set_param.c emile_first_set_param_scsi.c \
|
||||
emile_floppy_create_image.c emile_second_create_mapfile.c \
|
||||
emile_scsi_create_container.c emile_scsi_get_dev.c \
|
||||
|
@ -76,8 +76,6 @@ extern int emile_floppy_create_image(char* first_level, char* second_level,
|
||||
char* image);
|
||||
extern int emile_scsi_create_container(int fd, unsigned short *unit_id,
|
||||
struct emile_container* container, int maxbloks);
|
||||
extern unsigned short emile_checksum(unsigned char *addr, unsigned int length);
|
||||
extern unsigned short emile_checksum_ATA(unsigned char *addr, unsigned int length);
|
||||
extern int8_t* emile_second_get_configuration(int fd);
|
||||
extern int emile_second_set_configuration(int fd, int8_t *configuration);
|
||||
extern int emile_second_get_next_property(int8_t *configuration, int index, char *name, char *property);
|
||||
|
@ -29,7 +29,7 @@ SOURCES = map_bootblock_get_type.c map_bootblock_is_valid.c \
|
||||
map_partition_set_startup.c map_read.c map_seek_driver_partition.c \
|
||||
map_set_bootinfo.c map_set_driver_info.c map_set_driver_number.c \
|
||||
map_set_partition_name.c map_set_partition_type.c map_set_startup.c \
|
||||
map_write.c map_block0_write.c map_read_sector.c \
|
||||
map_write.c map_block0_write.c map_read_sector.c map_checksum.c \
|
||||
map_write_sector.c map_get_blocksize.c map_init.c
|
||||
|
||||
HEADERS = libmap.h
|
||||
|
@ -184,4 +184,6 @@ extern int map_block0_write(map_t *map);
|
||||
extern int map_read_sector(map_t* map, off_t block, char *buffer, size_t nb);
|
||||
extern int map_write_sector(map_t* map, off_t block, char *buffer, size_t nb);
|
||||
extern int map_get_blocksize(map_t *map);
|
||||
extern unsigned short map_checksum(unsigned char *addr, unsigned int length);
|
||||
extern unsigned short map_checksum_ATA(unsigned char *addr, unsigned int length);
|
||||
#endif
|
||||
|
@ -4,10 +4,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libemile.h"
|
||||
#include "libmap.h"
|
||||
#include <stdio.h>
|
||||
|
||||
unsigned short emile_checksum(unsigned char *addr, unsigned int length)
|
||||
unsigned short map_checksum(unsigned char *addr, unsigned int length)
|
||||
{
|
||||
int j;
|
||||
unsigned short sum = 0;
|
||||
@ -25,7 +25,7 @@ unsigned short emile_checksum(unsigned char *addr, unsigned int length)
|
||||
return sum;
|
||||
}
|
||||
|
||||
unsigned short emile_checksum_ATA(unsigned char *addr, unsigned int length)
|
||||
unsigned short map_checksum_ATA(unsigned char *addr, unsigned int length)
|
||||
{
|
||||
unsigned int sum = 0;
|
||||
unsigned int i;
|
@ -176,7 +176,7 @@ static int get_driver(map_t *map, int partition, char* appledriver)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = emile_checksum(code, bootsize);
|
||||
ret = map_checksum(code, bootsize);
|
||||
if (ret != checksum)
|
||||
fprintf(stderr, "WARNING: checksum is invalid (0x%x)\n",
|
||||
ret);
|
||||
@ -268,7 +268,7 @@ static int put_driver(map_t *map, int partition, char* appledriver)
|
||||
|
||||
/* compute driver checksum */
|
||||
|
||||
checksum = emile_checksum(code, st.st_size);
|
||||
checksum = map_checksum(code, st.st_size);
|
||||
printf("Driver checksum: 0x%x\n", checksum);
|
||||
|
||||
/* write file in partition */
|
||||
|
@ -175,7 +175,7 @@ static int create_apple_driver(char *temp, char *appledriver, char *first_level)
|
||||
write_long((u_int32_t*)&map512.BootAddr2, 0);
|
||||
write_long((u_int32_t*)&map512.BootEntry, 0);
|
||||
write_long((u_int32_t*)&map512.BootEntry2, 0);
|
||||
write_long((u_int32_t*)&map512.BootCksum, emile_checksum(driver, st.st_size));
|
||||
write_long((u_int32_t*)&map512.BootCksum, map_checksum(driver, st.st_size));
|
||||
strncpy(map512.Processor, "68000", 16);
|
||||
write_long((u_int32_t*)map512.Pad, kSCSICDDriverSignature);
|
||||
|
||||
|
@ -187,7 +187,7 @@ static int emile_mktable(char *filename, char *appledriver)
|
||||
kPartitionIsChainCompatible |
|
||||
kPartitionIsRealDeviceDriver);
|
||||
write_long((u_int32_t*)&map512[current].BootSize, st.st_size);
|
||||
write_long((u_int32_t*)&map512[current].BootCksum, emile_checksum(driver, st.st_size));
|
||||
write_long((u_int32_t*)&map512[current].BootCksum, map_checksum(driver, st.st_size));
|
||||
strncpy(map512[current].Processor, "68000", 16);
|
||||
write_long((u_int32_t*)&map512[current].Pad, kSCSIDriverSignature);
|
||||
current++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user