1、分析
检测到时钟偏差,主要是两个设备系统之间的时间上存在差距,导致编译失败。
2、解决
将所有文件都重新touch一遍,更新到本地系统的时间,再make就没问题了。
find ./ -type f |xargs touch
1、分析
检测到时钟偏差,主要是两个设备系统之间的时间上存在差距,导致编译失败。
2、解决
将所有文件都重新touch一遍,更新到本地系统的时间,再make就没问题了。
find ./ -type f |xargs touch
root@somlabs:~# fdisk -l
省略若干
Disk /dev/mmcblk1: 3.7 GiB, 3965714432 bytes, 7745536 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: 0x9de2d76a
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p0 16384 1628159 1611776 787M 83 Linux
假如需要扩展分区为mmcblk0p1
root@somlabs:~# fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/mmcblk1: 3.7 GiB, 3965714432 bytes, 7745536 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: 0x9de2d76a
Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 16384 1628159 1611776 787M 83 Linux
这里也看到Start扇区也是16384
Command (m for help): d
把这个分区删除
Partition 1 has been deleted.
Command (m for help): p
列出分区信息Disk /dev/mmcblk1: 3.7 GiB, 3965714432 bytes, 7745536 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: 0x9de2d76a
Command (m for help): n
新建分区Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
主分区Partition number (1-4, default 1): 1
分区序号,First sector (2048-7745535, default 2048): 16384
这里要使用起始扇区16384这个值Last sector, +sectors or +size{K,M,G,T,P} (16384-7745535, default 7745535):
默认回车取最大,
Created a new partition 1 of type 'Linux' and of size 3.7 GiB.
Partition #1 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: n
不改变文件分区信号??
Command (m for help): w
写入生效
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
root@somlabs:~# reboot
resize2fs /dev/mmcblk1p1
resize2fs 1.43.4 (31-Jan-2017)
Filesystem at /dev/mmcblk1p1 is m[ 122.795430] EXT4-fs (mmcblk1p1): resizing filesystem from 201472 to 966144 blocks
ounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
[ 123.861183] EXT4-fs (mmcblk1p1): resized filesystem to 966144
The filesystem on /dev/mmcblk1p1 is now 966144 (4k) blocks long.
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 3.7G 499M 3.0G 15% /
devtmpfs 88M 0 88M 0% /dev
tmpfs 248M 0 248M 0% /dev/shm
tmpfs 248M 3.4M 245M 2% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 248M 0 248M 0% /sys/fs/cgroup
tmpfs 50M 0 50M 0% /run/user/0
cd /sys/kernel/debug/
cat gpio
cat /sys/kernel/debug/pinctrl/pinctrl-rockchip-pinc
trl/pinmux-pins
1、配置psi-nor为驱动模块
Device Drivers --->
<*> Memory Technology Device (MTD) support --->
<M> SPI NOR device support --->
2、进入内核加载
modpro and insmod xxx.ko
spi-nor.ko
1、make menuconfig
2、修改设备树
&spi3 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi3m1_cs0 &spi3m1_pins>;
spi_test@00 {
compatible = "rockchip,rk-spidev";
reg = <0>;
spi-max-frequency = <5000000>;
};
};
3、修改驱动文件
vim spidev.c
增加compatible 匹配设备树参数。
static const struct spi_device_id spidev_spi_ids[] = {
{ .name = "dh2228fv" },
{ .name = "ltc2488" },
{ .name = "sx1301" },
{ .name = "bk4" },
{ .name = "dhcom-board" },
{ .name = "m53cpld" },
{ .name = "spi-petra" },
{ .name = "spi-authenta" },
{ .name = "rk-spidev" },
{},
};
static const struct of_device_id spidev_dt_ids[] = {
{ .compatible = "rohm,dh2228fv", .data = &spidev_of_check },
{ .compatible = "lineartechnology,ltc2488", .data = &spidev_of_check },
{ .compatible = "semtech,sx1301", .data = &spidev_of_check },
{ .compatible = "lwn,bk4", .data = &spidev_of_check },
{ .compatible = "dh,dhcom-board", .data = &spidev_of_check },
{ .compatible = "menlo,m53cpld", .data = &spidev_of_check },
{ .compatible = "cisco,spi-petra", .data = &spidev_of_check },
{ .compatible = "micron,spi-authenta", .data = &spidev_of_check },
{ .compatible = "rockchip,rk-spidev", .data = &spidev_of_check },
{},
};
二、测试spidev设备
1、创建镜像文件
使用dd命令创建一个空的镜像文件rootfs.img,每次读取和写入的字节数是1M,大小为1M*2048;大小可根据自己需要保存文件的多少自定义。
$ dd if=/dev/zero of=rootfs.img bs=1M count=2048
2、格式化镜像文件
格式化镜像文件rootfs.img为ext4格式,具体格式化的类型还有ext3、ntfs、fat等格式可自定义。
$ mkfs.ext4 -c rootfs.img
3、挂载镜像文件
挂载镜像文件rootfs.img到/mnt目录中。具体挂载的目录可以自定义。
$ sudo mount -t ext4 -o loop rootfs.img /mnt
4、拷贝文件到镜像
拷贝需要打包到镜像中的文件到挂载的目录中,此处表示拷贝rootfs/下的所有文件到/mnt目录中(即镜像文件中)。
$ sudo cp -rfp rootfs/* /mnt
5、取消挂载
取消镜像文件的挂载。取消挂载后就表示镜像文件制作完成。
$ sudo umount /mnt
1、查看镜像分区
fdisk *.img
xiaobao@Newu:~/hdd/tmp$ fdisk AB-small-S-lvm-A03-other-armbian-1.1.100.57.9.img
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk AB-small-S-lvm-A03-other-armbian-1.1.100.57.9.img: 2.77 GiB, 2956984320 bytes, 5775360 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: 0x00000000
Device Boot Start End Sectors Size Id Type
AB-small-S-lvm-A03-other-armbian-1.1.100.57.9.img1 8192 530431 522240 255M c W95 FAT32 (LBA)
AB-small-S-lvm-A03-other-armbian-1.1.100.57.9.img2 532480 5775359 5242880 2.5G 83 Linux
2、挂载分区
sudo mount -o loop,offset=4194304 AB-small-S-lvm-A03-other-armbian-1.1.100.57.9.img /mnt/tmp/
可以看到img文件中有两个分区,第一个分区是从8192开始的,这里需要特别注意,需要转换一下:8192*512=4194304B
3、替换内容
$ sudo cp -rfp rootfs/* /mnt/tmp/
三、硬盘导出镜像工具
usermod -a -G sudo xxxxx
CC = arm-linux-gnueabihf-gcc#这里使用你板子编译的gcc最好指定有路径的更明确
LVGL_DIR ?= $(shell pwd)/..#创建lvgl的根目录
LVGL_DIR_NAME ?= lvgl
CFLAGS ?= -O3 -g0 -I$(LVGL_DIR)/
LDFLAGS ?= -lm -lpthread
BIN = bbu_base_func
MAINSRC = ../main.c ../tcp_server.c ../lx2160_fan.c ../lx2160_tmp.c ../lxspi_gd32.c ../clk_sync.c
include $(LVGL_DIR)/lvgl/lvgl.mk
include $(LVGL_DIR)/lv_drivers/lv_drivers.mk
OBJEXT ?= .o
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
MAINOBJ = $(MAINSRC:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
all: default
%.o: %.c
@$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@
@echo "CC $<"
default: $(AOBJS) $(COBJS) $(MAINOBJ)
$(CC) -static -o $(BIN) $(MAINOBJ) $(AOBJS) $(COBJS) $(LDFLAGS)
cp $(BIN) ../
clean:
rm -f $(BIN) $(AOBJS) $(COBJS) $(MAINOBJ)
1、查看磁盘使用大小:
df -h
2、查看目录占用大小
cat /proc/kallsyms grep fib4 rule default