From ce555f419b1f3a7ac63f7e33f7c17fe4ac5f7594 Mon Sep 17 00:00:00 2001 From: John Klug Date: Fri, 10 Feb 2023 16:24:29 -0600 Subject: Some files for building and SD image --- contrib/SD/atmel-sd.partitions | 9 +++++++ contrib/SD/root/etc/fstab | 12 +++++++++ contrib/SD/root/home/mtadm/install.sh | 48 +++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 contrib/SD/atmel-sd.partitions create mode 100644 contrib/SD/root/etc/fstab create mode 100755 contrib/SD/root/home/mtadm/install.sh diff --git a/contrib/SD/atmel-sd.partitions b/contrib/SD/atmel-sd.partitions new file mode 100644 index 0000000..0b96094 --- /dev/null +++ b/contrib/SD/atmel-sd.partitions @@ -0,0 +1,9 @@ +label: dos +label-id: 0x8e3ef9fc +device: sd.img +unit: sectors + +sd.img1 : start= 2048, size= 135168, type=6 +sd.img2 : start= 137216, size= 6975489, type=83 +sd.img3 : start= 7114752, size= 262144, type=83 +sd.img4 : start= 7376896, size= 262144, type=83 diff --git a/contrib/SD/root/etc/fstab b/contrib/SD/root/etc/fstab new file mode 100644 index 0000000..1e3376f --- /dev/null +++ b/contrib/SD/root/etc/fstab @@ -0,0 +1,12 @@ +rootfs / auto defaults 1 1 +proc /proc proc defaults 0 0 +devpts /dev/pts devpts mode=0620,gid=5 0 0 +usbdevfs /proc/bus/usb usbdevfs noauto 0 0 +tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0 +tmpfs /var/volatile tmpfs defaults 0 0 +configfs /sys/kernel/config configfs defaults 0 0 + +#/dev/mtdblock6 /var/config jffs2 defaults 0 0 +#/dev/mtdblock7 /var/oem jffs2 defaults,ro 0 0 +/dev/mmcblk0p3 /var/config ext4 defaults 0 0 +/media/mmcblk0p1 /boot none defaults,bind 0 0 diff --git a/contrib/SD/root/home/mtadm/install.sh b/contrib/SD/root/home/mtadm/install.sh new file mode 100755 index 0000000..0d3442b --- /dev/null +++ b/contrib/SD/root/home/mtadm/install.sh @@ -0,0 +1,48 @@ +#!/bin/bash +fail=0 +function verify +{ + dev=$1 + file=$2 + tfile=$(mktemp -tp /tmp md5sum.XXXXXX) + + count=$(stat -Lc %s $file) + cat $file | md5sum >$tfile + echo "Check device $dev $file against file $tfile for $count bytes" + echo + if nanddump -l $count $dev | md5sum -c $tfile ; then + echo "File $2 verified" + else + echo "File $2 fails on NAND check" + ((++fail)) + exit 1 + fi +} +if (($# < 1)) || ! [[ -d $1 ]] ; then + echo "Did not find a directory" + echo "Possibly one of $(find /images -type d)" + exit 1 +fi +cd $1 +set -e +flash_erase /dev/mtd1 0 0 +nandwrite -p /dev/mtd1 bstrap.bin +verify /dev/mtd1 bstrap.bin +flash_erase /dev/mtd2 0 0 +nandwrite -p /dev/mtd2 uboot.bin +verify /dev/mtd2 uboot.bin +flash_erase /dev/mtd3 0 0 +flash_erase /dev/mtd4 0 0 +flash_erase /dev/mtd5 0 0 +nandwrite -p /dev/mtd5 uImage.bin +verify /dev/mtd5 uImage.bin +flash_erase -j /dev/mtd6 0 0 +flash_erase -j /dev/mtd7 0 0 +flash_erase -j /dev/mtd8 0 0 +nandwrite -p /dev/mtd8 rootfs.jffs2 +verify /dev/mtd8 rootfs.jffs2 +flash_erase -j /dev/mtd9 0 0 +if ((fail > 0)) ; then + echo "ERROR: One or more failures writing NAND" + echo "Check log" +fi -- cgit v1.2.3