ubuntuusers.de

new u-boot configure script for debian

Autor:
Rorschach
Datum:
18. August 2008 18:42
Code:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash

#
# uBoot configuration for Debian on the Openmoko FreeRunner (GTA02)
#
# Copyright 2008 Joachim Breitner <nomeata@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# 18.08.08: * default boot in quiet-mode for speed
#           * added option to boot without quiet-mode for debugging
# (Rorschach)

set -e

echo "This will configure your uboot environment to boot a Debian installation"
echo "It also adds a menu entry to boot the image installed in flash"
echo "Make sure this script runs as root, that uBoot is running on your Freerunner"
echo "And that it is plugged in via usb"
echo

tmpdir=$(mktemp -d -t uboot-env.XXXXXXXXXX)
trap "rm -f $tmpdir/env.orig $tmpdir/env.new $tmpdir/uboot_menu.in ; rmdir $tmpdir" EXIT

cd $tmpdir
cat > uboot_menu.in <<'__END__'
bootcmd=
  setenv bootargs
    ${bootargs_base} ${mtdparts}
    rootfstype=ext2 root=/dev/mmcblk0p2 quiet rootdelay=5;
  mmcinit;
  ext2load mmc 1 0x32000000 ${sd_image_name};
  bootm 0x32000000

menu_1=
  Boot without quiet-mode:
  setenv bootargs
    ${bootargs_base} ${mtdparts}
    rootfstype=ext2 root=/dev/mmcblk0p2 rootdelay=5;
  mmcinit;
  ext2load mmc 1 0x32000000 ${sd_image_name};
  bootm 0x32000000

menu_2=
  Boot from Flash:
  setenv bootargs
    ${bootargs_base} ${mtdparts};
  nand read.e 0x32000000 kernel 0x200000;
  bootm 0x32000000

menu_3=
  Reboot:
  reset

menu_4=
  Power off:
  neo1973 power-off

menu_5=
  Set console to USB:
  setenv stdin usbtty;
  setenv stdout usbtty;
  setenv stderr usbtty

menu_6=
  Set console to serial:
  setenv stdin serial;
  setenv stdout serial;
  setenv stderr serial

menu_7=

menu_8=
__END__

echo Dumping current uboot environment
dfu-util -a u-boot_env -U env.orig
echo "Merging debian menu entries into uboot environment" 
uboot-envedit -i env.orig -f uboot_menu.in -o env.new
echo Writing back uboot environment
dfu-util -a u-boot_env -D env.new
echo Done modifying uboot environment
echo 
echo Restart and enjoy