/
edison.env
72 lines (59 loc) · 4.27 KB
/
edison.env
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
# Edison Environment File
# Main part
# Dfu Alternate setting definition
dfu_alt_info_ram=kernel ram ${loadaddr} 0x800000
do_dfu_alt_info_ifwi=setenv dfu_alt_info "ifwi${hardware_id} raw 0 8192 mmcpart 1;ifwib${hardware_id} raw 0 8192 mmcpart 2"
dfu_alt_info_reset=reset ram 0x0 0x0
# Kernel load configuration
bootargs_console=console=ttyS2,115200n8 earlyprintk=ttyS2,115200n8,keep
bootargs_debug=loglevel=4
first_install_retry=0
first_install_max_retries=3
ota_update_retry=0
ota_update_max_retries=3
audio_codec_name=audio_codec="dummy"
do_audio_support=setenv audio_support platform_mrfld_audio.${audio_codec_name}
do_compute_target=if itest.b ${first_install_retry} -gt ${first_install_max_retries} || itest.b ${ota_update_retry} -gt ${ota_update_max_retries}; then echo "Switch to Rescue target"; setenv bootargs_target rescue; saveenv; fi
mmc-bootargs=run do_bootargs_rootfs; run do_audio_support; setenv bootargs ${bootargs_common} ${bootargs_rootfs} ${bootargs_console} ${bootargs_debug} systemd.unit=${bootargs_target}.target hardware_id=${hardware_id}
loadaddr=0x100000
rdaddr=0x6000000
# Main functions
do_partition_done=0
do_partition=if itest.b ${do_partition_done} -eq 1; then echo "Partitioning already done..."; else run do_force_partition ; fi
do_force_partition=echo "Partitioning using GPT"; gpt write mmc 0 ${partitions} ; mmc rescan; setenv do_partition_done 1 ; saveenv
do_flash_ifwi=run do_dfu_alt_info_ifwi ; dfu 0 mmc 0
do_flash_os=if itest.b ${do_flash_os_done} -eq 1 ; then echo "Flashing already done..." ; else run do_force_flash_os; fi
do_force_flash_os=run do_dfu_alt_info_mmc ; sleep 1 ; setenv do_flash_os_done 1 ; saveenv ; dfu 0 mmc 0
do_flashall=run do_partition;run do_flash_ifwi;run do_flash_os
do_dnx=setenv dfu_alt_info ${dfu_alt_info_ram};dfu 0 ram 0 ram;run bootcmd
init_dfu=run do_dfu_alt_info_mmc ; saveenv
# Handle different boot mode
bootcmd=echo "Target:${target_name}"; run do_partition; run do_handle_bootargs_mode;
do_handle_bootargs_mode=run do_preprocess_bootargs_mode; if itest.s $bootargs_mode == "sdhc" ; then run edsboot; fi; if itest.s $bootargs_mode == "ota" ; then run do_ota; fi; if itest.s $bootargs_mode == "boot" ; then run do_boot; fi; if itest.s $bootargs_mode == "flash"; then run do_flash; fi; if itest.s $bootargs_mode == "alt"; then run altboot; fi; run do_fallback; exit;
do_preprocess_bootargs_mode=if env exists bootargs_mode ; then ; else setenv bootargs_mode "boot" ;fi;
do_fallback=echo "Unknown boot mode: $bootargs_mode"; env delete -f bootargs_mode; saveenv; echo "Resetting to default boot mode and reboot..."; reset;
do_boot=run boot_target_cmd;
do_flash=run do_force_flash_os;
# OTA settings
ota_done=0
ota_script_addr=0x100000
do_ota_init=setenv ota_status 1 ; env delete -f bootargs_mode
do_load_ota_scr=if fatload mmc 0:9 $ota_script_addr ota_update.scr ; then setenv ota_status 0 ; else setenv ota_status 1 ; fi
do_source_ota_scr=if test $ota_status -eq 0 ; then if source $ota_script_addr ; then setenv ota_status 0 ; else setenv ota_status 2 ; fi ; fi
# do_ota_clean can be overriden by ota script
do_ota_clean=saveenv ; reset
do_ota=run do_ota_init ; run do_load_ota_scr ; run do_source_ota_scr ; run do_ota_clean
# after booting external image we want to return to eMMC on next boot
clean_bootargs_mode=if env exists bootargs_mode ; then env delete -f bootargs_mode; saveenv; echo "Resetting to default boot mode for next reboot..."; fi ;
# bootargs for external image
bootargs_common=quiet
# add lines to manual boot alternative kernel and rootfs from sd card
edsboot=run clean_bootargs_mode; setenv bootargs ${bootargs_common} ${bootargs_edsboot}; run load_edsboot; run boot_edsboot
bootargs_edsboot=tty1 console=ttyS2,115200n8 root=/dev/mmcblk1 rootfstype=ext4 systemd.unit=multi-user.target hardware_id=${hardware_id}
load_edsboot=load mmc 1 ${loadaddr} /boot/bzImage;load mmc 1 ${rdaddr} /boot/initrd
boot_edsboot=zboot ${loadaddr} 0 ${rdaddr} 0x1800000
# add lines to boot into rescue initrd on mmc
do_rescue=setenv bootargs ${bootargs_rescue}; run load_rescue; run boot_rescue
bootargs_rescue=debugshell=0 tty1 console=ttyS2,115200n8 root=/dev/mmcblk0p7 rootfstype=vfat systemd.unit=multi-user.target hardware_id=${hardware_id}
load_rescue=load mmc 0:7 ${loadaddr} bzImage;load mmc 0:7 ${rdaddr} initrd
boot_rescue=zboot ${loadaddr} 0x1800000 ${rdaddr} 0x1800000