<commit_before>#!/bin/bash

MACHINE=overo

if [ "x${1}" = "x" ]; then
    echo "Usage: ${0} <block device>"
    exit 0
fi

mount | grep '^/' | grep -q ${1}

if [ $? -ne 1 ]; then
    echo "Looks like partitions on device /dev/${1} are mounted"
    echo "Not going to work on a device that is currently in use"
    mount | grep ${1}
    exit 1
fi

if [ ! -d /media/card ]; then
    echo "Temporary mount point [/media/card] not found"
    exit 1
fi

if [ -z "$OETMP" ]; then
   # echo try to find it
    if [ -f ../../build/conf/local.conf ]; then
        OETMP=$(grep '^TMPDIR' ../../build/conf/local.conf | awk '{ print $3 }' | sed 's/"//g')

        if [ -z "$OETMP" ]; then
            OETMP=../../build/tmp
        fi
    fi
fi


echo "OETMP: $OETMP"

if [ ! -d ${OETMP}/deploy/images/${MACHINE} ]; then
    echo "Directory not found: ${OETMP}/deploy/images/${MACHINE}"
    exit 1
fi

SRC=${OETMP}/deploy/images/${MACHINE}

if [ ! -f ${SRC}/MLO-${MACHINE} ]; then
    echo "File not found: ${SRC}/MLO-${MACHINE}"
    exit 1
fi

if [ ! -f ${SRC}/u-boot-${MACHINE}.img ]; then
    echo "File not found: ${SRC}/u-boot-${MACHINE}.img"
    exit 1
fi

if [ -b ${1} ]; then
    DEV=${1}
elif [ -b "/dev/${1}1" ]; then
    DEV=/dev/${1}1
elif [ -b "/dev/${1}p1" ]; then
    DEV=/dev/${1}p1
else
    echo "Block device not found: /dev/${1}1 or /dev/${1}p1"
    exit 1
fi

echo "Formatting FAT partition on $DEV"
sudo mkfs.vfat ${DEV} -n "BOOT"

echo "Mounting $DEV"
sudo mount ${DEV} /media/card

echo "Copying MLO"
sudo cp ${SRC}/MLO-${MACHINE} /media/card/MLO

echo "Copying u-boot"
sudo cp ${SRC}/u-boot-${MACHINE}.img /media/card/u-boot.img

if [ -f ${SRC}/boot.scr ]; then
    echo "Copying boot.scr to /media/card"
    sudo cp ${SRC}/boot.scr /media/card
else
    if [ -f ${SRC}/uEnv.txt ]; then
        echo "Copying ${SRC}/uEnv.txt to /media/card"
        sudo cp ${SRC}/uEnv.txt /media/card
    elif [ -f ./uEnv.txt ]; then
        echo "Copying ./uEnv.txt to /media/card"
        sudo cp ./uEnv.txt /media/card
    fi
fi

sudo sync

echo "Unmounting ${DEV}"
sudo umount ${DEV}

echo "Done"
<commit_msg>Copy boot.scr to boot partition<commit_after>#!/bin/bash

MACHINE=overo

if [ "x${1}" = "x" ]; then
    echo "Usage: ${0} <block device>"
    exit 0
fi

mount | grep '^/' | grep -q ${1}

if [ $? -ne 1 ]; then
    echo "Looks like partitions on device /dev/${1} are mounted"
    echo "Not going to work on a device that is currently in use"
    mount | grep ${1}
    exit 1
fi

if [ ! -d /media/card ]; then
    echo "Temporary mount point [/media/card] not found"
    exit 1
fi

if [ -z "$OETMP" ]; then
   # echo try to find it
    if [ -f ../../build/conf/local.conf ]; then
        OETMP=$(grep '^TMPDIR' ../../build/conf/local.conf | awk '{ print $3 }' | sed 's/"//g')

        if [ -z "$OETMP" ]; then
            OETMP=../../build/tmp
        fi
    fi
fi


echo "OETMP: $OETMP"

if [ ! -d ${OETMP}/deploy/images/${MACHINE} ]; then
    echo "Directory not found: ${OETMP}/deploy/images/${MACHINE}"
    exit 1
fi

SRC=${OETMP}/deploy/images/${MACHINE}

if [ ! -f ${SRC}/MLO-${MACHINE} ]; then
    echo "File not found: ${SRC}/MLO-${MACHINE}"
    exit 1
fi

if [ ! -f ${SRC}/u-boot-${MACHINE}.img ]; then
    echo "File not found: ${SRC}/u-boot-${MACHINE}.img"
    exit 1
fi

if [ ! -f ${SRC}/boot.scr ]; then
    echo "File not found: ${SRC}/boot.scr"
    exit 1
fi

if [ -b ${1} ]; then
    DEV=${1}
elif [ -b "/dev/${1}1" ]; then
    DEV=/dev/${1}1
elif [ -b "/dev/${1}p1" ]; then
    DEV=/dev/${1}p1
else
    echo "Block device not found: /dev/${1}1 or /dev/${1}p1"
    exit 1
fi

echo "Formatting FAT partition on $DEV"
sudo mkfs.vfat ${DEV} -n "BOOT"

echo "Mounting $DEV"
sudo mount ${DEV} /media/card

echo "Copying MLO"
sudo cp ${SRC}/MLO-${MACHINE} /media/card/MLO

echo "Copying u-boot"
sudo cp ${SRC}/u-boot-${MACHINE}.img /media/card/u-boot.img

echo "Copying boot.scr"
sudo cp ${SRC}/boot.scr /media/card

sudo sync

echo "Unmounting ${DEV}"
sudo umount ${DEV}

echo "Done"
{'fraction_non_alphanumeric': 0.1950975487743872, 'fraction_numerical': 0.014257128564282141, 'mean_word_length': 2.456352636127917, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2184575', 'n_tokens_mistral': 1642, 'n_tokens_neox': 1590, 'n_words': 471}