s5pv210 移植Linux Kernel 4.19 启动NFS 文件系统记录

一、Linux内核移植

参考 https://blog.csdn.net/hanxiaohuaa/article/details/105420669

(1)uboot2018 烧录到SD卡
seek = 1,代表SD卡的block1
/dev , 该目录就和windows下的设备管理器一样,会显示所有的设备, SD卡显示为" /dev/sdb"
烧录到SD卡,先烧录 u-boot-16k.bin, 再烧录 u-boot.bin, uboot2018资源下载地址

sudo dd iflag=dsync oflag=dsync if=./u-boot-16k.bin of=/dev/sdb seek=1
sudo dd iflag=dsync oflag=dsync if=u-boot.bin of=/dev/sdb seek=49

(2)编译uboot2018
编译uboot2018,自己生成 u-boot-16k.bin, u-boot.bin,下载地址

  • 编译uboot2018
make clean
make distclean
make smdkv210_defconfig
make
  • 生成16k制作工具,运行uboot根目录下的 s5pv210_image.c
gcc s5pv210_image.c -o make-16k
  • 生成16k烧写文件
./make-16k u-boot.bin u-boot-16k.bin

二、启动NFS文件系统

(1)uboot烧录到SD卡之后,我们就可以启动uboot,然后通过uboot启动kernel,传输kernel和设备树的方式,这里采用FTP,然后用NFS挂载文件系统。
FTP 和 NFS 在 u-boot 启动 kernel 过程中的作用是,TFTP 用于从远程服务器下载 kernel 镜像文件,而 NFS 则用于挂载远程主机上的根文件系统。这些功能使得 u-boot 能够灵活地从网络中获取所需的文件,并完成系统的启动过程。

(2)uboot启动后,需要配置一下uboot的环境变量,使其可以和FTP通过网卡通信,下载kernel和设备树,kernel4.19和设备树下载地址
uboot环境变量设置:

  1. 开发板IP地址配置
setenv ipaddr 192.168.1.102
  1. 开发板mac地址配置
setenv ethaddr 00:19:D3:FE:56:33
  1. 网关配置
setenv gatewayip 192.168.1.1
  1. 子网掩码配置
setenv netmask 255.255.255.0
  1. nfs服务器ip地址配置
setenv serverip 192.168.1.20
  1. bootargs配置:里面唯一要注意的点是要添加 "nfssvers=3"这句,debug好久才发现
setenv bootargs 'console=ttySAC2,115200 root=/dev/nfs rw nfsroot=192.168.1.20:/home/nfsroot,nfsvers=3 ip=192.168.1.102::192.168.1.1:255.255.255.0::eth0:off earlyprintk'

设置 bootargs时发现,linux内核的设备树要设置 bootargs,uboot 也要设置 bootargs,且要设置相同
在这里插入图片描述
7. 输入 boot 开始下载kernel

(3)将配置写入uboot 镜像中
如果不想每次都要输入ip地址等配置,我们可以把这些配置都写入到 uboot中
找到 **\u-boot-2018.01\include\configs\smdkv210.h 在最后添加参数,具体ip地址可以根据自己环境填写

#define MYCONFIG_ETHDADDR     01:24:45:20:21:12
#define CONFIG_NET_RANDOM_ETHADDR
#define CONFIG_NETMASK  255.255.255.0
#define CONFIG_SERVERIP 192.168.1.20
#define CONFIG_GATEWAYIP    192.168.1.1
#define CONFIG_IPADDR   192.168.1.102

还是在该文件中,找到 CONFIG_BOOTCOMMAND 宏,改成如下配置,如果没有就直接添加:

#define CONFIG_BOOTCOMMAND "tftpboot 40000000 s5pv210-x210.dtb;tftpboot 30007fc0 uImage;bootm 30007fc0 - 40000000"

找到根目录 .config 下 CONFIG_BOOTARGS 添加

CONFIG_BOOTARGS="console=ttySAC2,115200 root=/dev/nfs rw nfsroot=192.168.1.20:/home/nfsroot,nfsvers=3 ip=192.168.1.102::192.168.1.1:255.255.255.0::eth0:off earlyprintk"

这样启动uboot时,就会自动下载kernel镜像并引导内核启动

启动过程:

U-Boot 2018.01 (Apr 15 2023 - 19:22:26 -0700)

CPU:   S5PC110 @ 1 GHz
Model: Samsung Goni based on S5PC110
Board:  SMDKV210
DRAM:  512 MiB
MMC:   SAMSUNG SDHCI: 0, SAMSUNG SDHCI: 1
sdhci_transfer_data: Error detected in status(0x208020)!
*** Warning - read failed, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   dm9000
Warning: dm9000 (eth0) using random MAC address - 56:2b:3f:41:8b:d7

SMDKV210 # setenv ipaddr 192.168.1.102
SMDKV210 # setenv ethaddr 00:19:D3:FE:56:33
SMDKV210 # setenv gatewayip 192.168.1.1
SMDKV210 # setenv netmask 255.255.255.0
SMDKV210 # setenv serverip 192.168.1.20
SMDKV210 # setenv bootargs 'console=ttySAC2,115200 root=/dev/nfs rw nfsroot=192.168.1.20:/home/nfsroot,nfsvers=3 ip=192.168.1.102::192.168.1.1:255.255.255.0::eth0:off earlyprintk'
SMDKV210 # boot
dm9000 i/o: 0x88000000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:19:d3:fe:56:33
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.1.20; our IP address is 192.168.1.102
Filename 's5pv210-x210.dtb'.
Load address: 0x40000000
Loading: #####
         547.9 KiB/s
done
Bytes transferred = 24703 (607f hex)
dm9000 i/o: 0x88000000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:19:d3:fe:56:33
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.1.20; our IP address is 192.168.1.102
Filename 'uImage'.
Load address: 0x30007fc0
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###################################
         335.9 KiB/s
done
Bytes transferred = 3835112 (3a84e8 hex)
## Booting kernel from Legacy Image at 30007fc0 ...
   Image Name:   Linux-4.19.280
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3835048 Bytes = 3.7 MiB
   Load Address: 30008000
   Entry Point:  30008000
## Flattened Device Tree blob at 40000000
   Booting using the fdt blob at 0x40000000
   XIP Kernel Image ... OK
   Loading Device Tree to 3fff6000, end 3ffff07e ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.19.280 (root@ubuntu) (gcc version 6.5.0 (Linaro GCC 6.5-2018.12)) #3 PREEMPT Fri Apr 28 07:15:08 PDT 2023
CPU: ARMv7 Processor [412fc082] revision 2 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: YIC System SMDKV210 based on S5PV210
bootconsole [earlycon0] enabled
Memory policy: Data cache writeback
CPU: All CPU(s) started in SVC mode.
Built 1 zonelists, mobility grouping on.  Total pages: 130048
Kernel command line: console=ttySAC2,115200 root=/dev/nfs rw nfsroot=192.168.1.20:/home/nfsroot,nfsvers=3 ip=192.168.1.102::192.168.1.1:255.255.255.0::eth0:off earlyprintk
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 509948K/524288K available (6144K kernel code, 208K rwdata, 1544K rodata, 1024K init, 252K bss, 14340K reserved, 0K cma-reserved)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xa0800000 - 0xff800000   (1520 MB)
    lowmem  : 0x80000000 - 0xa0000000   ( 512 MB)
    modules : 0x7f000000 - 0x80000000   (  16 MB)
      .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
      .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
      .data : 0x(ptrval) - 0x(ptrval)   ( 209 kB)
       .bss : 0x(ptrval) - 0x(ptrval)   ( 253 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
rcu: Preemptible hierarchical RCU implementation.
        Tasks RCU enabled.
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
VIC @(ptrval): id 0x00041192, vendor 0x41
VIC @(ptrval): id 0x00041192, vendor 0x41
VIC @(ptrval): id 0x00041192, vendor 0x41
VIC @(ptrval): id 0x00041192, vendor 0x41
S5PV210 clocks: mout_apll = 1000000000, mout_mpll = 667000000
        mout_epll = 80000000, mout_vpll = 108000000
sched_clock: 32 bits at 33MHz, resolution 29ns, wraps every 64392313329ns
clocksource: samsung_clocksource_timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 57309158834 ns
Console: colour dummy device 80x30
Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
CPU0: Spectre v2: firmware did not set auxiliary control register IBE bit, system vulnerable
Setting up static identity map for 0x30100000 - 0x30100060
rcu: Hierarchical SRCU implementation.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 2
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 256 (order: 0, 7168 bytes)
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
clocksource: Switched to clocksource samsung_clocksource_timer
NET: Registered protocol family 2
IP idents hash table entries: 8192 (order: 4, 65536 bytes)
tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 6144 bytes)
TCP established hash table entries: 4096 (order: 2, 16384 bytes)
TCP bind hash table entries: 4096 (order: 4, 81920 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
UDP hash table entries: 256 (order: 1, 12288 bytes)
UDP-Lite hash table entries: 256 (order: 1, 12288 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Initialise system trusted keyrings
workingset: timestamp_bits=30 max_order=17 bucket_order=0
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
romfs: ROMFS MTD (C) 2007 Red Hat, Inc.
Key type asymmetric registered
Asymmetric key parser 'x509' registered
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
io scheduler mq-deadline registered
io scheduler kyber registered
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
e2900000.serial: ttySAC0 at MMIO 0xe2900000 (irq = 58, base_baud = 0) is a S3C6400/10
e2900400.serial: ttySAC1 at MMIO 0xe2900400 (irq = 59, base_baud = 0) is a S3C6400/10
e2900800.serial: ttySAC2 at MMIO 0xe2900800 (irq = 60, base_baud = 0) is a S3C6400/10
console [ttcSAC2] enabled
onsole [ttySAC2] enabled
bootconsole [earlybon0] disabled
ootconsole [earlycon0] disabled
e2900c00.serial: ttySAC3 at MMIO 0xe2900c00 (irq = 61, base_baud = 0) is a S3C6400/10
exynos4-fb f8000000.fimd: failed to get system register.
OF: graph: no port node found in /soc/fimd@f8000000
[drm] Exynos DRM: using f8000000.fimd device for DMA mapping operations
exynos-drm exynos-drm: bound f8000000.fimd (ops fimd_component_ops)
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] No driver support for vblank timestamp query.
[drm] sclk_fimd clock too low(0) for requested pixel clock(24373000)
[drm] sclk_fimd clock too low(0) for requested pixel clock(24373000)
[drm] sclk_fimd clock too low(0) for requested pixel clock(24373000)
Console: switching to colour frame buffer device 100x30
[drm] sclk_fimd clock too low(0) for requested pixel clock(24373000)
exynos-drm exynos-drm: fb0:  frame buffer device
[drm] Initialized exynos 1.1.0 20180330 for exynos-drm on minor 0
brd: module loaded
loop: module loaded
dm9000 88000000.ethernet: 88000000.ethernet supply vcc not found, using dummy regulator
dm9000 88000000.ethernet: Linked as a consumer to regulator.0
dm9000 88000000.ethernet: enable clock 'sromc'
eth0: dm9000b at (ptrval),(ptrval) IRQ 144 MAC: 00:00:de:ad:be:ef (platform data)
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-exynos: EHCI EXYNOS driver
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-exynos: OHCI EXYNOS driver
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
s3c-sdhci eb000000.sdhci: clock source 0: mmc_busclk.0 (133400000 Hz)
s3c-sdhci eb000000.sdhci: clock source 2: mmc_busclk.2 (80000000 Hz)
mmc0: SDHCI controller on samsung-hsmmc [eb000000.sdhci] using ADMA
s3c-sdhci eb100000.sdhci: clock source 0: mmc_busclk.0 (133400000 Hz)
s3c-sdhci eb100000.sdhci: clock source 2: mmc_busclk.2 (80000000 Hz)
mmc1: SDHCI controller on samsung-hsmmc [eb100000.sdhci] using ADMA
s3c-sdhci eb200000.sdhci: clock source 0: mmc_busclk.0 (133400000 Hz)
s3c-sdhci eb200000.sdhci: clock source 2: mmc_busclk.2 (80000000 Hz)
mmc2: SDHCI controller on samsung-hsmmc [eb200000.sdhci] using ADMA
s3c-sdhci eb300000.sdhci: clock source 0: mmc_busclk.0 (133400000 Hz)
s3c-sdhci eb300000.sdhci: clock source 3: mmc_busclk.3 (80000000 Hz)
mmc3: Internal clock never stabilised.
mmc3: sdhci: ============ SDHCI REGISTER DUMP ===========
mmc3: sdhci: Sys addr:  0x00000000 | Version:  0x00002401
mmc2: new high speed SDHC card at address 21a3
mmc3: sdhci: Blk size:  0x00000000 | Blk cnt:  0x00000000
mmc3: sdhci: Argument:  0x00000000 | Trn mode: 0x00000000
mmcblk2: mmc2:21a3 APPSD 7.42 GiB
mmc3: sdhci: Present:   0x01fa0000 | Host ctl: 0x00000000
 mmcblk2: p1
mmc3: sdhci: Power:     0x0000000e | Blk gap:  0x00000000
mmc3: sdhci: Wake-up:   0x00000000 | Clock:    0x00008001
mmc3: sdhci: Timeout:   0x00000000 | Int stat: 0x00000000
mmc3: sdhci: Int enab:  0x00ff0043 | Sig enab: 0x00ff0043
mmc3: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
mmc3: sdhci: Caps:      0x05e80080 | Caps_1:   0x00000000
mmc3: sdhci: Cmd:       0x00000000 | Max curr: 0x00000000
mmc3: sdhci: Resp[0]:   0x00000000 | Resp[1]:  0x00000000
mmc3: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
mmc3: sdhci: Host ctl2: 0x00000000
mmc3: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x00000000
mmc3: sdhci: ============================================
mmc3: SDHCI controller on samsung-hsmmc [eb300000.sdhci] using ADMA
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
NET: Registered protocol family 10
Segment Routing with IPv6
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
NET: Registered protocol family 17
Key type dns_resolver registered
Loading compiled-in X.509 certificates
hctosys: unable to open rtc device (rtc0)
dm9000 88000000.ethernet eth0: link down
dm9000 88000000.ethernet eth0: link down
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
IP-Config: Complete:
     device=eth0, hwaddr=00:00:de:ad:be:ef, ipaddr=192.168.1.102, mask=255.255.255.0, gw=192.168.1.1
     host=192.168.1.102, domain=, nis-domain=(none)
     bootserver=255.255.255.255, rootserver=192.168.1.20, rootpath=
dm9000 88000000.ethernet eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1
VFS: Mounted root (nfs filesystem) on device 0:12.
devtmpfs: mounted
Freeing unused kernel memory: 1024K
Run /sbin/init as init process

Please press Enter to activate this console.
[root@S5PV210 ]# ls
bin      etc      lib      mnt      root     sys      usr
dev      home     linuxrc  proc     sbin     tmp      var
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值