1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/pkg_fatfs/create_fat_image_file.sh
2018-01-09 14:46:40 +01:00

18 lines
654 B
Bash
Executable File

#!/usr/bin/env bash
#
# Copyright (C) 2017 HAW-Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
dd if=/dev/zero of=riot_fatfs_disk.img bs=1M count=$1
mkfs.fat riot_fatfs_disk.img
sudo mkdir -p /media/riot_fatfs_disk
sudo mount -o loop,umask=000 riot_fatfs_disk.img /media/riot_fatfs_disk
touch /media/riot_fatfs_disk/test.txt
echo "the test file content 123 abc" | tr '\n' '\0' >> /media/riot_fatfs_disk/test.txt
sudo umount /media/riot_fatfs_disk
tar -cjf riot_fatfs_disk.tar.gz riot_fatfs_disk.img
rm riot_fatfs_disk.img