UBoot移植
UBoot版本:u-boot-2010.03.tar.bz2
ARCH: arm
CPU: arm1176
BOARD: samsung/smdk6410
SOC: s3c64xx
添加和裁剪源代码
添加相关文件夹和源代码:
1)创建文件夹:board/samsung/smdk6410; nand_spl/board/samsung/smdk6410。
2)复制board/samsung/smdk6400/下所有文件到board/samsung/smdk6410。
3)复制nand_spl/board/samsung/smdk6400下所有文件到nand_spl/board/samsung/smdk6410。
4)复制include/configs/smdk6400.h为include/configs/smdk6410.h。
去除不相关代码:
5)删除board文件下除samsung外所有文件夹以及board/ samsung/下smdk6410外所有文件夹。
6)删除nand_spl/board下除samsung外所有文件夹以及nand_spl/board/samsung/smdk6410外所有文件夹。
7)删除include/configs/下除smdk6410.h以外其他所有文件。
8)删除顶层目录下所有的lib_* 其他文件夹,只需要保留lib_arm 和 lib_generic。
9)删除cpu目录下所有其他文件夹,只需要保留arm1176文件夹。
10)删除include下所有其他的asm_* 文件夹,只需要asm_arm和asm-generic,
11)删除include/arm-asm下arch-s3c64x0以外其他所有arch-*格式目录。
12)删除根目录下没有用到的onenan_ipl文件夹。
顶层Makefile修改
仿照smdk6400 添加smdk6410的实现
smdk6410_config : unconfig
@echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
@echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6410/config.tmp
@$(MKCONFIG) $(@:_config=) arm arm1176 smdk6410 samsung s3c64xx
@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
修改board\sunplus\dtvb7056下文件
1)修改smdk6400.c为smdk6410.c,并修改board\samsung\smdk6410\Makefile中对应的文件名。
修改nand_spl/board/samsung/smdk6410 下文件
1)修改Makefile文件中6400为6410:@ln -s $(TOPDIR)/board/samsung/smdk6410/lowlevel_init.S $@
至此:可以测试是否可以编译通过 make distclean&&make smdk6410_config&&make;
修改smdk6410.h中相关设置
/*
* Hardware drivers
*/
//#define MACH_TYPE 1270 //smdk6400
#define MACH_TYPE 1626 //smdk6410 这个type必须和kernel的一致
#if 0
#define CONFIG_NET_MULTI
#define CONFIG_CS8900 /* we have a CS8900 on-board */
#define CONFIG_CS8900_BASE 0x18800300
#define CONFIG_CS8900_BUS16 /* follow the Linux driver */
#else
#define CONFIG_NET_MULTI
#define CONFIG_DRIVER_DM9000
#define CONFIG_DM9000_BASE 0x18000300
#define DM9000_IO CONFIG_DM9000_BASE
#define DM9000_DATA ( CONFIG_DM9000_BASE + 4 )
#endif
……
#define CONFIG_BOOTDELAY 3
#define CONFIG_ETHADDR 00:40:5c:26:0a:51
#define CONFIG_NETMASK 255.255.252.0
#define CONFIG_IPADDR 172.20.21.111
#define CONFIG_SERVERIP 172.20.9.11
#define CONFIG_GATEWAYIP 172.20.23.254
#define CONFIG_HOSTNAME "divser1"
#define CONFIG_BOOTFILE "uImage"
#define CONFIG_BOOTARGS \
"console=ttySAC0,115200 " \
"root=/dev/nfs rw nfsroot=172.20.9.11:/home/junxian/rootfs " \
"ip=172.20.21.110:172.20.9.11:172.20.23.254:255.255.252.0:" \
"hoxm:eth0:none"
#ifdef CONFIG_ENABLE_MMU
#define CONFIG_BOOTCOMMAND "nand read 0xc0018000 0x60000 0x1c0000;" \
"bootm 0xc0018000"
#else
#define CONFIG_BOOTCOMMAND "nand read 0x50018000 0x60000 0x1c0000;" \
"bootm 0x50018000"
#endif
添加Uboot DM9000网卡驱动
#ifdef CONFIG_CMD_NET
int board_eth_init(bd_t *bis)
{
int rc = 0;
126 #ifdef CONFIG_CS8900
rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
128 #endif
#ifdef CONFIG_DRIVER_DM9000
dm9000_initialize(bis);
#endif
return rc;
}
#endif
现在ping,tftp,等等命令已经好用,中间遇到的问题,有待研究:
1)ping命令可以,tftp命令停在loading #, 发现修改smdk6410 config时候写入的RAM_TEXT地址为MMU地址即好用RAM_TEXT = 0xc7e00000,只是编译的时候ext2部分报错,直接被我屏蔽了include/configs/smdk6410.h中对应的CONFIG_CMD_EXT2选项。
include/configs/smdk6410.h中地址和MMU相关定义如下:
TEXT_BASE在board/Samsung/smdk6410/config.mk中定义:TEXT_BASE=${RAM_TEXT}
#if !defined(CONFIG_NAND_SPL) && (TEXT_BASE >= 0xc0000000)
#define CONFIG_ENABLE_MMU
#endif
内核配置和编译
Kernel版本:2.6.35
CPU: arm1176 JZ-S
BOARD: 友坚6410 (基于samsung/smdk6410修改代码)
内核配置编译过程
修改顶层Makefile:ARCH和CROSS_COMPILE定义
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
内核清除:make mrproper(会清除配置好的.config文件和所有.o文件,如果干净的内核没有必要执行)
内核配置:make menuconfig (可以依据一个相近的配置cp arch/arm/configs/s3c6400_defconfig ./.config)
内核编译:make
添加DM9000网卡驱动
1)arch/arm/mach-s3c6410/mach-smdk6410.c
/* add eth dm9000 device*/
#include /*junxian@@@20100804 eth0 */
……
/* eth dm9000 */
#define S3C64XX_PA_DM9000 (0x1800030)
#define S3C64XX_VA_DM9000 S3C_ADDR_CPU(0x01000000)
#define S3C64XX_SZ_DM9000 SZ_1M
static struct resource smdk6410_dm9000_resources[] = {
[0] = {
.start = S3C64XX_PA_DM9000, /*端口地址应该根据板子情况而定*/
.end = S3C64XX_PA_DM9000 + 3,
.flags = IORESOURCE_MEM
},
[1] = {
.start = S3C64XX_PA_DM9000 + 4,
.end = S3C64XX_PA_DM9000 + 255,
.flags = IORESOURCE_MEM
},
[2] = {
.start = IRQ_EINT(7), /*中断号应该根据板子情况而定*/
.end = IRQ_EINT(7),
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
},
};
static struct dm9000_plat_data smdk6410_dm9000_pdata = {
.flags = DM9000_PLATF_16BITONLY
};
struct platform_device smdk6410_dm9000 = {
.name = "dm9000",
.id = -1,
.num_resources = ARRAY_SIZE(smdk6410_dm9000_resources),
.resource = smdk6410_dm9000_resources,
.dev = {
.platform_data = &smdk6410_dm9000_pdata,
}
};
……
/*修改地址映射*/
static struct map_desc smdk6410_iodesc[] = {
{
.virtual = (unsigned long)S3C64XX_VA_DM9000,
.pfn = __phys_to_pfn(S3C64XX_PA_DM9000),
.length = S3C64XX_SZ_DM9000,
.type = MT_DEVICE,
},
};
static struct platform_device *smdk6410_devices[] __initdata = {
#ifdef CONFIG_SMDK6410_SD_CH0
&s3c_device_hsmmc0,
#endif
#ifdef CONFIG_SMDK6410_SD_CH1
&s3c_device_hsmmc1,
#endif
&s3c_device_i2c0,
&s3c_device_i2c1,
&s3c_device_fb,
&s3c_device_usb,
&s3c_device_usb_hsotg,
&smdk6410_lcd_powerdev,
&smdk6410_dm9000, /*add for eth0 dm9000 init*/
};
NFS rootfs相关配置
1、devices support 中打开DM9000支持
2、打开filsystem 中nfs的相关支持
--- Network File Systems
│ │ <*> NFS client support
│ │ [*] NFS client support for NFS version 3
│ │ [ ] NFS client support for the NFSv3 ACL protocol extension
│ │ [*] NFS client support for NFS version 4 (EXPERIMENTAL)
│ │ [ ] NFS client support for NFSv4.1 (DEVELOPER ONLY)
│ │ [*] Root file system on NFS
备注:Linux启动参数(uboot bootargs传递过来的)
"console=ttySAC0,115200 root=/dev/nfs rw nfsroot=172.20.118.103:/work/workspace/s3c6410/rootfs ip=172.20.118.193:172.20.118.103:172.20.118.254:255.255.255.0:hoxm:eth0:none"
停在Starting kernel问题解决
常见原因:
1)地址错误
2)Boot参数设置错误
3)串口fifo设置不必配(本次移植就是因为这个原因)
\arch\arm\mach-s3c6400\include\mach\uncompress.h 中添加uart fifo配置
static void arch_detect_cpu(void)
{
/* we do not need to do any cpu detection here at the moment. */
fifo_mask = S3C_UFSTAT_TXMASK;
fifo_max = 63 << S3C_UFSTAT_TXSHIFT;
}
根文件系统建立
Download busybox
#make menuconfig
#make
#make install
busybox make,如果出现找不到crypt m库的错误提示Trying libraries: crypt m Library crypt is needed, can't exclude it (yet) Library m is needed, can't exclude it (yet) Final link with: crypt m,可以不必理会,直接make install
编译bash
export CC=arm-sunplus-linux-gnueabi-gcc
./configure --host=arm-sunplus-linux-gnueabi --enable-static-link --without-bash-malloc
make
make之后源码包顶层目录下生成bash,不用make install,直接copy到busybox的/bin目录
最简单的默认使用sh的根文件系统制作:
busybox生成: /bin /sbin /usr/bin /usr/sbin
mk空目录:mkdir dev etc home lib mnt opt proc sys tmp var
busybox /examples copy /etc下inittab,fstab,rc等相关脚本覆盖到/etc中
阅读(5001) | 评论(0) | 转发(0) |