summaryrefslogtreecommitdiffstats
path: root/boot-scr/boot.txt
diff options
context:
space:
mode:
Diffstat (limited to 'boot-scr/boot.txt')
-rw-r--r--boot-scr/boot.txt481
1 files changed, 68 insertions, 413 deletions
diff --git a/boot-scr/boot.txt b/boot-scr/boot.txt
index 7a18eea..9cdaf10 100644
--- a/boot-scr/boot.txt
+++ b/boot-scr/boot.txt
@@ -1,435 +1,90 @@
-#
-# boot.scr
-#
-# Boot script for Beagle Hybrid / Panda Hybrid / GTA04 / Neo900
-#
-# Author: H. Nikolaus Schaller
-# Copyright Golden Delicious Computers 2010-2014
-# licensed under GPL 2.0
-#
-#
-# NAND Flash addresses (@ 256 MByte/2 GBit)
-#
-# 0x0000 0000 0x0007 ffff 08 0000 512 KB X-Loader (flash image) - note the loader must fit into 64k SRAM!
-# 0x0008 0000 0x001c ffff 15 0000 1.3 MB U-Boot (flash image)
-# 0x001d 0000 0x0020 ffff 04 0000 256 KB splash.rgb16z
-# 0x0021 0000 0x0024 ffff 04 0000 256 KB menu.rgb16z
-# 0x0025 0000 0x0025 ffff 01 0000 64 KB boot.scr
-# 0x0026 0000 0x0027 ffff 02 0000 128 KB U-Boot parameters written by saveenv
-# 0x0028 0000 0x0067 ffff 40 0000 4 MB Kernel (flash image loaded by nandboot)
-# 0x0068 0000 0x0fff ffff 250 MB (or more) file system (e.g. jffs)
-#
-# To flash into NAND from command line:
-#
-# 1. break into U-Boot command line
-# 2. flash=yes
-# 3. boot
-#
-# booting tries to load:
-# boot script /boot.scr (FAT) from partition 1, then /boot/boot.scr (EXT) from partition 1, then NAND
-# splash images /image.rgb16 (FAT) from partition 1, then /boot/image.rgb16 (EXT) partition 1, then NAND
-# kernel on up to 4 partitions /boot/uImage (EXT) or /uImage (FAT) or if none found then NAND
-# bootargs.scr on the same paritions /boot/bootargs.scr (EXT) or /bootargs.scr (FAT) -- default is initialized to NAND or SD (if kernel is found)
-#
+setenv kerneladdr 0x82000000
+setenv splashzipaddr 0x80400000
+setenv splashaddr 0x80800000
+setenv status_loading 'status set 18'
+setenv status_load_success 'status set 10'
+setenv status_load_error 'status set 8'
+setenv bootargs mpurate=${mpurate} mux=${mux}
-VERSION=0123456789 # incremented by build script so that we re-initialize the boot environment or reflash x-loader and u-boot
-
-echo "*** if you boot from NAND don-t worry about error messages when U-Boot tries to read a non-existing MMC ***"
+echo "Replicant GTA04"
+run status_loading
i2c dev 0
-status init
-status set 8 # give fast feedback that U-Boot did start (red power led)
-
-# we have to add an "x" because the test command treats empty string as equal to anything
-
-if test "x${scriptversion}" != "x${VERSION}"
- then
-
- # set up default environment
- # this setting boots from MMC if available and falls back to NAND
- # (except for MLO/X-Loader which is located depending on the AUX button)
-
- echo *** initializing GTA04 environment ***
-
- setenv bootdelay 1
- setenv imgtempaddr 0x80800000 # address where we load compressed splash image
- setenv bootaddr 0x81800000 # address where we load the boot script
- setenv loadaddrfdt 0x81c00000 # address where we load the flattened device tree
- setenv loadaddr 0x82000000 # address where we load the kernel
- # setenv console ttyS2,115200n8
- # for newer kernels with OMAP console (unfortunately U-Boot can't find out)
- setenv console ttyO2,115200n8
- setenv defaultdisplay lcd
- setenv bootorder "1 2 3 4"
- setenv nand 4 # mtd4 is nand
- setenv vram 12M
- setenv omapfbvram 0:8M,1:4M
-
- # load boot script from mmc (first FAT partition only) or nand wherever we find it
-# i2c dev 0
-# mmc rescan 0
-# if load mmc 0 ${bootaddr} boot.scr
-# then
-# echo did load bootscript from mmc
-# elif nand read ${bootaddr} 250000 10000
-# then
-# echo did load bootscript from nand
-# fi
- setenv loadbootscript 'i2c dev 0; mmc rescan 0; if load mmc 0 ${bootaddr} boot.scr; then echo did load bootscript from mmc; elif nand read ${bootaddr} 250000 10000; then echo did load bootscript from nand; fi'
-
- # load zipped/uncompressed image from mmc (first FAT partition only) or nand wherever we find it
-# i2c dev 0
-# mmc rescan 0
-# if load mmc 0 ${imgaddr} ${imgfile}.rgb16
-# then
-# ;
-# elif load mmc 0 ${imgtempaddr} ${imgfile}.rgb16z
-# then
-# unzip ${imgtempaddr} ${imgaddr}
-# elif nand read ${imgtempaddr} ${imgnandaddr} 40000
-# then
-# unzip ${imgtempaddr} ${imgaddr}
-# fi
- setenv loadimg 'i2c dev 0; mmc rescan 0; if load mmc 0 ${imgaddr} ${imgfile}.rgb16; then; elif load mmc 0 ${imgtempaddr} ${imgfile}.rgb16z; then unzip ${imgtempaddr} ${imgaddr}; elif nand read ${imgtempaddr} ${imgnandaddr} 40000; then unzip ${imgtempaddr} ${imgaddr}; fi'
- setenv showimg 'run loadimg; lcm fb ${imgaddr};'
-
- # predefine default boot arguments (unless overwritten by bootargs.scr)
- setenv mmcargs 'setenv bootargs console=${console} mpurate=${mpurate} mux=${mux} vram=${vram} omapfb.vram=${omapfbvram} omapfb.mode=dvi:${dvimode} omapfb.debug=y omapdss.def_disp=${defaultdisplay} ubi.mtd=${nand} root=${mmcroot} rootfstype=${mmcrootfstype}'
- setenv mmcroot '/dev/mmcblk0p2 rw'
- setenv mmcrootfstype 'ext4,ext3,btrfs rootwait'
-
- setenv nandargs 'setenv bootargs console=${console} mpurate=${mpurate} mux=${mux} vram=${vram} omapfb.vram=${omapfbvram} omapfb.mode=dvi:${dvimode} omapfb.debug=y omapdss.def_disp=${defaultdisplay} ubi.mtd=${nand} root=${nandroot} rootfstype=${nandrootfstype}'
- setenv nandroot 'ubi0:gta04-rootfs'
- setenv nandrootfstype 'ubifs'
-
- # load kernel and boot script from mmc (any of 4 partitions FAT or ext) or nand wherever we find it
- setenv kernelloading 'status set 18' # orange
- setenv kernelloaded 'status set 10' # green
-
-# run kernelloading
-# i2c dev 0
-# mmc rescan 0
-# DONE=0
-# KERNEL=0
-# FDT=0
-# run nandargs # start with default arguments for rootfs in NAND
-# for p in $bootorder
-# do
-# if itest $DONE == 0
-# then
-# if load mmc 0:${p} ${loadaddr} uImage
-# then
-# echo found kernel /uImage on partition $p
-# run mmcargs # start with default mmc args
-# KERNEL=1
-# DONE=1
-# elif load mmc 0:${p} ${loadaddr} /boot/uImage
-# then
-# echo found kernel /boot/uImage on partition $p
-# setenv mmcroot "/dev/mmcblk0p${p} rw"
-# run mmcargs # start with default mmc args
-# KERNEL=1
-# DONE=1
-# fi
-# if load mmc 0:${p} ${imgtempaddr} bootargs.scr
-# then
-# setenv PARTITION $p
-# setenv PARTITIONTYPE FAT
-# source ${imgtempaddr}
-# DONE=1
-# elif load mmc 0:${p} ${imgtempaddr} /boot/bootargs.scr
-# then
-# setenv PARTITION $p
-# setenv PARTITIONTYPE EXT
-# source ${imgtempaddr}
-# DONE=1
-# fi
-# if load mmc 0:${p} ${loadaddrfdt} ${devicetree}.dtb
-# then
-# FDT=1
-# elif load mmc 0:${p} ${loadaddrfdt} /boot/${devicetree}.dtb
-# then
-# FDT=1
-# fi
-# fi
-# done
-# if itest $KERNEL == 0
-# then
-# if nand read ${loadaddr} 280000 400000
-# then
-# echo fallback to NAND kernel
-# FDT=0
-# else
-# status blink
-# fi
-# fi
-# run kernelloaded
-
- setenv loadkernel 'run kernelloading;i2c dev 0;mmc rescan 0;DONE=0;KERNEL=0;FDT=0;run nandargs;echo trying partitions $bootorder;for p in $bootorder;do;if itest $DONE == 0;then;if load mmc 0:${p} ${loadaddr} uImage;then;echo found kernel on partition $p;run mmcargs;KERNEL=1;DONE=1;elif load mmc 0:${p} ${loadaddr} /boot/uImage;then;echo found kernel on EXT partition $p;setenv mmcroot "/dev/mmcblk0p${p} rw";run mmcargs;KERNEL=1;DONE=1;fi;if load mmc 0:${p} ${imgtempaddr} bootargs.scr;then;setenv PARTITION $p;setenv PARTITIONTYPE FAT;source ${imgtempaddr};DONE=1;elif load mmc 0:${p} ${imgtempaddr} /boot/bootargs.scr;then;setenv PARTITION $p;setenv PARTITIONTYPE EXT;source ${imgtempaddr};DONE=1;fi;if load mmc 0:${p} ${loadaddrfdt} ${devicetree}.dtb;then;FDT=1;elif load mmc 0:${p} ${loadaddrfdt} /boot/${devicetree}.dtb;then;FDT=1;fi;fi;done;if itest $KERNEL == 0;then;if nand read ${loadaddr} 280000 400000;then;echo fallback to NAND kernel;FDT=0;else;status blink;fi;fi;run kernelloaded'
-
- # boot with kernel/rootfs from specified source
- setenv boot 'if itest $FDT == 1; then bootm ${loadaddr} - ${loadaddrfdt}; else bootm ${loadaddr}; fi;'
- setenv mmcboot 'if run loadkernel; then run boot; fi;'
- setenv nandboot 'run kernelloading; if nand read ${loadaddr} 280000 400000; then run nandargs; run kernelloaded; bootm ${loadaddr}; fi;'
-
- # run the boot script - and fall back to direct kernel boot
- setenv bootcmd 'if run loadbootscript; then run bootscript; else run mmcboot; fi;'
- setenv bootscript 'echo Running bootscript ...; source ${bootaddr}'
-
- # write script version number permanently
- setenv scriptversion "${VERSION}"
-
- flash=yes # trigger flashing
-fi
-
-echo *** initializing LCM ***
-if lcm start || test "${flash}" = "yes"
+if mmc rescan 0
then
+ # Load splash
- if test "x${flash}" = "xyes"
+ if fatload mmc 0 ${splashzipaddr} splash.rgb16z
then
- lcm color ff0000 # will flash - turn screen red
+ unzip ${splashzipaddr} ${splashaddr}
+ if lcm init
+ then
+ lcm power 2
+ lcm on
+ lcm fb ${splashaddr}
+ lcm backlight 255
+ fi
else
- echo *** loading splash from MMC ***
- setenv imgaddr 80400000
- setenv imgfile splash
- setenv imgnandaddr 1d0000
- run showimg
+ if fatload mmc 0 ${splashaddr} splash
+ then
+ if lcm init
+ then
+ lcm power 2
+ lcm on
+ lcm fb ${splashaddr}
+ lcm backlight 255
+ fi
+ fi
fi
- if test "x${flash}" = "xyes" || test "x${forcemenu}" = "xyes" || status check 1 # we want to flash or AUX button is (still) pressed
- then
- if test "x${forcemenu}" = "xyes"
- then # reset
- setenv forcemenu
- saveenv
- fi
- echo *** initializing TSC for boot menu ***
- tsc init # tsc selection will be 0
- while true
- do
- if test "x${flash}" != "xyes"
- then
- echo *** loading boot menu image ***
- setenv imgaddr 80600000
- setenv imgfile menu
- setenv imgnandaddr 210000
- run showimg
+ # Load kernel
- tsc choose 3 3 # 3 columns 3 rows -> value 1 .. 9
-
- # restore boot image
- # setenv imgaddr 80400000
- # setenv imgfile splash
- # setenv imgnandaddr 1d0000
- # run showimg
- fi
-
- if tsc selection 7
- then
- lcm color 00ff00 # turn screen green (feedback to touch press)
- lcm fb 0
- echo *** LED mirror ***
- status mirror
- elif tsc selection 8
- then
- lcm color 0000ff # turn screen blue
- lcm fb 0
- echo *** LED blink ***
- # systest all
- status blink
- elif tsc selection 9
- then
- echo *** TSC test ***
- tsc gloop
- elif tsc selection 99
- then
- lcm color 00ff00 # turn screen green (feedback to touch press)
- lcm fb 0
- echo *** LCD boot ***
- setenv defaultdisplay lcd
- run mmcboot
- elif tsc selection 5
- then
- lcm color 00ff00 # turn screen green (feedback to touch press)
- lcm fb 0
- setenv bootorder ""
- echo *** NAND boot ***
- setenv defaultdisplay lcd
- saveenv
- run mmcboot
- elif tsc selection 6
- then
- lcm color 555555 # turn screen green (feedback to touch press)
- lcm fb 0
- sleep 1
- poweroff
-# OLD
- echo *** DVI boot ***
- if run loadkernel
- then
- setenv bootdelay 10
- setenv defaultdisplay dvi # this is not made persistent!
- setenv dvimode 1024x768MR-16@60
- lcm backlight 0
- lcm off
- lcm power 0
- run mmcboot
- fi
- elif tsc selection 1
- then
- lcm color 00ff00 # turn screen green (feedback to touch press)
- lcm fb 0
- echo *** MMC boot partition 1***
- setenv bootorder "1 2 3 4"
- echo new boot order $bootorder
- setenv defaultdisplay lcd
- saveenv
- run mmcboot
- elif tsc selection 2
- then
- lcm color 55ff00 # turn screen green (feedback to touch press)
- lcm fb 0
- echo *** MMC boot partition 1***
- setenv bootorder "2 3 4 1"
- echo new boot order $bootorder
- setenv defaultdisplay lcd
- saveenv
- run mmcboot
- elif tsc selection 3
- then
- lcm color 00ff55 # turn screen green (feedback to touch press)
- lcm fb 0
- echo *** MMC boot partition 1***
- setenv bootorder "3 4 1 2"
- echo new boot order $bootorder
- setenv defaultdisplay lcd
- saveenv
- run mmcboot
- elif tsc selection 4
- then
- lcm color 55ff55 # turn screen green (feedback to touch press)
- lcm fb 0
- echo *** MMC boot partition 1***
- setenv bootorder "4 1 2 3"
- echo new boot order $bootorder
- setenv defaultdisplay lcd
- saveenv
- run mmcboot
- elif test "x${flash}" = "xyes" || tsc selection 99
- then
- echo *** NAND flash ***
- # note: MLO is configured to load U-Boot from MMC
- # while X-Loader is loading U-Boot from NAND
+ if status check 1 || ext4load mmc 0:3 ${kerneladdr} .startrecovery
+ then
+ if fatload mmc 0 ${kerneladdr} recovery.img
+ then
+ run status_load_success
- status set 10
- i2c dev 0
- if fatload mmc 0 0x80200000 x-load.flash
- then
- status set 18
- echo *** flashing Xloader ***
-# nand unlock
- nandecc hw
- # write some copies
- nand erase 0 80000
- nand write 0x80200000 0 20000
- nand write 0x80200000 20000 20000
- nand write 0x80200000 40000 20000
- nand write 0x80200000 60000 20000
- echo *** Xloader flashed ***
- fi
-
- status set 10
- # the official u-boot partition goes from 0x80000 to 0x27ffff i.e. 2 MByte
-
- if fatload mmc 0 0x80300000 u-boot.flash
- then
- echo *** flashing U-Boot ***
- status set 18
- nandecc sw
- nand erase 80000 1e0000
- nand write 0x80300000 80000 150000
- echo *** write our new environment ***
- saveenv
+ lcm backlight 0
+ lcm power 0
+ lcm off
- # read&write compressed splash image to nand
- # there is just room for 614 kByte
- # since u-boot is approx 260 kByte
+ bootm ${kerneladdr}
+ else
+ echo "Loading recovery kernel failed"
+ run status_load_error
+ fi
+ fi
- status set 10
- if fatload mmc 0 0x80300000 splash.rgb16z
- then
- echo *** flashing splash ***
- status set 18
- nandecc sw
- nand write 0x80300000 1d0000 40000
- status set 10
- fi
+ if fatload mmc 0 ${kerneladdr} boot.img
+ then
+ run status_load_success
- status set 10
- if fatload mmc 0 0x80300000 menu.rgb16z
- then
- echo *** flashing menu ***
- status set 18
- nandecc sw
- nand write 0x80300000 210000 40000
- status set 18
- fi
+ lcm backlight 0
+ lcm power 0
+ lcm off
- status set 10
- if fatload mmc 0 0x80300000 boot.scr
- then
- echo *** flashing boot.scr ***
- status set 18
- nandecc sw
- nand write 0x80300000 250000 10000
- fi
- echo *** U-Boot flashed ***
- fi
+ bootm ${kerneladdr}
+ else
+ echo "Loading kernel failed"
+ run status_load_error
- # please flash kernel and rootfs from Linux
+ if fatload mmc 0 ${kerneladdr} recovery.img
+ then
+ run status_load_success
- status set 8
- flash=no # don't flash again
-
- echo
- echo *********************************
- echo *** Flashing Done ***
- echo *** Device will reboot ***
- echo *********************************
- echo
- run mmcboot
- # reset # resets CPU only but not BootROM boot order!
- # we simply show the menu
- else
- echo *** Could not decode ***
- status blink
- fi
- done
- else # default boot w/o menu
- echo *** booting Linux ***
- if run loadkernel
- then
-# lcm backlight 0 # switch off before booting (?)
- printenv
+ lcm backlight 0
lcm power 0
- lcm off # avoid wash-out
- run boot
+ lcm off
+
+ bootm ${kerneladdr}
+ else
+ echo "Loading recovery kernel failed"
+ run status_load_error
fi
fi
-else # LCM did not init (e.g. we run without display)
- echo *** DVI boot ***
- if run loadkernel
- then
- setenv bootdelay 10
- setenv defaultdisplay dvi
- setenv dvimode 1024x768MR-16@60
- run boot
- fi
+else
+ echo "Scanning mmc failed"
+ run status_load_error
fi
-
-echo *** Could not run ***
-lcm color ff0000
-lcm fb 0
-status blink