s3c2440 移值新内核 linux-4.1.36

2023-09-01  

arm-linuxgcc version 4.3.2 经过试验,最高可以编译到 linux-4.1.36 ,在高的版本会有错误 ,可能是 GCC 编译器版本较低造成。


解压比较麻烦还要装一个 xz xz -d ,我是用 7z-zip 在电脑上解好,传 tar 上去解包。

修改 makefile

ARCH ?= arm

CROSS_COMPILE ?= arm-linux-


find -name *24*_defconfig 查找出来有的配置项

./arch/arm/configs/s3c2410_defconfig

./arch/arm/configs/mini2440_defconfig


s3c2410_defconfig 也包含 2440 machid

vi /arch/arm/mach-s3c24xx/mach-smdk2440.c 修改 晶振为 12000000

vi /arch/arm/mach-s3c24xx/common-smdk.c 修改 nand flash 分区信息


 1 static struct mtd_partition smdk_default_nand_part[] = {

 2     [0] = {

 3         .name    = "uboot",

 4         .size    = SZ_256K,

 5         .offset    = 0,

 6     },

 7     [1] = {

 8         .name    = "env",

 9         .offset = MTDPART_OFS_APPEND,

10         .size    = SZ_128K,

11     },

12     [2] = {

13         .name    = "kernel",

14         .offset = MTDPART_OFS_APPEND,

15         .size    = SZ_2M,

16     },

17     [3] = {

18         .name    = "rootfs",

19         .offset    = MTDPART_OFS_APPEND,

20         .size    = MTDPART_SIZ_FULL,

21     }

22 };


make s3c2410_defconfig

make menuconfig

启用 EABI

[*] Use the ARM EABI to compile the kernel

[*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)

make uImage

Image arch/arm/boot/uImage is ready

cp arch/arm/boot/uImage /nfs_fs


查看 u-boot 2016 中配置的机器 ID

/arch/arm/lib/bootm.c boot_jump_linux()

从 gd 中取出来

unsigned long machid = gd->bd->bi_arch_number;


在 /board/samsung/smdk2440/smdk2440.c 中进行设置


/arch/arm/include/asm/mact-types.h 中定义

#define MACH_TYPE_SMDK2410 193


s = getenv("machid");

从 env 中取出来


随意乱设个 machid 启用就会报错,显示出来所有 可用的 machid

set machid 12345

nfs 0x32000000 192.168.1.100:/nfs_fs/uImage;bootm 0x32000000


因为是未知的 machid 所以报错

000007cf MINI2440

0000016a SMDK2440


..........

set machid 16a


加上波特率配置,不加也会乱码

set bootargs root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200


bdinfo  可以查看 gd 信息


开启串口调试,有错误就能显示出来,否则什么也不显示。不知道哪里出错了。

Device Drivers

Character devices

Serial drivers

Samsung SoC serial debug


制作 文件系统 参考之前的博文 http://www.cnblogs.com/ningci/p/5261567.html


1, 制作 jffs2 文件系统

mkfs.jffs2 -n -s 2048 -e 128KiB -d new_1.24 -o new_1.24.jffs2


nfs 0x30000000 192.168.1.100:/nfs_fs/new_1.24.jffs2

nand erase.part root

nand write.jffs2 0x30000000 260000 3bc24c


set bootargs root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200 rootfstype=jffs2

set machid 16a

nfs 0x30000000 192.168.1.100:/nfs_fs/uImage;bootm 0x30000000


烧写试验 能挂载文件系统 


2, 添加 yaffs2 支持

http://www.yaffs.net/

git clone git://www.aleph1.co.uk/yaffs2

下载解压,打补丁

./patch-ker.sh c m /home/linux-4.1.24

make uImage

fs/yaffs2/yaffs_vfs.c: In function 'yaffs_readpage_nolock':

fs/yaffs2/yaffs_vfs.c:286: error: 'struct file' has no member named 'f_dentry'

fs/yaffs2/yaffs_vfs.c: In function 'yaffs_hold_space':

fs/yaffs2/yaffs_vfs.c:484: error: 'struct file' has no member named 'f_dentry'

fs/yaffs2/yaffs_vfs.c: In function 'yaffs_release_space':

fs/yaffs2/yaffs_vfs.c:502: error: 'struct file' has no member named 'f_dentry'

fs/yaffs2/yaffs_vfs.c: In function 'yaffs_file_write':

fs/yaffs2/yaffs_vfs.c:594: error: 'struct file' has no member named 'f_dentry'

fs/yaffs2/yaffs_vfs.c:606: error: 'struct file' has no member named 'f_dentry'

fs/yaffs2/yaffs_vfs.c: In function 'yaffs_file_flush':

fs/yaffs2/yaffs_vfs.c:730: error: 'struct file' has no member named 'f_dentry'

fs/yaffs2/yaffs_vfs.c: At top level:

fs/yaffs2/yaffs_vfs.c:780: error: 'new_sync_read' undeclared here (not in a function)

fs/yaffs2/yaffs_vfs.c:781: error: 'new_sync_write' undeclared here (not in a function)

fs/yaffs2/yaffs_vfs.c: In function 'yaffs_iterate':

fs/yaffs2/yaffs_vfs.c:1730: error: 'struct file' has no member named 'f_dentry'

make[2]: *** [fs/yaffs2/yaffs_vfs.o] Error 1

make[1]: *** [fs/yaffs2] Error 2

make: *** [fs] Error 2


fs/yaffs2/yaffs_vfs.c 中 file 结构体定义变了

f_dentry 替换为 f_path.dentry



780 缺少函数


搜了一下有这个函数 /fs/read_write.c

static ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos)

前面加有 static 外面用不了,经过试验,发现不使用这2行也正常工作。所以改为如下。

#if 0

.read = new_sync_read,

.write = new_sync_write,

#endif


制作 yaffs2 文件

mkyaffs2image new_1.24 new_1.24.yaff2


nfs 0x30000000 192.168.1.100:/nfs_fs/new_1.24.yaff2

nand erase.part root

nand write.yaffs 0x30000000 260000 797640


set bootargs root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200

set machid 16a

nfs 0x30000000 192.168.1.100:/nfs_fs/uImage;bootm 0x30000000


linux-3.4.112 正常,不用任何修改,打上 yaffs 补丁就能使用

yaffs 操作比 jfss 快不少。

最后 内核裁剪,没难度,去掉不用的东西变小就行。


文章来源于:电子工程世界    原文链接
本站所有转载文章系出于传递更多信息之目的,且明确注明来源,不希望被转载的媒体或个人可与我们联系,我们将立即进行删除处理。