1 /*
2  * Copyright (C) 2016 Stefan Roese <sr@denx.de>
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 /*
8  * Common options, macros and default environment for all
9  * theadorable x86 based boards
10  */
11 
12 #ifndef __THEADORABLE_X86_COMMON_H
13 #define __THEADORABLE_X86_COMMON_H
14 
15 #define CONFIG_SYS_MONITOR_LEN		(1 << 20)
16 
17 #define CONFIG_PREBOOT
18 
19 #define CONFIG_STD_DEVICES_SETTINGS     "stdin=serial\0" \
20 					"stdout=serial\0" \
21 					"stderr=serial\0"
22 
23 #define VIDEO_IO_OFFSET				0
24 #define CONFIG_X86EMU_RAW_IO
25 #define CONFIG_CMD_BMP
26 #define CONFIG_BMP_16BPP
27 
28 /* Environment settings */
29 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
30 #undef CONFIG_ENV_SIZE
31 #define CONFIG_ENV_SIZE			0x2000
32 #define CONFIG_ENV_SECT_SIZE		0x1000
33 #define CONFIG_ENV_OFFSET		0x006ec000
34 #define CONFIG_ENV_OFFSET_REDUND	\
35 	(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
36 
37 #undef CONFIG_BOOTCOMMAND
38 #undef CONFIG_EXTRA_ENV_SETTINGS
39 
40 #define CONFIG_EXTRA_ENV_SETTINGS				\
41 	"tftpdir=" DEF_ENV_TFTPDIR "\0"				\
42 	"eth_init=" DEF_ENV_ETH_INIT "\0"			\
43 	"ubuntu_part=" __stringify(DEF_ENV_UBUNTU_PART) "\0"	\
44 	"yocto_part=" __stringify(DEF_ENV_YOCTO_PART) "\0"	\
45 	"ubuntu_tty=" __stringify(DEF_ENV_UBUNTU_TTY) "\0"	\
46 	"yocto_tty=" __stringify(DEF_ENV_YOCTO_TTY) "\0"	\
47 	"start_eth=if test -n \"${eth_init}\";"			\
48 		"then run eth_init;else sleep 0;fi\0"		\
49 	"kernel-ver=4.8.0-54-generic\0"				\
50 	"boot=zboot 03000000 0 04000000 ${filesize}\0"		\
51 	"mtdparts=mtdparts=intel-spi:4k(descriptor),7084k(me)," \
52 		"8k(env1),8k(env2),64k(mrc),640k(u-boot),"	\
53 		"64k(vga),-(fsp)\0"				\
54 	"addtty_ubuntu=setenv bootargs ${bootargs} "		\
55 		"console=ttyS${ubuntu_tty},${baudrate}\0"	\
56 	"addtty_yocto=setenv bootargs ${bootargs} "		\
57 		"console=ttyS${yocto_tty},${baudrate}\0"	\
58 	"addmtd=setenv bootargs ${bootargs} ${mtdparts}\0"	\
59 	"addmisc=setenv bootargs ${bootargs} "			\
60 		"intel-spi.writeable=1 vmalloc=300M "		\
61 		"pci=realloc=on,hpmemsize=0x12000000,"		\
62 		"hpmemprefsize=0,hpiosize=0\0"	    		\
63 	"bootcmd=if env exists recovery_status;"		\
64 		"then run swupdate;"				\
65 		"else run yocto_boot;run swupdate;"		\
66 		"fi\0"						\
67 	"ubuntu_args=setenv bootargs "				\
68 		"root=/dev/sda${ubuntu_part} ro\0"		\
69 	"ubuntu_args_quiet=setenv bootargs "			\
70 		"root=/dev/sda${ubuntu_part} ro quiet\0"	\
71 	"ubuntu_load=load scsi 0:${ubuntu_part} 03000000 "	\
72 		"/boot/vmlinuz-${kernel-ver};"			\
73 		"load scsi 0:${ubuntu_part} 04000000 "		\
74 		"/boot/initrd.img-${kernel-ver}\0"		\
75 	"ubuntu_boot=run ubuntu_args_quiet addmtd addmisc "	\
76 		"ubuntu_load boot\0"				\
77 	"ubuntu_boot_console=run ubuntu_args addtty_ubuntu "	\
78 		"addmtd addmisc ubuntu_load boot\0"		\
79 	"net_args=setenv bootargs root=/dev/sda${ubuntu_part} ro\0" \
80 	"net_boot=run start_eth net_args addtty_yocto addmtd addmisc;" \
81 		"tftp 03000000 ${tftpdir}/bzImage;"		\
82 		"load scsi 0:${ubuntu_part} 04000000 "		\
83 		"/boot/initrd.img-${kernel-ver};"		\
84 		"run boot\0"					\
85 	"yocto_args=setenv bootargs root=/dev/sda${yocto_part} " \
86 		"panic=1\0"				\
87 	"yocto_args_fast=setenv bootargs root=/dev/sda${yocto_part} " \
88 		"quiet panic=1\0"				\
89 	"yocto_boot=run yocto_args addmtd addmisc addtty_yocto;" \
90 		"if run yocto_load;then zboot 03000000;fi\0"	\
91 	"yocto_boot_fast=run yocto_args_fast addmtd addmisc "	\
92 		"addtty_yocto yocto_load;zboot 03000000\0"	\
93 	"yocto_boot_tftp=run yocto_args addmtd addmisc addtty_yocto " \
94 		"start_eth yocto_load_tftp;zboot 03000000\0"	\
95 	"yocto_kernel=bzImage\0"				\
96 	"yocto_load=load scsi 0:${yocto_part} 03000000 "	\
97 		"/boot/${yocto_kernel}\0"			\
98 	"yocto_load_tftp=tftp 03000000 dfi/bzImage\0"		\
99 	"swupdate=if env exists swupdate_factory;"		\
100 		"then run swupdate_usb;run swupdate_run;"	\
101 		"else setenv swupdate_part 2;run swupdate_mmc;" \
102 			"run swupdate_run;setenv swupdate_part 1;" \
103 			"run swupdate_mmc;run swupdate_usb;"	\
104 			"run swupdate_run;"			\
105 		"fi\0"						\
106 	"swupdate-initrd=/boot/swupdate-image-theadorable.ext4.gz\0" \
107 	"swupdate-kernel=/boot/bzImage\0"			\
108 	"swupdate_args=setenv bootargs root=/dev/ram rw panic=1\0" \
109 	"swupdate_dev=0\0"					\
110 	"swupdate_factory=0\0"					\
111 	"swupdate_interface=usb\0"				\
112 	"swupdate_kernel=vmlinuz-4.4.0-28-generic\0"		\
113 	"swupdate_load=load ${swupdate_interface} ${swupdate_dev}:" \
114 		"${swupdate_part} 03000000 ${swupdate-kernel}"	\
115 		" && load ${swupdate_interface} ${swupdate_dev}:" \
116 		"${swupdate_part} 04000000 ${swupdate-initrd}\0" \
117 	"swupdate_mmc=setenv swupdate_interface mmc;"		\
118 		"setenv swupdate_dev ${swupdate_mmcdev};"	\
119 		"setenv swupdate_part 1;"			\
120 		"mmc dev ${swupdate_dev};mmc rescan\0"		\
121 	"swupdate_mmcdev=0\0"					\
122 	"swupdate_part=1\0"					\
123 	"swupdate_run=run swupdate_args addtty_yocto addmtd addmisc;" \
124 		"if run swupdate_load;then run boot;"		\
125 		"else echo SWUpdate cannot be started from "	\
126 		"${swupdate_interface};"			\
127 		"fi\0"						\
128 	"swupdate_usb=setenv swupdate_interface usb;"		\
129 		"setenv swupdate_dev 0;setenv swupdate_part 1;"	\
130 		"usb start\0"					\
131 	"logo_tftp=tftp ${loadaddr} ${tftpdir}/logo.bmp;"	\
132 		"bmp display ${loadaddr}\0"			\
133 	"preboot=scsi scan;load scsi 0:${ubuntu_part} ${loadaddr} " \
134 		"/boot/logo/logo.bmp;bmp display ${loadaddr}\0" \
135 	"rootpath=/tftpboot/theadorable-x86-conga/work/"	\
136 		"rootfs-yocto-swupdate-2017-03-29\0"		\
137 	"addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:" \
138 		"${gatewayip}:${netmask}:${hostname}:eth0:off\0" \
139 	"set_bootargs_nfs=setenv bootargs root=/dev/nfs rw "	\
140 		"nfsroot=${serverip}:${rootpath},tcp,nfsvers=3\0" \
141 	"net_nfs=run start_eth set_bootargs_nfs addtty_yocto addip " \
142 		"addmtd addmisc;tftp 03000000 ${tftpdir}/bzImage;" \
143 		"zboot 03000000\0"				\
144 	"load_uboot=tftp ${loadaddr} ${tftpdir}/u-boot.rom\0"	\
145 	"update_uboot=sf probe;"				\
146 		"sf update ${loadaddr} 0 800000;saveenv\0"	\
147 	"upd_uboot=run start_eth load_uboot update_uboot\0"
148 
149 #endif /* __THEADORABLE_X86_COMMON_H */
150