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.

35 lignes
916B

  1. #!/bin/bash
  2. # This script will accept a text file with standard u-boot commands and
  3. # load it to the U-Boot environment. The original environment is saved
  4. # in a backup file in the current directory
  5. PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  6. BACKUP_FILE=u-boot_env-$$.bak
  7. if [ -z "$1" ]; then
  8. echo "Usage: $0 U-BOOT_ENV_FILE"
  9. exit 1
  10. fi
  11. # Backup existing U-Boot environment
  12. env fw_printenv > $BACKUP_FILE || exit 2
  13. # Check if the ethaddr variable is defined
  14. ethaddr=$(fw_printenv ethaddr 2> /dev/null)
  15. while read line
  16. do
  17. # Suppress the ethaddr overwrite warning
  18. [ -z "$ethaddr"] && [[ "$line" =~ "ethaddr" ]] && continue
  19. # ignore comments starting with '#'
  20. if [[ "$line" == *'#'* ]]; then
  21. line=$(echo $line | cut -d\# -f1)
  22. fi
  23. if [[ $line = *[^[:space:]]* ]]; then
  24. env fw_setenv $(echo $line | sed 's/=/ /') || exit 3
  25. fi
  26. done < "$1"