这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
jaysnote:kernel_compile [2019/12/11 21:37] lijie |
jaysnote:kernel_compile [2020/01/16 19:45] lijie |
||
---|---|---|---|
行 1: | 行 1: | ||
< | < | ||
+ | # Kernel Compile | ||
- | # xgac sdk usage | + | ## 命令 |
- | ## compile | + | * 单独编译Kernel |
- | * 下载解压 [sdk](/home/ | + | ```shell |
+ | ./build.sh -p sun50iw1p1_debian -m kernel -k linux-3.10 | ||
+ | ``` | ||
- | | + | * 清除 |
- | | + | |
- | ├── brandy | + | |
- | ├── buildroot | + | |
- | ├── | + | |
- | ├── clean.sh | + | |
- | ├── debian | + | |
- | ├── img_release.sh | + | |
- | ├── lib #allwinner sysconfig 配置脚本 | + | |
- | ├── | + | |
- | ├── out # | + | |
- | ├── readme.txt | + | |
- | └── tools # | + | |
``` | ``` | ||
- | | + | * menuconfig |
- | * 解压缩 带上--numeirc-owner 保留数字用户/ | + | ``` |
+ | sudo make ARCH=arm64 CROSS_COMPILE=../ | ||
+ | ``` | ||
- | * 解压缩后请确定debian rootfs 用户id/ | + | * 拷贝 |
+ | |||
+ | ``` | ||
+ | scp jay@10.28.3.204:/home/jay/a64/ | ||
+ | ``` | ||
+ | |||
+ | * 更新kernel | ||
```bash | ```bash | ||
- | | + | |
- | | + | |
+ | | ||
+ | |||
+ | [ -f boot.img ] && { | ||
+ | |||
+ | sudo dd if=boot.img of=/ | ||
+ | sync | ||
+ | echo " | ||
+ | exit 0 | ||
+ | } | ||
+ | |||
+ | echo " | ||
+ | exit 1 | ||
``` | ``` | ||
- | * ramdisk 通过软连接到cpio 目录 | ||
- | ```bash | + | ## 驱动 |
- | ln -s -f ../ | + | |
- | ``` | + | |
- | * 编译过程 | + | ### 摄像头(ov5640.ko vfl2.ko ) |
- | 暂时地,在root用户下完成操作。 | + | 需要修改vfe.c |
- | | + | ```c |
- | # | + | //linux-3.10/drivers/media/platform/sunxi-vfe/vfe.c |
- | 1. 设置XY变量,配置屏幕类型 | + | static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) { |
- | + | | |
- | 800X480分辨率屏幕配置 | + | |
- | $ export XY=800x480 | + | |
- | + | ||
- | 2. 源码编译 | + | |
- | $ ./build.sh | + | |
- | + | ||
- | | + | |
- | $ ./build.sh pack | + | |
- | + | ||
- | # | + | |
- | 4.设置文件系统版本号 | + | |
- | ./debian/home/chen/update_buildtime.sh debian -w | + | |
- | + | ||
- | | + | |
- | ./ | + | |
- | ``` | + | |
- | * 内核编译 | + | //*i = dev-> |
+ | *i = 0; | ||
+ | return 0; | ||
+ | } | ||
+ | ``` | ||
- | 参考[内核编译] (/ | + | ```c |
+ | // | ||
+ | static int vidioc_enum_input(struct file *file, void *priv, struct v4l2_input *inp) { | ||
+ | | ||
+ | if (inp-> | ||
+ | | ||
+ | | ||
+ | } | ||
+ | | ||
+ | if (0 == dev-> | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | | ||
+ | | ||
+ | } | ||
+ | ``` | ||
- | ## download | + | > Device Drivers > Multimedia support > V4L platform devices |
- | ### windows | + | ![v4l2 编译选项](http:// |
- | * 安装 [PhoenixSuit_V1.10.zip](https:// | + | ### GPIO libc(built in) |
- | * 下载已经编译好镜像[当前最新镜像直接下载](http:// | + | > Device Drivers > GPIO Support |
- | * 连接micro usb 接口,按住boot 按键(蜂鸣器位置,有丝印)启动系统(上电/或者reset),等待下载完成; | + | ![GPIO 支持](http: |
- | ![镜像下载](images/ | + | ### SMT32 I2C& 开机动画(stm_s103.ko) |
- | ### linux | + | >Device Drivers > Staging drivers > Support for MXJ private driver |
- | * 下载 livesuit 源码包; | + | ![梦想加私有驱动](http:// |
- | ```bash | + | ### USB Net(usbnet.ko asix.ko) |
- | $git clone https:// | + | |
- | ``` | + | |
- | | + | > Device Drivers > Network device support > USB Network Adapters |
- | * bianyi 安装awusb 驱动; | + | ![](http:// |
- | ```bash | + | 同时直接干掉无线网卡支持。 |
- | $sudo apt-get install dkms | + | |
- | $make | + | |
- | $sudo cp awusb.ko / | + | |
- | $ modprobe awusb | + | |
- | ``` | + | |
- | * 运行LiveSuit.sh 工具。 | + | ### oui mac 和基于sid md5计算mac地址。 |
- | | + | * 接收用户传参,用以用户通过应用空间传递oui mac。 |
- | | + | ```c |
- | ``` | + | // |
+ | static char *user_mac | ||
+ | static bool user_flag = true; | ||
+ | module_param(user_mac, | ||
+ | ``` | ||
+ | * 如果用户没有传递参数,则通过 sid md5 随机mac; | ||
+ | ```c | ||
+ | // | ||
+ | |||
+ | # | ||
+ | //generate mac by hash cpuid | ||
+ | void hash_gen_mac(u8 *mac){ | ||
+ | |||
+ | | ||
+ | u32 hash[ 4] = {0}; | ||
+ | |||
+ | memset(hash, | ||
+ | memset(data, | ||
+ | |||
+ | //1. fill chipid to data | ||
+ | sunxi_get_soc_chipid((u8*)data); | ||
+ | | ||
+ | |||
+ | printk(KERN_INFO " | ||
+ | |||
+ | |||
+ | //2. calc md5 | ||
+ | | ||
+ | //hash[0] ^= hash[2]; | ||
+ | //hash[1] ^= hash[3]; | ||
+ | printk(KERN_INFO " | ||
+ | |||
+ | //3. fill mac | ||
+ | memset(mac, 0, ETH_ALEN); | ||
+ | |||
+ | mac[0] = 0x06; // | ||
+ | // | ||
+ | memcpy(& | ||
+ | } | ||
+ | ``` | ||
+ | |||
+ | * 业务逻辑 | ||
+ | ```c | ||
+ | // | ||
+ | user_flag=true; | ||
+ | printk(KERN_INFO "asix: user mac address is %s", | ||
+ | if(user_mac!=NULL&& | ||
+ | for(i=0; | ||
+ | buf[i]=0; | ||
+ | if(user_mac[3*i]> | ||
+ | buf[i]|=((user_mac[3*i]-' | ||
+ | }else if(user_mac[3*i]> | ||
+ | buf[i]|=((user_mac[3*i]-' | ||
+ | }else if(user_mac[3*i]> | ||
+ | buf[i]|=((user_mac[3*i]-' | ||
+ | }else { | ||
+ | user_flag=false; | ||
+ | break; | ||
+ | } | ||
+ | if(user_mac[3*i+1]> | ||
+ | buf[i]|=(user_mac[3*i+1]-' | ||
+ | }else if(user_mac[3*i+1]> | ||
+ | buf[i]|=(user_mac[3*i+1]-' | ||
+ | }else if(user_mac[3*i+1]> | ||
+ | buf[i]|=(user_mac[3*i+1]-' | ||
+ | }else { | ||
+ | user_flag=false; | ||
+ | break; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | }else { | ||
+ | user_flag=false; | ||
+ | } | ||
+ | if(user_flag&& | ||
+ | printk(KERN_INFO "asix: mac form user setting: | ||
+ | }else { | ||
+ | printk(KERN_INFO "asix: mac form user is null or wrong format. "); | ||
+ | hash_gen_mac(buf); | ||
+ | printk(KERN_INFO "asix: mac form chip id hash: %02x: | ||
+ | } | ||
+ | ``` | ||
+ | |||
+ | 并且需要使能`system info driver`。 | ||
+ | |||
+ | > Device Drivers > Character devices | ||
+ | |||
+ | ![系统信息](http:// | ||
+ | |||
+ | ### 显示(built-in) | ||
+ | |||
+ | > Device Drivers > Graphics support > Support for frame buffer devices > Video support for sunxi | ||
+ | |||
+ | ![](http:// | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ### STM32& | ||
+ | |||
+ | **19:27 2018/7/31** | ||
- | * 连接micro usb 接口,按住boot 按键(蜂鸣器位置,有丝印)启动系统(上电/ | + | 更新为源码自带i2c通用驱动,并且更新速率为`100k` |
- | ![linux 下载](images/ | + | > Device Drivers > I2C support |
- | ## troubleshooting | + | ![](http:// |
- | * 编译错误`awk: | ||
- | ```bash | ||
- | sudo apt-get install gawk | ||
- | ``` | ||
- | * 编译错误 `-bash: ./ | + | ## fex |
- | ```bash | + | * http:// |
- | sudo apt-get install gcc-multilib g++-multilib | + | |
- | ``` | + | |
</ | </ |