一 在commond
env_nand.c: In function 'saveenv':
env_nand.c:196: error: stray '#' in program
env_nand.c:196: error: expected ')' before 'define'
env_nand.c:196: error: too few arguments to function 'nand_erase'
env_nand.c:201: error: stray '#' in program
env_nand.c:201: error: expected ')' before 'define'
env_nand.c:201: error: too few arguments to function 'nand_write'
env_nand.c: In function 'env_relocate_spec':
env_nand.c:276: error: stray '#' in program
env_nand.c:276: error: expected ')' before 'define'
env_nand.c:276: error: too few arguments to function 'nand_read'
make[1]: *** [env_nand.o] 错误 1
make[1]:正在离开目录 `/home/cgc/yangshanjin/u-boot-1.1.6_3/common
make: *** [common/libcommon.a] 错误 2
因此 我就把有错误的语句注释掉,即196 201 276
二 上面问题搞定,我用注释的办法
现在 又有问题如下
/gcc/arm-none-linux-gnueabi/4.3.3/armv4t/libgcc.a(_udivdi3.o) has EABI version
5, but target u-boot has EABI version 0
arm-linux-ld: failed to merge target specific data of file
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/armv4t/libgcc.a(_udivdi3.o)
arm-linux-ld: error: Source object
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/armv4t/libgcc.a(_udivsi3.o)
has EABI version 5, but target u-boot has EABI version 0
arm-linux-ld: failed to merge target specific data of file
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/armv4t/libgcc.a(_udivsi3.o)
arm-linux-ld: error: Source object
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/armv4t/libgcc.a(_dvmd_lnx.o)
has EABI version 5, but target u-boot has EABI version 0
arm-linux-ld: failed to merge target specific data of file
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/armv4t/libgcc.a(_dvmd_lnx.o)
arm-linux-ld: error: Source object
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/armv4t/libgcc.a(_clz.o)
has EABI version 5, but target u-boot has EABI version 0
arm-linux-ld: failed to merge target specific data of file
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/armv4t/libgcc.a(_clz.o)
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/armv4t/libgcc.a(_udivdi3.o):(.ARM.exidx+0x0):
undefined reference to `__aeabi_unwind_cpp_pr0'
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/armv4t/libgcc.a(_dvmd_lnx.o):
In function `__aeabi_ldiv0':
(.text+0x8): undefined reference to `raise'
make: *** [u-boot] 错误1
解决办法 我修改办法
修改cpu/arm920t/config.mk文件中的
PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common
-ffixed-r8 \
-msoft-float
改为
PLATFORM_RELFLAGS += -fno-strict-aliasing
-fno-common -ffixed-r8
还是一样的错误
我的参考网站http://bbs.chinaunix.net/forum.php?mod=viewthread&action=printable&tid=1938330
解决办法(成功)在顶层Makefile
把CROSS_COMPILE=…………(你的交叉编译器),改为:CROSS_COMPILE=/opt/EmbedSky /crosstools_3.4.5_softloat/gcc-3.4.5-glibc-2.3.6/arm-linux/bin/arm-linux-
就可正常编译成功。
无打印信息。参考网站http://www.armbbs.net/forum.php?mod=viewthread&tid=6442
我的修改一
在include/configs/YSJ2440.h里修改#define CONFIG_SMDK2440 1
#define CONFIG_S3C2440 1 我已经改回来了
要不的话就会报错
修改二 在include/s3c2410.h 中添加了 #include <s3c2440.h>
我把s3c2440.h删除掉了,因为其作用是跟s3c24x0.h是一样的
今天发现configs/YSJ2440.h是应该许多预编译中变量的定义,还有s3c2410.h里包含了s3c24x0.h
我把YSJ2440.C board_init函数中对于s3c2410的时钟设置消去,用if(0)
我把cpu/arm920t/s3c24x0/nand_flash.c有关2410的nand_flash都注释掉
出现错误
nand_flash.c: In function `board_nand_init':
nand_flash.c:140: error: `s3c2410_nand_hwcontrol' undeclared (first use in this
function)
nand_flash.c:140: error: (Each undeclared identifier is reported only once
nand_flash.c:140: error: for each function it appears in.)
nand_flash.c:141: error: `s3c2410_nand_devready' undeclared (first use in this
function)
nand_flash.c:142: error: `s3c2410_nand_select_chip' undeclared (first use in
this function)
make[1]: *** [nand_flash.o] 错误 1
make[1]:正在离开目录 `/home/cgc/yangshanjin/u-boot-1.1.6_3/cpu/arm920t/s3c24x0'
现在复原
我修改了cpu/arm920t/start.S中的160行 把bl cpu_init_crit注释掉
接着修改/board/YSJ2440/config.mk中TEXT_BASE 值为0x33000000
还是搞回来
修改
relocate:
adrr0, _start
ldrr1, _TEXT_BASE
cmp r0, r1
beq clear_bss
@ldr r2, _armboot_start
ldr r1,_armboot_start
ldrr3, _bss_start
subr2, r3, r2
#if 1
bl CopyCode2Ram
#else
addr2, r0, r2
copy_loop:
ldmiar0!, {r3-r10}
stmiar1!, {r3-r10}
cmpr0, r2
ble copy_loop
#endif
#endif
我把上面的ldr r1, r1,_armboot_start 修改为mov r1,#0x33f80000 但是报错 start.S:181: Error: invalid constant -- `mov r1,#0x33f80000' 原来是精简指令问题
我改成ldr r1,=0x33f80000,就可以了 ,但是还是启动不了内核,
start.S 设置完中断向量表后 , 加上这句是什么意思
.balignl 16,0xdeadbeef
#if 1 //HJ_add_start
int getc_errno = 0;
__u8 do_getc(unsigned long timeout, int *statp)
{
__u8 c, rxstat;
int do_timeout = timeout != 0;
S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR);
getc_errno = 0;
while(!(uart->UTRSTAT & 0x1)) {
if (do_timeout) {
if (!timeout)
break;
timeout--;
}
}
if (do_timeout && timeout == 0) {
c = 0;
rxstat = -1;
} else {
c = (uart->URXH & 0xff);
rxstat = (uart->UERSTAT & 0xf);
}
if (rxstat) {
getc_errno = rxstat;
if (statp)
*statp = rxstat;
}
return (c);
}
char awaitkey2(unsigned long delay, int* error_p)
{
return (do_getc(delay, error_p));
}
#endif //HJ_add_end
在天嵌的uboot里serial.c里多出了这两个函数,待查
我在u-boot-1.1.6_3的cpu/arm920t/speed.c中把函数应该返回的值都用自己认为的值代替,结果可以了。我查了一些,好像MPLLCON在speed.c中没有赋值,是在boot_init中有赋值。具体的自己查查。
这里可以支持nand flash.
1.修改include/configs/Prodigal.h文件
增加NAND 命令:CFG_CMD_NAND | \
#define CFG_ENV_IS_IN_NAND 1
#define CFG_ENV_OFFSET 0x40000
#define CFG_ENV_SIZE 0x20000
#define CFG_NAND_BASE 0
#define CFG_MAX_NAND_DEVICE 1
#define NAND_MAX_CHIPS 1
2.添加nand_flash.c文件到cpu/arm920t/s3c24x0/目录
(建议直接拷贝TQ做好的nand_flash.c文件)
同时修改该目录下的 Makefile:
COBJS = i2c.o interrupts.o serial.o speed.o usb_ohci.o nand_flash.o
3.修改include/s3c24x0.h文件,增加S3C2440_NAND结构体
(在nand_flash.c文件中有用到)
typedef struct {
S3C24X0_REG32 NFCONF;
S3C24X0_REG32 NFCONT;
S3C24X0_REG32 NFCMD;
S3C24X0_REG32 NFADDR;
S3C24X0_REG32 NFDATA;
S3C24X0_REG32 NFMECCD0;
S3C24X0_REG32 NFMECCD1;
S3C24X0_REG32 NFSECCD;
S3C24X0_REG32 NFSTAT;
S3C24X0_REG32 NFESTAT0;
S3C24X0_REG32 NFESTAT1;
S3C24X0_REG32 NFMECC0;
S3C24X0_REG32 NFMECC1;
S3C24X0_REG32 NFSECC;
S3C24X0_REG32 NFSBLK;
S3C24X0_REG32 NFEBLK;
} S3C2440_NAND;
4、同时在 include/s3c2410.h 中添加(在nand_flash.c文件中有用到)
static inline S3C2440_NAND * const S3C2440_GetBase_NAND(void)
{
return (S3C2440_NAND * const)S3C2410_NAND_BASE;
}
把配置文件configs/YSJ2440.h的分区改为天嵌的uboot 暂时不改
之前添加了天嵌的boot_zImage.c文件,我在command/main.c
400行中调用了do_boot_zImage() 里面的参数都被我删除了
,本想用这个来启动内核,现在改回原型,包括Makefile
参考网站http http://blog.csdn.net/ce123/article/details/7336810 把cmd_bootm.c中的第175行开始删除linux的头部校验;
printf ("## Booting image at lx ...\n", addr);
#ifdef CONFIG_HAS_DATAFLASH
if (addr_dataflash(addr)){
read_dataflash(addr, sizeof(image_header_t), (char *)&header);
} else
#endif
memmove (&header, (char *)addr, sizeof(image_header_t));
if (ntohl(hdr->ih_magic) != IH_MAGIC) {
#ifdef __I386__
if (fake_header(hdr, (void*)addr, -1) != NULL) {
addr -= sizeof(image_header_t);
verify = 0;
} else
#endif
{
puts ("Bad Magic Number\n");
SHOW_BOOT_PROGRESS (-1);
return 1;
}
}
SHOW_BOOT_PROGRESS (2);
data = (ulong)&header;
len = sizeof(image_header_t);
checksum = ntohl(hdr->ih_hcrc);
hdr->ih_hcrc = 0;
if (crc32 (0, (uchar *)data, len) != checksum) {
puts ("Bad Header Checksum\n");
SHOW_BOOT_PROGRESS (-2);
return 1;
}
SHOW_BOOT_PROGRESS (3);
#ifdef CONFIG_HAS_DATAFLASH
if (addr_dataflash(addr)){
len = ntohl(hdr->ih_size) + sizeof(image_header_t);
read_dataflash(addr, len, (char *)CFG_LOAD_ADDR);
addr = CFG_LOAD_ADDR;
}
#endif
print_image_hdr ((image_header_t *)addr);
data = addr + sizeof(image_header_t);
len = ntohl(hdr->ih_size);
if (verify) {
puts (" Verifying Checksum ... ");
if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
printf ("Bad Data CRC\n");
SHOW_BOOT_PROGRESS (-3);
return 1;
}
puts ("OK\n");
}
SHOW_BOOT_PROGRESS (4);
len_ptr = (ulong *)data;
#if defined(__PPC__)
if (hdr->ih_arch != IH_CPU_PPC)
#elif defined(__ARM__)
if (hdr->ih_arch != IH_CPU_ARM)
#elif defined(__I386__)
if (hdr->ih_arch != IH_CPU_I386)
#elif defined(__mips__)
if (hdr->ih_arch != IH_CPU_MIPS)
#elif defined(__nios__)
if (hdr->ih_arch != IH_CPU_NIOS)
#elif defined(__M68K__)
if (hdr->ih_arch != IH_CPU_M68K)
#elif defined(__microblaze__)
if (hdr->ih_arch != IH_CPU_MICROBLAZE)
#elif defined(__nios2__)
if (hdr->ih_arch != IH_CPU_NIOS2)
#elif defined(__blackfin__)
if (hdr->ih_arch != IH_CPU_BLACKFIN)
#elif defined(__avr32__)
if (hdr->ih_arch != IH_CPU_AVR32)
#else
# error Unknown CPU type
#endif
{
printf ("Unsupported Architecture 0x%x\n", hdr->ih_arch);
SHOW_BOOT_PROGRESS (-4);
return 1;
}
SHOW_BOOT_PROGRESS (5);
switch (hdr->ih_type) {
case IH_TYPE_STANDALONE:
name = "Standalone Application";
if (argc > 2) {
hdr->ih_load = htonl(simple_strtoul(argv[2], NULL, 16));
}
break;
case IH_TYPE_KERNEL:
name = "Kernel Image";
break;
case IH_TYPE_MULTI:
name = "Multi-File Image";
len = ntohl(len_ptr[0]);
data += 8;
for (i=1; len_ptr[i]; ++i)
data += 4;
break;
default: printf ("Wrong Image Type for %s command\n", cmdtp->name);
SHOW_BOOT_PROGRESS (-5);
return 1;
}
SHOW_BOOT_PROGRESS (6);
iflag = disable_interrupts();
#ifdef CONFIG_AMIGAONEG3SE
icache_disable();
invalidate_l1_instruction_cache();
flush_data_cache();
dcache_disable();
#endif
switch (hdr->ih_comp) {
case IH_COMP_NONE:
if(ntohl(hdr->ih_load) == addr) {
printf (" XIP %s ... ", name);
} else {
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
size_t l = len;
void *to = (void *)ntohl(hdr->ih_load);
void *from = (void *)data;
printf (" Loading %s ... ", name);
while (l > 0) {
size_t tail = (l > CHUNKSZ) ? CHUNKSZ : l;
WATCHDOG_RESET();
memmove (to, from, tail);
to += tail;
from += tail;
l -= tail;
}
#else
memmove ((void *) ntohl(hdr->ih_load), (uchar *)data, len);
#endif
}
break;
case IH_COMP_GZIP:
printf (" Uncompressing %s ... ", name);
if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
(uchar *)data, &len) != 0) {
puts ("GUNZIP ERROR - must RESET board to recover\n");
SHOW_BOOT_PROGRESS (-6);
do_reset (cmdtp, flag, argc, argv);
}
break;
#ifdef CONFIG_BZIP2
case IH_COMP_BZIP2:
printf (" Uncompressing %s ... ", name);
i = BZ2_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
&unc_len, (char *)data, len,
CFG_MALLOC_LEN < (4096 * 1024), 0);
if (i != BZ_OK) {
printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
SHOW_BOOT_PROGRESS (-6);
udelay(100000);
do_reset (cmdtp, flag, argc, argv);
}
break;
#endif
default:
if (iflag)
enable_interrupts();
printf ("Unimplemented compression type %d\n", hdr->ih_comp);
SHOW_BOOT_PROGRESS (-7);
return 1;
}
puts ("OK\n");
SHOW_BOOT_PROGRESS (7);
switch (hdr->ih_type) {
case IH_TYPE_STANDALONE:
if (iflag)
enable_interrupts();
if (((s = getenv("autostart")) != NULL) && (strcmp(s,"no") == 0)) {
char buf[32];
sprintf(buf, "%lX", len);
setenv("filesize", buf);
return 0;
}
appl = (int (*)(int, char *[]))ntohl(hdr->ih_ep);
(*appl)(argc-1, &argv[1]);
return 0;
case IH_TYPE_KERNEL:
case IH_TYPE_MULTI:
break;
default:
if (iflag)
enable_interrupts();
printf ("Can't boot image type %d\n", hdr->ih_type);
SHOW_BOOT_PROGRESS (-8);
return 1;
}
SHOW_BOOT_PROGRESS (8);
在lib_arm/armlinux.c中修改内核启动地址,在第93列改为theKernel = (void (*)(int,int,uint))addr;
可以正常启动linux了,