dd if=/dev/mtd0 of=/test.bin
0.编译uboot,官网下载,拷贝到服务器
解压缩:
tar xvf u-boot-2020.04-rc3.tar.bz2
tar -xvf archive_name.tar -C new_dir
压缩:
tar -cvf qoriq-linux.tar ./qoriq-linux/
统计文件大小: md5sum text
创建文件:touch a
创建文件夹:mkdir a
编译:
source /opt/fsl-networking/QorIQ-SDK-V1.6/environment-setup-ppce500v2-fsl-linux-gnuspe;
unset LDFLAGS;
make distclean;
make P2020RDB-PC_config;
make -j8;
powerpc-fsl-linux-gnuspe-objdump -j .text -l -C -S u-boot >uboot.map;
cp u-boot.bin ~/../liguofa/tftpboot/
编译内核注意事项:
make menuconfig
在服务器编译menuconfig时,注意编译环境。若是没有source环境变量,会导致内核无法编译。
echo $CC
编译测试程序:
source /opt/fsl-networking/QorIQ-SDK-V1.6/environment-setup-ppce500v2-fsl-linux-gnuspe
$CC doorbell_test.c
1.codewarrior编译烧写uboot
编译uboot
source /opt/fsl-networking/QorIQ-SDK-V1.6/environment-setup-ppce500v2-fsl-linux-gnuspe;unset LDFLAGS;make distclean;make P2020RDB-PC_config;make -j8;powerpc-fsl-linux-gnuspe-objdump -j .text -l -C -S u-boot >uboot.map;cp u-boot.bin ~/../liguofa/tftpboot/
2.环境变量设置:网口设置:具体配置信息在下面有详细打印
setenv editenv
设置mac地址
setenv ethaddr 12:34:56:78:90:ff
setenv eth1addr 11:22:33:44:55:67
setenv eth2addr 11:22:33:44:55:68
ethaddr=12:34:56:78:90:ff 公司网络许可mac地址
设置服务器地址
setenv ipserver 10.0.1.230 //服务器ip
setenv netmask 255.0.0.0 //服务器掩码
3.在服务器上创建环境:三个命令
指令1:
服务器根目录即可
source /opt/fsl-networking/QorIQ-SDK-V1.6/environment-setup-ppce500v2-fsl-linux-gnuspe;
unset LDFLAGS;
make distclean;
make P2020RDB-PC_config;
make -j8;
powerpc-fsl-linux-gnuspe-objdump -j .text -l -C -S u-boot >uboot.map;
cp u-boot.bin ~/tftpboot/
指令2:服务器
unset LDFLAGS;make uImage -j8;cp ./arch/powerpc/boot/uImage ./;cp arch/powerpc/boot/uImage .;
指令3:服务器
make p2020rdb-pc_32b.dtb;cp arch/powerpc/boot/p2020rdb-pc_32b.dtb .
4.拷贝系统镜像,文件系统,设备树 -- 板卡
tftp 0x1000000 uImage;tftp 0x2000000 ramdisk;tftp 0x5000000 p2020rdb-pc_32b.dtb;bootm 0x1000000 0x2000000 0x5000000
访问服务器 linux根地址:项目文件地址
cd gitwork/qoriq-linux/linux
/* 拷贝服务器镜像到目标板 */
rm ~/.ssh -r
scp -r geningning@10.0.1.22:/home/geningning/ ./a_file
eg:
rm ~/.ssh -r /* 删除ssh秘钥 */
scp rio_test_db root@10.0.1.254:/ /* 拷贝文件到目标板卡 */
flash信息查看命令 FLinfo 1:查看分区
uboot flash映射区间:include/configs/config.h
拷贝内核/文件系统到flash
tftp 0x1000000 uImage;erase 0xe3c00000 0xe3ffffff;cp.b 0x1000000 0xe3c00000 0x2c4896;
tftp 0x2000000 ramdisk;erase 0xe0000000 0xe1ffffff;cp.b 0x2000000 0xe0000000 0x18FD173;
烧写uboot :升级uboot,一共三个片区,三个备份,cs0,1.5M。
烧写内核: :0xe3c00000 - 0xe3ffffff(4MB)image size = 2902166byte = 0x2c4896
烧写用户文件系统:0xe2000000 – 0xe3000000 size:16M = 0x100 0000
32M Ramdisk: 0xe0000000 – 0xe2000000 size: 0x18FD173
烧写设备树:看源码。
操作系统启动配置:
调试网口配置:
ipconfig -a display all mosec
网口调试配置:
ifconfig eth1 hw ether aa:bb:cc:dd:ee:ff 10.0.1.254 up
进入内核见面配置:menuconfig
查看K7 srio link status
dmesg |grep rio
查看内存或寄存器信息
devmem 0xffec0060 32
文件查找命令:
grep "link_speed" ./ -nr
文件比对命令
vimdiff new_dts/p2020ds.dts old_dts/p2020ds.dts
设备树编译与修改:
/../linux/arch/powerpc/boot/p2020*.dts
文件系统:
root@p2020rdb:~# mount
/dev/root on / type ext2 (rw,relatime,errors=continue)
devtmpfs on /dev type devtmpfs (rw,relatime,size=210396k,nr_inodes=52599,mode=755)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /var/volatile type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
/dev/mtdblock5 on /userfs type ext2 (rw,relatime,errors=continue)
卸载文件系统:
umount /dev/hda5
umount /mnt/hda5
umount /dev/hda5 /mnt/hda5
Command (m for help): p
Disk /dev/mtdblock5: 16 MiB, 16777216 bytes, 32768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe8729b1e
查看文件系统
root@p2020rdb:~# dumpe2fs /dev/mtdblock5
dumpe2fs 1.42.9 (28-Dec-2013)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: 4de54f7f-7ee3-4d0a-9945-9590ccce1c82
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: ext_attr resize_inode dir_index filetype sparse_super
Filesystem flags: unsigned_directory_hash
Default mount options: user_xattr acl
Filesystem state: not clean with errors
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 4096
Block count: 16384
Reserved block count: 819
Free blocks: 12573
Free inodes: 4057
First block: 1
Block size: 1024
Fragment size: 1024
Reserved GDT blocks: 63
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 2048
Inode blocks per group: 256
Filesystem created: Sun Jan 19 09:46:38 2020
Last mount time: n/a
Last write time: Sun Jan 19 09:45:11 2020
Mount count: 107
Maximum mount count: -1
Last checked: Sun Jan 19 09:46:38 2020
Check interval: 0 (<none>)
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
Default directory hash: half_md4
Directory Hash Seed: 9a2fc8d8-fd98-4623-acf4-c841bc172d24
Group 0: (Blocks 1-8192)
Primary superblock at 1, Group descriptors at 2-2
Reserved GDT blocks at 3-65
Block bitmap at 66 (+65), Inode bitmap at 67 (+66)
Inode table at 68-323 (+67)
5268 free blocks, 2021 free inodes, 1 directories
Free blocks: 2031-2560, 2770-3072, 3505-3584, 3610-4096, 4123-4608, 4618-7168, 7362-8192
Free inodes: 28-2048
Group 1: (Blocks 8193-16383)
Backup superblock at 8193, Group descriptors at 8194-8194
Reserved GDT blocks at 8195-8257
Block bitmap at 8258 (+65), Inode bitmap at 8259 (+66)
Inode table at 8260-8515 (+67)
7305 free blocks, 2036 free inodes, 2 directories
Free blocks: 8516-9728, 9730-10240, 10266-11264, 11290-14848, 14850-15872
Free inodes: 2061-4096
启动方式修改:
1.edit image_cp
=> edit image_cp
edit: tftp 0x0 ramdisk;tftp 0x2000000 uImage;tftp 0x3000000 p2020rdb-pc_32b.dtb;protect off all;erase 0xe0000000 +2000000;erase 0xe3c0000000 0x2000000;cp.b 0x2000000 0xe3c00000 0x380000;cp.b 0x3000000 0xe3f80000 0x80000;
2.edit bootcmd
=> edit bootcmd
edit: setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate $othbootargs ;bootm 0xe3c00000 0xe0000000 0xe3f80000
3.save
4.run image_cp
5.reboot
boot from motetsec tftp
=> pri
baudrate=115200
bdev=sda1
bootcmd=setenv bootargs root=/dev/$bdev rw rootdelay=30 console=$consoledev,$baudrate $othbootargs;usb start;ext2load usb 0:1 $loadaddr /boot/$bootfile;ext2load usb 0:1 $fdtaddr /boot/$fdtfile;bootm $loadaddr - $fdtaddr
bootdelay=10
bootfile=uImage
consoledev=ttyS0
eth1addr=12:34:54:11:11:22
eth1mac=c
eth2addr=aa:bb:cc:dd:ee:ff
ethact=eTSEC2
ethaddr=12:34:56:78:90:ff
ethnet=eth2
ethprime=eTSEC2
fdtaddr=c00000
gatewayip=10.0.1.1
hostname=unknown
hwconfig=usb1:dr_mode=host,phy_type=ulpi
ipaddr=10.0.1.88
jffs2nand=mtdblock9
jffs2nor=mtdblock3
loadaddr=1000000
map_lowernorbank=i2c dev 1; i2c mw 18 1 02 1; i2c mw 18 3 fd 1
map_uppernorbank=i2c dev 1; i2c mw 18 1 00 1; i2c mw 18 3 fd 1
nandboot=i2c dev 1; i2c mw 18 1 0xe8 1; i2c mw 18 3 0x03 1; reset
nandbootaddr=100000
nandfdtaddr=80000
netdev=eth0
netmask=255.0.0.0
nfsboot=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off console=$consoledev,$baudrate $othbootargs;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr - $fdtaddr
norboot=i2c dev 1; i2c mw 18 1 0xc8 1; i2c mw 18 3 0x03 1; reset
norbootaddr=ef080000
norfdtaddr=ef040000
pciboot=i2c dev 1; i2c mw 18 1 0xa8 1; i2c mw 18 3 0x03 1; reset
ramboot=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate $othbootargs ramdisk_size=$ramdisk_size;tftp $ramdiskaddr $ramdiskfile;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr $ramdiskaddr $fdtaddr
ramdisk_size=120000
ramdiskaddr=2000000
ramdiskfile=rootfs.ext2.gz.uboot
rootpath=/opt/nfsroot
sdboot=i2c dev 1; i2c mw 18 1 0x68 1; i2c mw 18 3 0x03 1; reset
serverip=10.0.1.230
spiboot=i2c dev 1; i2c mw 18 1 0x28 1; i2c mw 18 3 0x03 1; reset
stderr=serial
stdin=serial
stdout=serial
tftpflash=tftpboot $loadaddr $uboot; protect off 0xeff40000 +$filesize; erase 0xeff40000 +$filesize; cp.b $loadaddr 0xeff40000 $filesize; protect on 0xeff40000 +$filesize; cmp.b $loadaddr 0xeff40000 $filesize
uboot=u-boot.bin
Environment size: 2102/8188 bytes
boot from flash::
=> pri
baudrate=115200
bdev=sda1
bootaddr=0x4200
bootargs=root=/dev/ram rw console=ttyS0,115200
bootcmd=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate $othbootargs ;bootm 0xe3c00000 0xe0000000 0xe3f80000
bootcmdbk=setenv bootargs root=/dev/$bdev rw rootdelay=30 console=$consoledev,$baudrate $othbootargs;usb start;ext2load usb 0:1 $loadaddr 0:1 $fdtaddr /boot/$fdtfile;bootm $loadaddr - $fdtaddr
bootdelay=1
bootfile=uImage
consoledev=ttyS0
envbk=protect off all;erase 0xefd00000 +c0000;erase 0xefb80000 +c0000;cp.b efe80000 efd00000 c0000;cp.b efe80000 0xefb80000 c0000;
eth1addr=12:34:54:11:11:22
eth1mac=c
eth2addr=aa:bb:cc:dd:ee:ff
ethact=eTSEC2
ethaddr=12:34:56:78:90:ff
ethnet=eth2
ethprime=eTSEC2
fdtaddr=c00000
fileaddr=1000000
filesize=c0000
gatewayip=10.0.1.1
hostname=unknown
hwconfig=usb1:dr_mode=host,phy_type=ulpi
ipaddr=10.0.1.88
jffs2nand=mtdblock9
jffs2nor=mtdblock3
kfd-update=tftp 0x0 ramdisk;tftp 0x2000000 uImage;tftp 0x3000000 p2020rdb-pc_32b.dtb;protect off all;erase 0xe0000000 +2000000;erase 0xe3c0000000 0x2000000;cp.b 0x2000000 0xe3c00000 0x380000;cp.b 0x3000000 0xe3f80000 0x80000;
loadaddr=1000000
map_lowernorbank=i2c dev 1; i2c mw 18 1 02 1; i2c mw 18 3 fd 1
map_uppernorbank=i2c dev 1; i2c mw 18 1 00 1; i2c mw 18 3 fd 1
nandboot=i2c dev 1; i2c mw 18 1 0xe8 1; i2c mw 18 3 0x03 1; reset
nandbootaddr=100000
nandfdtaddr=80000
netdev=eth0
netmask=255.0.0.0
nfsboot=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off consolbootargs;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr - $fdtaddr
norboot=i2c dev 1; i2c mw 18 1 0xc8 1; i2c mw 18 3 0x03 1; reset
norbootaddr=ef080000
norfdtaddr=ef040000
pciboot=i2c dev 1; i2c mw 18 1 0xa8 1; i2c mw 18 3 0x03 1; reset
ramboot=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate $othbootargs ramdisk_size=$ramdisk_size;tftp $ramdiskaddr $ramdiskf;tftp $fdtaddr $fdtfile;bootm $loadaddr $ramdiskaddr $fdtaddr
ramdisk_size=120000
ramdiskaddr=2000000
ramdiskfile=rootfs.ext2.gz.uboot
rootpath=/opt/nfsroot
sdboot=i2c dev 1; i2c mw 18 1 0x68 1; i2c mw 18 3 0x03 1; reset
serverip=10.0.1.230
spiboot=i2c dev 1; i2c mw 18 1 0x28 1; i2c mw 18 3 0x03 1; reset
stderr=serial
stdin=serial
stdout=serial
tftpflash=tftpboot $loadaddr $uboot; protect off 0xeff40000 +$filesize; erase 0xeff40000 +$filesize; cp.b $loadaddr 0xeff40000 $filesize; size; cmp.b $loadaddr 0xeff40000 $filesize
u-boot-update=tftp u-boot.bin;protect off all;erase 0xeff40000 +c0000;erase 0xefdc0000 +c0000;erase 0xefc40000 +0xc0000;cp.b 0x1000000 0xe 0xefdc0000 c0000;cp.b 0x1000000 0xefc40000 c0000;save;
uboot=u-boot.bin
Environment size: 2945/8188 bytes