xu4源码及编译流程

一、环境配置:

1、在linux的根目录下创建名为toolchains的文件夹,用于保存交叉编译软件;

2、拷贝gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.gz到toolchains文件夹下;

3、 解压

4、tar –xvfgcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.gz

5、配置环境变量,在~目录下,使用vim打开名为.bashrc的文件,添加如下环境变量:

export CROSS_TOOLCHAIN=
/toolchains/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin/
export CROSS_COMPILE=arm-linux-gnueabihf-
export PATH:=:${PATH}:${CROSS_TOOLCHAIN}
export CROSS_CC=${CROSS_COMPILE}gcc
export CROSS_LD=${CROSS_COMPILE}ld
export CROSS_AR=${CROSS_COMPILE}ar
export CROSS_GDB=${CROSS_COMPILE}gdb
export CROSS_ADDR2LINE=${CROSS_COMPILE}addr2line
export TOOLCHAINS=CROSS_COMPILE=
${CROSS_COMPILE} CC=${CROSS_CC}



; waitln "Hit any key to stop autoboot"
; sendln "\"

include 'verify_env.ttl'
pause 1
sendln ENV_CMD SPACE ENVCYCLE SPACE VarCycle
waitln EMMC_COMMAND_PASS

sendln ENV_CMD SPACE ENVVERIFYCOMPARE SPACE VarVerifyCompare
waitln EMMC_COMMAND_PASS

sendln ENVSAVE_CMD
waitln EMMC_COMMAND_PASS

; include "init.ttl"

; get the date and time
gettime starttime "%Y%m%d-%H%M%S"

inputstr = ''
fileopen logdirfile "logdirfile.ini" 0 0
filereadln logdirfile line
fileclose logdirfile

if result = 0 then
	filedelete "logdirfile.ini"
endif

dirnamebox 'select a directory'
if result<>0 then
	messagebox inputstr 'selected Logdir directory'
	fileopen logdirfile "logdirfile.ini" 0 0
	filewrite logdirfile inputstr
	fileclose logdirfile
endif

changedir inputstr

fileopen verify_list_name 'verify_list.ttl' 0


VarCycle = "500"
ENVCYCLE = "cycle"
VarVerifyCompare = "1000"
ENVVERIFYCOMPARE = "verify_compare"

ENV_CMD = "env"
ENVSAVE_CMD = "env save"
SPACE = ' '
EMMC_COMMAND_PASS = "Passed"
EMMC_COMMAND_FAIL = "Failed"

APBOOTPROMP = "apboot #"
FAIL_STOP = 0
verifyresult = 1


verify basic_func cmd0 idle_to_idle_tran
verify basic_func cmd0 idle_to_idle_cmd0
verify basic_func cmd0 bus_reset_by_cmd0_case1
verify basic_func cmd0 bus_reset_by_cmd0_case2
verify basic_func cmd0 bus_reset_by_cmd0_case3
{ \
		"verify basic_func cmd0 idle_to_idle_tran", \
		"verify basic_func cmd0 idle_to_idle_tran\n", \
		"mmc verify basic_func cmd0 idle_to_idle_tran\n", \
		do_mmc_verify_basic_func_cmd0_idle_to_idle_tran \
	}, \

const uchar default_environment[] = {#ifdef	CONFIG_CLOCKS_IN_MHZ
	"clocks_in_mhz=1\0"
#endif
#if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0)
	"pcidelay="	MK_STR(CONFIG_PCI_BOOTDELAY)	"\0"
#endif
#ifdef	CONFIG_ENV_VARS_UBOOT_CONFIG
	"arch="		CONFIG_SYS_ARCH			"\0"
	"cpu="		CONFIG_SYS_CPU			"\0"
	"board="	CONFIG_SYS_BOARD		"\0"
#ifdef CONFIG_SYS_VENDOR
	"vendor="	CONFIG_SYS_VENDOR		"\0"
#endif
#ifdef CONFIG_SYS_SOC
	"soc="		CONFIG_SYS_SOC			"\0"
#endif
#endif
#ifdef CONFIG_AP_ENV_SETTINGS
	CONFIG_AP_ENV_SETTINGS
#endif
#ifdef CONFIG_MMC_ENV_SETTINGS
	CONFIG_MMC_ENV_SETTINGS
#endif
#ifdef	CONFIG_EXTRA_ENV_SETTINGS
	CONFIG_EXTRA_ENV_SETTINGS
	"\0"
#endif

#define CONFIG_MMC_ENV_SETTINGS \
         MMC_ENV_CLKSAMPLE"="   MK_STR(MMC_CLKSAMPLE)           "\0" \
         MMC_ENV_RCA"="   MK_STR(MMC_RCA)			"\0" \
	 MMC_ENV_DEVICETYPE"="	MK_STR(MMC_DEVICETYPE)		"\0" \
	 MMC_ENV_BUSWIDTH"="	MK_STR(MMC_BUSWIDTH)		"\0" \
	 MMC_ENV_CLK"="	MK_STR(MMC_CLK)		"\0" \
	 MMC_ENV_VERIFY_CYCLE"="MK_STR(MMC_VERIFY_CYCLE)	"\0" \
	 MMC_ENV_VERIFY_DEBUG"="MK_STR(MMC_VERIFY_DEBUG)	"\0" \
	 MMC_ENV_PACC"="MK_STR(MMC_PACC)			"\0" \
	 MMC_ENV_RPMB_KEY"="MK_STR(MMC_RPMB_KEY)			"\0" \
	 MMC_ENV_CMDDELAY"="MK_STR(MMC_CMDDELAY)			"\0" \
	 MMC_ENV_RST_N_DELAY"="MK_STR(MMC_RST_N_DELAY)			"\0" \
	 MMC_ENV_VERIFY_COMPARE"="MK_STR(MMC_VERIFY_COMPARE)	"\0" \
	 MMC_ENV_CMD13_DELAY"="MK_STR(MMC_CMD13_DELAY)	"\0" \
	 MMC_ENV_HW_ID"="MMC_HW_ID			"\0"

#define MMC_ENV_VERIFY_CYCLE "cycle"
#define MMC_VERIFY_CYCLE	1000
const uchar default_environment[] = {
#ifdef CONFIG_SYS_SOC
	"soc="		CONFIG_SYS_SOC			"\0"
#endif
#endif
#ifdef CONFIG_AP_ENV_SETTINGS
	CONFIG_AP_ENV_SETTINGS
#endif
#ifdef CONFIG_MMC_ENV_SETTINGS
	CONFIG_MMC_ENV_SETTINGS
#endif
#ifdef	CONFIG_EXTRA_ENV_SETTINGS
	CONFIG_EXTRA_ENV_SETTINGS
	"\0"
#endif
};
int do_mmc_env(struct mmc* mmc, int argc, char *argv[])
{
	int ret = AP_SUCCESS;
	int i;
	const char *AP_ENV_MAP[] = {
		MMC_ENV_CLKSAMPLE,
		MMC_ENV_RCA,
		MMC_ENV_CLK,
		MMC_ENV_DEVICETYPE,
		MMC_ENV_BUSWIDTH,
		MMC_ENV_VERIFY_CYCLE,
		MMC_ENV_VERIFY_DEBUG,
		AP_ENV_CDBG,
		MMC_ENV_PACC,
		MMC_ENV_RPMB_KEY,
		MMC_ENV_CMDDELAY,
		MMC_ENV_RST_N_DELAY,
		MMC_ENV_VERIFY_COMPARE,
		MMC_ENV_CMD13_DELAY,
	};

	int env_map_size = sizeof(AP_ENV_MAP)/sizeof(AP_ENV_MAP[0]); 
	char cmd_env[128];
	enum{
		MMC_CMD_MIN,
		MMC_CMD_ENV,
		MMC_CMD_VALUE,
	};	
	memset(cmd_env,0,sizeof(cmd_env));
	if(argc == (MMC_CMD_ENV + 1)){
		if((!strcmp(argv[MMC_CMD_ENV],"save")) || (!strcmp(argv[MMC_CMD_ENV],"s"))){
			ret = run_command("save",0);
#if (AP_LOCK == 0)
		}else if((!strcmp(argv[MMC_CMD_ENV],"default")) || (!strcmp(argv[MMC_CMD_ENV],"d"))){	
			sprintf(cmd_env,"env default -f");
			ret = run_command(cmd_env,0);
#endif
		}else{
			sprintf(cmd_env,"printenv %s",argv[MMC_CMD_ENV]);
			ret = run_command(cmd_env,0);
		}
	}else if(argc > (MMC_CMD_ENV + 1)){
		char env_para[128];
		memset(env_para,0,sizeof(env_para));
		for(i = MMC_CMD_VALUE; i < argc; i++){
			strcat(env_para,argv[i]);
			strcat(env_para," ");
		}
		sprintf(cmd_env,"setenv %s %s", argv[MMC_CMD_ENV], env_para);
		printf("Set %s=%s\n",argv[MMC_CMD_ENV],env_para);
		ret = run_command(cmd_env,0);
	}else{
		for(i = 0; i< env_map_size; i++){
			sprintf(cmd_env,"printenv %s", AP_ENV_MAP[i]);
			ret = run_command(cmd_env,0);
		}
	}
	return ret;
}

#ifndef _MMC_VER_INIT_H_
#define _MMC_VER_INIT_H_

int do_mmc_verify_mmc_init(struct mmc* mmc, int argc, char *argv[]);

#define MMC_VERIFY_INIT \
	{ \
		"mmc init", \
		"help-verify mmc init\n", \
		"detail-verify mmc init\n", \
		do_mmc_verify_mmc_init \
	}
#endif

#include 
#include 
#include 
#include 
#include 
#include 
#include 


int do_mmc_verify_mmc_init(struct mmc* mmc, int argc, char *argv[])
{
		cdbg_printf(CDBG_ERR_LEVEL, "Init MMC Success!\n");
		return AP_SUCCESS;
}

#endif
#ifdef CONFIG_MMC_VERIFY_INIT
#include 
#endif

#ifdef CONFIG_MMC_VERIFY_INIT
	MMC_VERIFY_INIT,
#endif
COBJS-$(CONFIG_MMC_VERIFY_FFU) += $(shell pwd)/verify/init_mmc/mmc_init.o






你可能感兴趣的:(linux)