2021-03-03 04:50:53 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# fail on error
|
|
|
|
set -e
|
|
|
|
|
2021-07-30 13:07:22 -07:00
|
|
|
FULL_INI=$1
|
|
|
|
H_OUTPUT=$2
|
|
|
|
FS_SIZE=$3
|
|
|
|
SHORT_BOARDNAME=$4
|
|
|
|
|
2021-07-30 16:33:31 -07:00
|
|
|
echo "create_ini_image: ini $FULL_INI to $H_OUTPUT size $FS_SIZE for $SHORT_BOARDNAME"
|
2021-07-30 13:07:22 -07:00
|
|
|
|
2021-03-03 04:50:53 -08:00
|
|
|
rm -f rusefi.zip ramdisk_image.h
|
|
|
|
|
2021-05-24 12:35:35 -07:00
|
|
|
# copy *count*KB of zeroes
|
2021-07-30 13:07:22 -07:00
|
|
|
dd if=/dev/zero of=ramdisk.image bs=1024 count=$FS_SIZE
|
2021-03-03 04:50:53 -08:00
|
|
|
|
|
|
|
# create a FAT filesystem inside, name it RUSEFI
|
|
|
|
mkfs.fat ramdisk.image
|
2021-07-30 13:23:01 -07:00
|
|
|
# labels can be no longer than 11 characters
|
|
|
|
fatlabel ramdisk.image RUSEFI
|
2021-03-03 04:50:53 -08:00
|
|
|
|
|
|
|
# -j option dumps all files in the root of the zip (instead of inside directories)
|
2021-07-30 13:07:22 -07:00
|
|
|
zip -j rusefi.ini.zip $FULL_INI
|
2021-03-03 04:50:53 -08:00
|
|
|
|
|
|
|
# Put the zip inside the filesystem
|
|
|
|
mcopy -i ramdisk.image rusefi.ini.zip ::
|
|
|
|
# Put a readme text file in there too
|
2021-05-09 09:18:55 -07:00
|
|
|
mcopy -i ramdisk.image hw_layer/mass_storage/filesystem_contents/README.txt ::
|
|
|
|
mcopy -i ramdisk.image hw_layer/mass_storage/filesystem_contents/rusEFI\ Forum.url ::
|
2021-07-30 16:02:11 -07:00
|
|
|
mcopy -i ramdisk.image hw_layer/mass_storage/filesystem_contents/rusEFI\ Wiki.url ::rusEFI\ ${SHORT_BOARDNAME}\ Wiki.url
|
2021-03-03 04:50:53 -08:00
|
|
|
|
2021-07-30 13:07:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-03 04:50:53 -08:00
|
|
|
# write out as a C array, with "static const" tacked on the front
|
|
|
|
xxd -i ramdisk.image \
|
|
|
|
| cat <(echo -n "static const ") - \
|
2021-07-30 13:07:22 -07:00
|
|
|
> $H_OUTPUT
|
2021-03-03 04:50:53 -08:00
|
|
|
|
|
|
|
rm ramdisk.image rusefi.ini.zip
|