Files
can-utils/isobusfs/isobusfs_create_test_file.sh
T
Oleksij Rempel 939e4d7e8c isobusfs: change license to LGPL-2.0-only
Before more contributions will come, change the license and make this
project usable as a library.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2024-02-04 19:15:25 +01:00

25 lines
649 B
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: LGPL-2.0-only
# SPDX-FileCopyrightText: 2023 Oleksij Rempel <linux@rempel-privat.de>
# Arguments: path to the file and the file size
FILEPATH=$1
FILESIZE=$2
# Variable to store the increasing number
counter=0
# XOR pattern (change this to whatever you like)
pattern=0xdeadbeef
# Calculate the number of iterations needed
let iterations=$FILESIZE/4
# Use 'dd' command to generate the file with increasing numbers
for ((i=0; i<$iterations; i++)); do
# Print the 32-bit number in binary format to the file
printf "%08x" $((counter ^ pattern)) | xxd -r -p >> $FILEPATH
let counter=counter+1
done