U-boot setup for Compulab's Utilite
Vous ne pouvez pas sélectionner plus de 25 sujets
Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
|
- #!/bin/bash
-
- # This script will accept a text file with standard u-boot commands and
- # load it to the U-Boot environment. The original environment is saved
- # in a backup file in the current directory
-
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- BACKUP_FILE=u-boot_env-$$.bak
-
- if [ -z "$1" ]; then
- echo "Usage: $0 U-BOOT_ENV_FILE"
- exit 1
- fi
-
- # Backup existing U-Boot environment
- env fw_printenv > $BACKUP_FILE || exit 2
-
- # Check if the ethaddr variable is defined
- ethaddr=$(fw_printenv ethaddr 2> /dev/null)
-
- while read line
- do
- # Suppress the ethaddr overwrite warning
- [ -z "$ethaddr"] && [[ "$line" =~ "ethaddr" ]] && continue
-
- # ignore comments starting with '#'
- if [[ "$line" == *'#'* ]]; then
- line=$(echo $line | cut -d\# -f1)
- fi
-
- if [[ $line = *[^[:space:]]* ]]; then
- env fw_setenv $(echo $line | sed 's/=/ /') || exit 3
- fi
- done < "$1"
|