-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy path移植最新版本3.4.2内核
154 lines (111 loc) · 7.75 KB
/
移植最新版本3.4.2内核
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
一. 内核启动流程,据此配置内核(机器ID)
1.1 修改Makefile
1.2 选择默认配置 : make s3c2410_defconfig
1.3 make uImage
步骤1:
在UBOOT里:
set machid 16a // smdk2440 mach-smdk2440.c
或
set machid 7CF // mini2440 mach-mini2440.c
步骤2:
arch\arm\mach-s3c24xx\mach-smdk2440.c
s3c24xx_init_clocks(16934400);
改为
s3c24xx_init_clocks(12000000);
步骤3:
配置/编译: make s3c2410_defconfig 或 make mini2440_defconfig
make uImage
步骤4:
在uboot里:set bootargs console=ttySAC0,115200 .....
uboot的默认MACH ID:
gd->bd->bi_arch_number = MACH_TYPE_SMDK2410; // 193
如果s = getenv("machid");成功,则使用它
否则使用默认的
set machid 16a // smdk2440 mach-smdk2440.c
set machid 7CF // mini2440 mach-mini2440.c
nfs 32000000 192.168.1.123:/work/nfs_root/uImage_new
bootm 32000000
二. 修改分区, 制作新的文件系统
nfs 30000000 192.168.1.123:/work/nfs_root/fs_mini_mdev.yaffs2
nand erase.part rootfs
nand write.yaffs 30000000 260000 889bc0
nfs 30000000 192.168.1.123:/work/nfs_root/fs_mini_mdev.jffs2
nand erase.part rootfs
nand write.jffs2 30000000 260000 $filesize
set bootargs console=ttySAC0,115200 root=/dev/mtdblock3 rootfstype=jffs2
制作文件系统
1. 交叉编译busybox
安装:make install CONFIG_PREFIX=/work/nfs_root/fs_mini_mdev_new
2. 安装库
mkdir /work/nfs_root/fs_mini_mdev_new/lib
mkdir /work/nfs_root/fs_mini_mdev_new/usr/lib -p
cp /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib/*so* /work/nfs_root/fs_mini_mdev_new/lib -d
cp /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/usr/lib/*so* /work/nfs_root/fs_mini_mdev_new/usr/lib -d
3. 构建etc目录
4. 构建dev目录
5. 其他空目录
mkfs.jffs2 -n -s 2048 -e 128KiB -d fs_mini_mdev_new -o fs_mini_mdev_new.jffs2
烧写:
nfs 30000000 192.168.1.123:/work/nfs_root/fs_mini_mdev_new.jffs2
nand erase.part rootfs
nand write.jffs2 30000000 260000 $filesize
set bootargs console=ttySAC0,115200 root=/dev/mtdblock3 rootfstype=jffs2
nfs 32000000 192.168.1.123:/work/nfs_root/uImage_new
bootm 32000000
SIGILL illegal instruction
6. 重新配置内核支持EABI
set bootargs console=ttySAC0,115200 root=/dev/mtdblock3 rootfstype=jffs2
nfs 32000000 192.168.1.123:/work/nfs_root/uImage_eabi
bootm 32000000
三. 移植YAFFS文件系统
1. 获得源码
git clone git://www.aleph1.co.uk/yaffs2
2. 打补丁
cd yaffs-dir
./patch-ker.sh c m linux-tree 比如 ./patch-ker.sh c m /work/system/linux-3.4.2
3. 配置内核支持YAFFS
4. 编译、使用uImage
5. 制作、烧写yaffs映象
mkyaffs2image fs_mini_mdev_new fs_mini_mdev_new.yaffs2
uboot:
nfs 30000000 192.168.1.123:/work/nfs_root/fs_mini_mdev_new.yaffs2
nand erase.part rootfs
nand write.yaffs 30000000 260000 $filesize
6. 启动
set bootargs console=ttySAC0,115200 root=/dev/mtdblock3
nfs 32000000 192.168.1.123:/work/nfs_root/uImage_yaffs
bootm 32000000
7. 没成功,用替代法查找问题
7.1 UBOOT可能有问题:换上1.1.6的UBOOT
tftp 30000000 u-boot.bin
nand erase.part u-boot
nand write 30000000 u-boot
reset
nfs 30000000 192.168.1.123:/work/nfs_root/fs_mini_mdev_new.yaffs2
nand erase rootfs
nand write.yaffs 30000000 260000 $(filesize)
set bootargs console=ttySAC0,115200 root=/dev/mtdblock3
nfs 32000000 192.168.1.123:/work/nfs_root/uImage_yaffs
bootm 32000000
发现1.1.6的UBOOT没问题,所以就是我们移植的新UBOOT有BUG:
drivers\mtd\nand\Nand_util.c
if (!need_skip && !(flags & WITH_DROP_FFS)) {
改为
if (!need_skip && !(flags & WITH_DROP_FFS) && !(flags & WITH_YAFFS_OOB)) {
7.2 YAFFS映象可能有问题
制作了u-boot_new.bin, uImage_new, fs_mini_mdev_new.yaffs
重烧整个系统:
使用jtag工具烧u-boot_new.bin
或使用uboot来更新自己: tftp 30000000 u-boot_new.bin; nand erase.part u-boot; nand write 30000000 u-boot
启动uboot,用它来烧写内核、FS
tftp 30000000 uImage_new; nand erase.part kernel; nand write 30000000 kernel
tftp 30000000 fs_mini_mdev_new.yaffs2; nand erase.part rootfs; nand write.yaffs 30000000 260000 $filesize
设置参数
set 'nand read 30000000 kernel;bootm 30000000'
set bootargs console=ttySAC0,115200 root=/dev/mtdblock3
set machid 16a
save
使用内核补丁:
patch -p1 < ../linux-3.4.2_100ask.patch
cp config_ok .config
make uImage