Drop mkcard. dd is standard and can replace it (see setup-x48ng-home.sh)

dd if=/dev/zero of="$DOTX48NG"/port2 bs=1k count=4096
This commit is contained in:
Gwenhael Le Moine 2024-08-29 13:03:44 +02:00
parent f138422154
commit 6d36927849
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
2 changed files with 2 additions and 75 deletions

View file

@ -5,7 +5,8 @@
# https://git.kernel.org/pub/scm/fs/fsverity/fsverity-utils.git/
# The governing license can be found in the LICENSE file or at
# https://opensource.org/license/MIT.
TARGETS = dist/x48ng dist/x48ng-mkcard dist/x48ng-checkrom dist/x48ng-dump2rom
TARGETS = dist/x48ng dist/x48ng-checkrom dist/x48ng-dump2rom
PREFIX = /usr
DOCDIR = $(PREFIX)/doc/x48ng
@ -131,7 +132,6 @@ endif
all: $(TARGETS)
dist/x48ng-dump2rom: src/legacy_tools/dump2rom.o
dist/x48ng-mkcard: src/legacy_tools/mkcard.o
dist/x48ng-checkrom: src/legacy_tools/checkrom.o src/romio.o
dist/x48ng: $(DOTOS)
@ -171,7 +171,6 @@ install: all dist/config.lua
chmod 755 $(DESTDIR)$(PREFIX)/share/x48ng/setup-x48ng-home.sh
install -m 755 -d -- $(DESTDIR)$(PREFIX)/libexec
install -c -m 755 dist/x48ng-mkcard $(DESTDIR)$(PREFIX)/libexec/x48ng-mkcard
install -c -m 755 dist/x48ng-dump2rom $(DESTDIR)$(PREFIX)/libexec/x48ng-dump2rom
install -c -m 755 dist/x48ng-checkrom $(DESTDIR)$(PREFIX)/libexec/x48ng-checkrom

View file

@ -1,72 +0,0 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
bool write_mem_file( char* name, unsigned char* mem, size_t size )
{
FILE* fp;
if ( NULL == ( fp = fopen( name, "w" ) ) ) {
fprintf( stderr, "can\'t open %s\n", name );
return false;
}
if ( fwrite( mem, 1, size, fp ) != size ) {
fprintf( stderr, "can\'t write %s\n", name );
fclose( fp );
return false;
}
fclose( fp );
return true;
}
int main( int argc, char** argv )
{
size_t size;
char* name;
char* asize;
unsigned char* core;
if ( argc < 2 ) {
fprintf( stderr, "usage: %s [32K | 128K | 1M | 2M | 4M] file-name\n", argv[ 0 ] );
exit( 1 );
}
name = argv[ 2 ];
asize = argv[ 1 ];
if ( !strcmp( asize, "32K" ) )
size = 0x8000;
else if ( !strcmp( asize, "128K" ) )
size = 0x20000;
else if ( !strcmp( asize, "256K" ) )
size = 0x40000;
else if ( !strcmp( asize, "512K" ) )
size = 0x80000;
else if ( !strcmp( asize, "1M" ) )
size = 0x100000;
else if ( !strcmp( asize, "2M" ) )
size = 0x200000;
else if ( !strcmp( asize, "4M" ) )
size = 0x400000;
else {
fprintf( stderr, "size must be one of 32K, 128K, 256K, 512K, 1M, 2M, or 4M\n" );
exit( 1 );
}
if ( ( core = ( unsigned char* )malloc( size ) ) == NULL ) {
fprintf( stderr, "can\'t malloc %ld bytes\n", size );
exit( 1 );
}
memset( core, 0, size );
if ( !write_mem_file( name, core, size ) ) {
fprintf( stderr, "can\'t write to %s\n", name );
exit( 1 );
}
exit( 0 );
}