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