页次: 1
内核里自带的是rx8025sa驱动,寄存器存在差异,于是开始怼寄存器,改成了RX8025T,中断和闹钟没啥用直接屏蔽掉,经过测试时间正常。
直接上代码
// SPDX-License-Identifier: GPL-2.0-only
/*
* Driver for Epson's RTC module RX-8025 SA/NB
*
* Copyright (C) 2009 Wolfgang Grandegger <wg@grandegger.com>
*
* Copyright (C) 2005 by Digi International Inc.
* All rights reserved.
*
* Modified by fengjh at rising.com.cn
* <lm-sensors@lm-sensors.org>
* 2006.11
*
* Code cleanup by Sergei Poselenov, <sposelenov@emcraft.com>
* Converted to new style by Wolfgang Grandegger <wg@grandegger.com>
* Alarm and periodic interrupt added by Dmitry Rakhchev <rda@emcraft.com>
* rx8025t !!! not rx8025sa
*/
#include <linux/bcd.h>
#include <linux/bitops.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/rtc.h>
/* Register definitions */
#define RX8025_REG_SEC 0x00
#define RX8025_REG_MIN 0x01
#define RX8025_REG_HOUR 0x02
#define RX8025_REG_WDAY 0x03
#define RX8025_REG_MDAY 0x04
#define RX8025_REG_MONTH 0x05
#define RX8025_REG_YEAR 0x06
#define RX8025_REG_DIGOFF 0x07
#define RX8025_REG_ALWMIN 0x08
#define RX8025_REG_ALWHOUR 0x09
#define RX8025_REG_ALWWDAY 0x0a
#define RX8025_REG_ALDMIN 0x0b
#define RX8025_REG_ALDHOUR 0x0c
#define RX8025_REG_EXTEN 0x0d
#define RX8025_REG_FLAG 0x0e
#define RX8025_REG_CTRL1 0x0f
//#define RX8025_BIT_CTRL1_CT (7 << 0)
/* 1 Hz periodic level irq */
//#define RX8025_BIT_CTRL1_CT_1HZ 4
#define RX8025_BIT_CTRL1_TEST BIT(3)
#define RX8025_BIT_CTRL1_1224 BIT(5)
#define RX8025_BIT_CTRL1_DALE BIT(6)
#define RX8025_BIT_CTRL1_WALE BIT(7)
//#define RX8025_BIT_CTRL2_DAFG BIT(0)
#define RX8025_BIT_CTRL2_WAFG BIT(1)
#define RX8025_BIT_CTRL2_CTFG BIT(2)
//#define RX8025_BIT_CTRL2_PON BIT(4)
//#define RX8025_BIT_CTRL2_XST BIT(5)
//#define RX8025_BIT_CTRL2_VDET BIT(6)
#define RX8025_BIT_FLAG_UF BIT(5)
#define RX8025_BIT_FLAG_TF BIT(4)
#define RX8025_BIT_FLAG_AF BIT(3)
#define RX8025_BIT_FLAG_VLF BIT(1)
#define RX8025_BIT_FLAG_VDET BIT(0)
/* Clock precision adjustment */
#define RX8025_ADJ_RESOLUTION 3050 /* in ppb */
#define RX8025_ADJ_DATA_MAX 62
#define RX8025_ADJ_DATA_MIN -62
#define RX8250T 1
static const struct i2c_device_id rx8025_id[] = {
{ "rx8025", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, rx8025_id);
struct rx8025_data {
struct i2c_client *client;
struct rtc_device *rtc;
u8 ctrl1;
};
static s32 rx8025_read_reg(const struct i2c_client *client, u8 number)
{
return i2c_smbus_read_byte_data(client, number << 0);
//return i2c_smbus_read_byte_data(client, number << 4);
}
static int rx8025_read_regs(const struct i2c_client *client,
u8 number, u8 length, u8 *values)
{
//int ret = i2c_smbus_read_i2c_block_data(client, number << 4, length,
// values);
int ret = i2c_smbus_read_i2c_block_data(client, number << 0, length,
values);
if (ret != length)
return ret < 0 ? ret : -EIO;
return 0;
}
static s32 rx8025_write_reg(const struct i2c_client *client, u8 number,
u8 value)
{
//return i2c_smbus_write_byte_data(client, number << 4, value);
return i2c_smbus_write_byte_data(client, number << 0, value);
}
static s32 rx8025_write_regs(const struct i2c_client *client,
u8 number, u8 length, const u8 *values)
{
//return i2c_smbus_write_i2c_block_data(client, number << 4,
// length, values);
return i2c_smbus_write_i2c_block_data(client, number << 0,
length, values);
}
static int rx8025_check_validity(struct device *dev)
{
struct rx8025_data *rx8025 = dev_get_drvdata(dev);
int ctrl2;
ctrl2 = rx8025_read_reg(rx8025->client, RX8025_REG_FLAG);
if (ctrl2 < 0)
return ctrl2;
if (ctrl2 & RX8025_BIT_FLAG_VDET)
dev_warn(dev, "power voltage drop detected\n");
if (ctrl2 & RX8025_BIT_FLAG_VLF) {
dev_warn(dev, "power-on reset detected, date is invalid\n");
return -EINVAL;
}
#if 0
if (!(ctrl2 & RX8025_BIT_CTRL2_XST)) {
dev_warn(dev, "crystal stopped, date is invalid\n");
return -EINVAL;
}
#endif
return 0;
}
static int rx8025_reset_validity(struct i2c_client *client)
{
int ctrl2 = rx8025_read_reg(client, RX8025_REG_FLAG);
//printk("---rx8025_read_reg 1-RX8025_REG_FLAG --%x\n",ctrl2);
if (ctrl2 < 0)
return ctrl2;
ctrl2 &= ~(RX8025_BIT_FLAG_VLF | RX8025_BIT_FLAG_VDET);
//printk("---rx8025_read_reg 2-ctrl2 --%x\n",ctrl2);
#if 0
ctrl2 = rx8025_write_reg(client, RX8025_REG_FLAG,
ctrl2 | RX8025_BIT_CTRL2_XST);
#endif
ctrl2 = rx8025_write_reg(client, RX8025_REG_FLAG,ctrl2);
if (ctrl2 < 0)
return ctrl2;
//printk("---rx8025_read_reg 3-ctrl2 --%x\n",ctrl2);
ctrl2 = rx8025_read_reg(client, RX8025_REG_FLAG);
//printk("---rx8025_read_reg 4-RX8025_REG_FLAG --%x\n",ctrl2);
if (ctrl2 < 0)
return ctrl2;
return ctrl2;
}
static irqreturn_t rx8025_handle_irq(int irq, void *dev_id)
{
struct i2c_client *client = dev_id;
struct rx8025_data *rx8025 = i2c_get_clientdata(client);
struct mutex *lock = &rx8025->rtc->ops_lock;
int status;
mutex_lock(lock);
#if 0
status = rx8025_read_reg(client, RX8025_REG_FLAG);
if (status < 0)
goto out;
if (!(status & RX8025_BIT_CTRL2_XST))
dev_warn(&client->dev, "Oscillation stop was detected,"
"you may have to readjust the clock\n");
if (status & RX8025_BIT_CTRL2_CTFG) {
/* periodic */
status &= ~RX8025_BIT_CTRL2_CTFG;
rtc_update_irq(rx8025->rtc, 1, RTC_PF | RTC_IRQF);
}
if (status & RX8025_BIT_FLAG_AF) {
/* alarm */
status &= RX8025_BIT_CTRL2_DAFG;
if (rx8025_write_reg(client, RX8025_REG_CTRL1,
rx8025->ctrl1 & ~RX8025_BIT_CTRL1_DALE))
goto out;
rtc_update_irq(rx8025->rtc, 1, RTC_AF | RTC_IRQF);
}
out:
#endif
mutex_unlock(lock);
return IRQ_HANDLED;
}
static int rx8025_get_time(struct device *dev, struct rtc_time *dt)
{
struct rx8025_data *rx8025 = dev_get_drvdata(dev);
u8 date[7];
int err;
err = rx8025_check_validity(dev);
if (err)
return err;
err = rx8025_read_regs(rx8025->client, RX8025_REG_SEC, 7, date);
if (err)
return err;
dev_dbg(dev, "%s: read %7ph\n", __func__, date);
dt->tm_sec = bcd2bin(date[RX8025_REG_SEC] & 0x7f);
dt->tm_min = bcd2bin(date[RX8025_REG_MIN] & 0x7f);
if (rx8025->ctrl1 & RX8025_BIT_CTRL1_1224)
dt->tm_hour = bcd2bin(date[RX8025_REG_HOUR] & 0x3f);
else
dt->tm_hour = bcd2bin(date[RX8025_REG_HOUR] & 0x1f) % 12
+ (date[RX8025_REG_HOUR] & 0x20 ? 12 : 0);
dt->tm_mday = bcd2bin(date[RX8025_REG_MDAY] & 0x3f);
dt->tm_mon = bcd2bin(date[RX8025_REG_MONTH] & 0x1f) - 1;
dt->tm_year = bcd2bin(date[RX8025_REG_YEAR]) + 100;
dev_dbg(dev, "%s: date %ptRr\n", __func__, dt);
return 0;
}
static int rx8025_set_time(struct device *dev, struct rtc_time *dt)
{
struct rx8025_data *rx8025 = dev_get_drvdata(dev);
u8 date[7];
int ret;
dev_err(dev,"---rx8025_set_time---dt->tm_year=%d--------------\n",dt->tm_year);
if ((dt->tm_year < 100) || (dt->tm_year > 199))
return -EINVAL;
//dev_err(dev,"---rx8025_set_time---------2--------\n");
/*
* Here the read-only bits are written as "0". I'm not sure if that
* is sound.
*/
date[RX8025_REG_SEC] = bin2bcd(dt->tm_sec);
date[RX8025_REG_MIN] = bin2bcd(dt->tm_min);
if (rx8025->ctrl1 & RX8025_BIT_CTRL1_1224)
date[RX8025_REG_HOUR] = bin2bcd(dt->tm_hour);
else
date[RX8025_REG_HOUR] = (dt->tm_hour >= 12 ? 0x20 : 0)
| bin2bcd((dt->tm_hour + 11) % 12 + 1);
date[RX8025_REG_WDAY] = bin2bcd(dt->tm_wday);
date[RX8025_REG_MDAY] = bin2bcd(dt->tm_mday);
date[RX8025_REG_MONTH] = bin2bcd(dt->tm_mon + 1);
date[RX8025_REG_YEAR] = bin2bcd(dt->tm_year - 100);
dev_dbg(dev, "%s: write %7ph\n", __func__, date);
ret = rx8025_write_regs(rx8025->client, RX8025_REG_SEC, 7, date);
if (ret < 0)
return ret;
//dev_err(dev,"---rx8025_set_time---------3-------\n");
return rx8025_reset_validity(rx8025->client);
}
static int rx8025_init_client(struct i2c_client *client)
{
struct rx8025_data *rx8025 = i2c_get_clientdata(client);
u8 ctrl[3]={0,0,0,}, ctrl2 = 0;
int need_clear = 0;
int err;
// read 3 reg form 0x0d to 0x0f
err = rx8025_read_regs(rx8025->client, RX8025_REG_EXTEN,3, ctrl);
if (err)
{
goto out;
}
dev_warn(&client->dev, "0x0d=%x,0x0e=%x,0x0f=%x\n",ctrl[0],ctrl[1],ctrl[2]);
/* Keep test bit zero ! */
rx8025->ctrl1 = ctrl[0] & ~RX8025_BIT_CTRL1_TEST;
if (ctrl[1] & (RX8025_BIT_FLAG_AF||(RX8025_BIT_FLAG_TF)||(RX8025_BIT_FLAG_UF))) {
dev_warn(&client->dev, "Alarm was detected\n");
need_clear = 1;
}
if (ctrl[1] & (RX8025_BIT_FLAG_VLF||(RX8025_BIT_FLAG_VDET))) {
dev_warn(&client->dev, "rx8025t is pown up,need set now time\n");
need_clear = 1;
}
//clear FGs
if (need_clear) {
ctrl2 = ctrl[1];
ctrl2 &= ~((RX8025_BIT_FLAG_AF)||(RX8025_BIT_FLAG_TF)||(RX8025_BIT_FLAG_UF));
err = rx8025_write_reg(client, RX8025_REG_FLAG, ctrl2);
}
out:
return err;
}
/* Alarm support */
static int rx8025_read_alarm(struct device *dev, struct rtc_wkalrm *t)
{
struct rx8025_data *rx8025 = dev_get_drvdata(dev);
struct i2c_client *client = rx8025->client;
u8 ald[2];
int ctrl2, err;
#if 0
if (client->irq <= 0)
return -EINVAL;
err = rx8025_read_regs(client, RX8025_REG_ALDMIN, 2, ald);
if (err)
return err;
ctrl2 = rx8025_read_reg(client, RX8025_REG_FLAG);
if (ctrl2 < 0)
return ctrl2;
dev_dbg(dev, "%s: read alarm 0x%02x 0x%02x ctrl2 %02x\n",
__func__, ald[0], ald[1], ctrl2);
/* Hardware alarms precision is 1 minute! */
t->time.tm_sec = 0;
t->time.tm_min = bcd2bin(ald[0] & 0x7f);
if (rx8025->ctrl1 & RX8025_BIT_CTRL1_1224)
t->time.tm_hour = bcd2bin(ald[1] & 0x3f);
else
t->time.tm_hour = bcd2bin(ald[1] & 0x1f) % 12
+ (ald[1] & 0x20 ? 12 : 0);
dev_dbg(dev, "%s: date: %ptRr\n", __func__, &t->time);
t->enabled = !!(rx8025->ctrl1 & RX8025_BIT_CTRL1_DALE);
t->pending = (ctrl2 & RX8025_BIT_CTRL2_DAFG) && t->enabled;
#endif
return err;
}
static int rx8025_set_alarm(struct device *dev, struct rtc_wkalrm *t)
{
struct i2c_client *client = to_i2c_client(dev);
struct rx8025_data *rx8025 = dev_get_drvdata(dev);
u8 ald[2];
int err;
#if 0
if (client->irq <= 0)
return -EINVAL;
/*
* Hardware alarm precision is 1 minute!
* round up to nearest minute
*/
if (t->time.tm_sec) {
time64_t alarm_time = rtc_tm_to_time64(&t->time);
alarm_time += 60 - t->time.tm_sec;
rtc_time64_to_tm(alarm_time, &t->time);
}
ald[0] = bin2bcd(t->time.tm_min);
if (rx8025->ctrl1 & RX8025_BIT_CTRL1_1224)
ald[1] = bin2bcd(t->time.tm_hour);
else
ald[1] = (t->time.tm_hour >= 12 ? 0x20 : 0)
| bin2bcd((t->time.tm_hour + 11) % 12 + 1);
dev_dbg(dev, "%s: write 0x%02x 0x%02x\n", __func__, ald[0], ald[1]);
if (rx8025->ctrl1 & RX8025_BIT_CTRL1_DALE) {
rx8025->ctrl1 &= ~RX8025_BIT_CTRL1_DALE;
err = rx8025_write_reg(rx8025->client, RX8025_REG_CTRL1,
rx8025->ctrl1);
if (err)
return err;
}
err = rx8025_write_regs(rx8025->client, RX8025_REG_ALDMIN, 2, ald);
if (err)
return err;
if (t->enabled) {
rx8025->ctrl1 |= RX8025_BIT_CTRL1_DALE;
err = rx8025_write_reg(rx8025->client, RX8025_REG_CTRL1,
rx8025->ctrl1);
if (err)
return err;
}
#endif
return 0;
}
static int rx8025_alarm_irq_enable(struct device *dev, unsigned int enabled)
{
struct rx8025_data *rx8025 = dev_get_drvdata(dev);
u8 ctrl1;
int err;
#if 0
ctrl1 = rx8025->ctrl1;
if (enabled)
ctrl1 |= RX8025_BIT_CTRL1_DALE;
else
ctrl1 &= ~RX8025_BIT_CTRL1_DALE;
if (ctrl1 != rx8025->ctrl1) {
rx8025->ctrl1 = ctrl1;
err = rx8025_write_reg(rx8025->client, RX8025_REG_CTRL1,
rx8025->ctrl1);
if (err)
return err;
}
#endif
return 0;
}
static const struct rtc_class_ops rx8025_rtc_ops = {
.read_time = rx8025_get_time,
.set_time = rx8025_set_time,
.read_alarm = rx8025_read_alarm,
.set_alarm = rx8025_set_alarm,
.alarm_irq_enable = rx8025_alarm_irq_enable,
};
/*
* Clock precision adjustment support
*
* According to the RX8025 SA/NB application manual the frequency and
* temperature characteristics can be approximated using the following
* equation:
*
* df = a * (ut - t)**2
*
* df: Frequency deviation in any temperature
* a : Coefficient = (-35 +-5) * 10**-9
* ut: Ultimate temperature in degree = +25 +-5 degree
* t : Any temperature in degree
*
* Note that the clock adjustment in ppb must be entered (which is
* the negative value of the deviation).
*/
static int rx8025_get_clock_adjust(struct device *dev, int *adj)
{
struct i2c_client *client = to_i2c_client(dev);
int digoff;
digoff = rx8025_read_reg(client, RX8025_REG_DIGOFF);
if (digoff < 0)
return digoff;
*adj = digoff >= 64 ? digoff - 128 : digoff;
if (*adj > 0)
(*adj)--;
*adj *= -RX8025_ADJ_RESOLUTION;
return 0;
}
static int rx8025_set_clock_adjust(struct device *dev, int adj)
{
struct i2c_client *client = to_i2c_client(dev);
u8 digoff;
int err;
adj /= -RX8025_ADJ_RESOLUTION;
if (adj > RX8025_ADJ_DATA_MAX)
adj = RX8025_ADJ_DATA_MAX;
else if (adj < RX8025_ADJ_DATA_MIN)
adj = RX8025_ADJ_DATA_MIN;
else if (adj > 0)
adj++;
else if (adj < 0)
adj += 128;
digoff = adj;
err = rx8025_write_reg(client, RX8025_REG_DIGOFF, digoff);
if (err)
return err;
dev_dbg(dev, "%s: write 0x%02x\n", __func__, digoff);
return 0;
}
static ssize_t rx8025_sysfs_show_clock_adjust(struct device *dev,
struct device_attribute *attr,
char *buf)
{
int err, adj;
err = rx8025_get_clock_adjust(dev, &adj);
if (err)
return err;
return sprintf(buf, "%d\n", adj);
}
static ssize_t rx8025_sysfs_store_clock_adjust(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
int adj, err;
if (sscanf(buf, "%i", &adj) != 1)
return -EINVAL;
err = rx8025_set_clock_adjust(dev, adj);
return err ? err : count;
}
static DEVICE_ATTR(clock_adjust_ppb, S_IRUGO | S_IWUSR,
rx8025_sysfs_show_clock_adjust,
rx8025_sysfs_store_clock_adjust);
static int rx8025_sysfs_register(struct device *dev)
{
return device_create_file(dev, &dev_attr_clock_adjust_ppb);
}
static void rx8025_sysfs_unregister(struct device *dev)
{
device_remove_file(dev, &dev_attr_clock_adjust_ppb);
}
static int rx8025_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
struct rx8025_data *rx8025;
int err = 0;
//dev_err(&adapter->dev,"---------------rx8025t----------1--------\n");
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA
| I2C_FUNC_SMBUS_I2C_BLOCK)) {
dev_err(&adapter->dev,
"doesn't support required functionality\n");
return -EIO;
}
//dev_err(&adapter->dev,"---------------rx8025t----------2--------\n");
rx8025 = devm_kzalloc(&client->dev, sizeof(*rx8025), GFP_KERNEL);
if (!rx8025)
return -ENOMEM;
rx8025->client = client;
i2c_set_clientdata(client, rx8025);
//dev_err(&adapter->dev,"---------------rx8025t----------3--------\n");
err = rx8025_init_client(client);
if (err)
{
return err;
}
rx8025->rtc = devm_rtc_device_register(&client->dev, client->name,
&rx8025_rtc_ops, THIS_MODULE);
if (IS_ERR(rx8025->rtc)) {
dev_err(&client->dev, "unable to register the class device\n");
return PTR_ERR(rx8025->rtc);
}
//dev_err(&adapter->dev,"---------------rx8025t----------4--------\n");
if (client->irq > 0) {
dev_info(&client->dev, "IRQ %d supplied\n", client->irq);
err = devm_request_threaded_irq(&client->dev, client->irq, NULL,
rx8025_handle_irq,
IRQF_ONESHOT,
"rx8025", client);
if (err) {
dev_err(&client->dev, "unable to request IRQ, alarms disabled\n");
client->irq = 0;
}
}
//dev_err(&adapter->dev,"---------------rx8025t----------5--------\n");
rx8025->rtc->max_user_freq = 1;
/* the rx8025 alarm only supports a minute accuracy */
rx8025->rtc->uie_unsupported = 1;
err = rx8025_sysfs_register(&client->dev);
//dev_err(&adapter->dev,"---------------rx8025t----------6---%d-----\n",err);
return err;
}
static int rx8025_remove(struct i2c_client *client)
{
rx8025_sysfs_unregister(&client->dev);
return 0;
}
static struct i2c_driver rx8025_driver = {
.driver = {
.name = "rtc-rx8025",
},
.probe = rx8025_probe,
.remove = rx8025_remove,
.id_table = rx8025_id,
};
module_i2c_driver(rx8025_driver);
MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>");
MODULE_DESCRIPTION("RX-8025 SA/NB RTC driver");
MODULE_LICENSE("GPL");
设备树 i2c节点下添加
rx8025t@32 {
compatible = "rx8025";
reg = <0x32>;
status = "okay";
};
# date
Thu Jan 1 00:00:23 UTC 1970
# date 043009202022.00
Sat Apr 30 09:20:00 UTC 2022
# date
Sat Apr 30 09:20:03 UTC 2022
#
# hwclock -r
[ 53.576177] rtc-rx8025 0-0032: power-on reset detected, date is invalid
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Invalid argument
#
# hwclock -w
[ 58.278766] rtc-rx8025 0-0032: ---rx8025_set_time---dt->tm_year=122--------------
#
# hwclock -r
2022-04-30 09:20:40.135005+00:00
大佬,esp8266 哪些脚要连到f1c200s阿? GPIO15 0 2 需要连接吗?
驱动里有用到float类型的变量,在编译的时候出现了
ERROR: "__aeabi_fcmpgt" undefined!
ERROR: "__aeabi_fcmplt" undefined!
ERROR: "__aeabi_ddiv" undefined!
ERROR: "__aeabi_fcmpge" undefined!
ERROR: "__aeabi_d2f" undefined!
ERROR: "__aeabi_dadd" undefined!
ERROR: "__aeabi_dmul" undefined!
ERROR: "__aeabi_f2d" undefined!
ERROR: "__aeabi_fsub" undefined!
ERROR: "__aeabi_fcmple" undefined!
这些错误,提示没有浮点库. makefile文件如下:
KERNELDIR := /home/jonsen/f1c100s/linux-nano-5.2-flash
CURRENT_PATH := $(shell pwd)
CROSS_COMPILE:= arm-linux-
ARCH = arm
obj-m := test.o
CFLAGS += -mfloat-abi=softfp
build: kernel_modules
kernel_modules:
$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules
clean:
$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) clean
请问怎么处理....让编译支持软件浮点.
触摸添加tslib
在buildroot中
│ Symbol: BR2_PACKAGE_TSLIB [=y] │
│ Type : boolean │
│ Prompt: tslib │
│ Location: │
│ -> Target packages │
│ -> Libraries │
│ -> Hardware handling
打开后 编译root 重新打包后烧录
buildroot 配置中tslib使能后,在 /etc/profile中加入以下内容。
#!/bin/sh
export T_ROOT=/usr/tslib4arm #目录
export TSLIB_TSDEVICE=/dev/input/event1 #触摸屏设备文件
export TSLIB_CALIBFILE=/etc/pointercal #指定触摸屏校准文件pintercal的存放位置
export TSLIB_CONFFILE=/etc/ts.conf #tslib模块配置文件
export TSLIB_PLUGINDIR=/usr/lib/ts/ #tslib插件库目录
export TSLIB_CONSOLEDEVICE=/dev/tty
export TSLIB_FBDEVICE=/dev/fb0 #framebuffer设备文件
echo "tslib init success!"
环境变量
#生效
source /etc/profile
# cd /usr/bin/
# ls ts*
ts_calibrate ts_print ts_test ts_verify
ts_finddev ts_print_mt ts_test_mt ts_verify_ts.conf
ts_harvest ts_print_raw ts_uinput
这些都是tslib自带的测试程序,运行ts_calibrate
完成5点测试便可以得到校正常数
vi /etc/pointercal 可以看到校正常数
修改lvgl Linux demo使用tslib获取触摸坐标
修改代码为tslib库获取触摸坐标
https://whycan.com/t_2303.html
参考这里
2022/1/29
关于 NS2009 触摸
1->设备树 添加
&i2c0 {
pinctrl-0 = <&i2c0_pins>;
pinctrl-names = "default";
status = "okay";
tsc2007: tsc2007@49 {
compatible = "ti,tsc2007";
reg = <0x49>;
interrupt-parent = <&pio>;
interrupts = <4 3 IRQ_TYPE_EDGE_BOTH>;
gpios = <&pio 4 3 GPIO_ACTIVE_LOW>;
ti,x-plate-ohms = <500>;
status = "okay";
};
};
make 后 更新设备树
2->内核开启 触摸驱动 ,应该在input 下
│ Symbol: TOUCHSCREEN_TSC2007 [=y] │
│ Type : tristate │
│ Prompt: TSC2007 based touchscreens │
│ Location: │
│ -> Device Drivers │
│ -> Input device support │
│ -> Generic input layer (needed for keyboard, mouse, ...) (INPUT [=y]) │
│ -> Touchscreens (INPUT_TOUCHSCREEN [=y])
开启tsc2007 驱动
make 重新编译 后更新内核
重启 发现按下屏幕没反应.
先调适中断,看是否能进入pio中断.
将PE3 用排线引出,插到gnd 和 3v3,cat /prco/interrupts 观察中断计数是否变化,发现中断不会变。说明加载中断后并不能进入中断。。。。
为了调试方便,重新 make menuconfig 将驱动选择去掉 ,tsc2007_core.c 和h文件复制出来。编译成模块。
研究probe函数
err = devm_request_threaded_irq(&client->dev, ts->irq,
tsc2007_hard_irq, tsc2007_soft_irq,
IRQF_ONESHOT,
client->dev.driver->name, ts);
if (err) {
dev_err(&client->dev, "Failed to request irq %d: %d\n",
ts->irq, err);
return err;
}
//tsc2007_stop(ts);
发现这里 devm_request_threaded_irq 申请中断后 在tsc2007_stop(ts); 会关闭中断。注释掉这句,重新编译加载。发现PE4 可以进入中断了
# cat /proc/interrupts
CPU0
16: 1893 sun4i_irq 13 Edge timer@1c20c00
17: 255997 sun4i_irq 10 Edge sun6i-spi
18: 305 sun4i_irq 29 Edge 1c0c000.lcd-controller
19: 7077 sun4i_irq 7 Edge mv64xxx_i2c
23: 911 sun4i_irq 23 Edge sunxi-mmc
24: 0 sun4i_irq 22 Edge sun4i-a10-lradc-keys
25: 445 sun4i_irq 1 Edge ttyS0
63: 348 sunxi_pio_edge 35 Edge tsc2007
Err: 0
不知那句去掉会怎样。。。。接下来调试iic数据读取。
tsc2007_stop(ts);不能删除.删除后在lvgl运行会出错.
在内核加入prink函数方便调试.
整体驱动思路是: 按下屏幕.irq上产生低电平,cpu中断,触发硬件中断,交给软中断下半部执行.在中断下半部中对iic设备读取。计算坐标。
原驱动是读取了原始数据直接上传到input的。为了屏幕调试方便这里修改了驱动,将原始数据转变成了屏幕像素坐标。
static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
{
struct tsc2007 *ts = handle;
struct input_dev *input = ts->input;
struct ts_event tc;
u32 rt;
printk("tsc2007_soft_irq\r\n");
while (!ts->stopped && tsc2007_is_pen_down(ts)) {
/* pen is down, continue with the measurement */
mutex_lock(&ts->mlock);
tsc2007_read_values(ts, &tc);
mutex_unlock(&ts->mlock);
rt = tsc2007_calculate_resistance(ts, &tc);
{//Scale and offset the touchscreen coordinates
s32 hmin = 216,hmax = 3940,vmin = 250,vmax = 3830;
s32 x = 0,y=0;
x = (tc.x - hmin)*1000/4655;
if(x < 0)
{
x = 0;
}
else if(x > 800)
{
x = 800;
}
y = (tc.y - vmin)*1000/7458;
if(y < 0)
{
y = 0;
}
else if(y > 480)
{
y = 480;
}
printk("h=%d v=%d\r\n",x,y);
if (!rt && !ts->get_pendown_state) {
/*
* If pressure reported is 0 and we don't have
* callback to check pendown state, we have to
* assume that pen was lifted up.
*/
break;
}
if (rt <= ts->max_rt) {
dev_dbg(&ts->client->dev,
"DOWN point(%4d,%4d), resistance (%4u)\n",
tc.x, tc.y, rt);
rt = ts->max_rt - rt;
input_report_key(input, BTN_TOUCH, 1);
input_report_abs(input, ABS_X, x);
input_report_abs(input, ABS_Y, y);
input_report_abs(input, ABS_PRESSURE, rt);
input_sync(input);
} else {
/*
* Sample found inconsistent by debouncing or pressure is
* beyond the maximum. Don't report it to user space,
* repeat at least once more the measurement.
*/
dev_dbg(&ts->client->dev, "ignored pressure %d\n", rt);
}
}
wait_event_timeout(ts->wait, ts->stopped, ts->poll_period);
}
dev_dbg(&ts->client->dev, "UP\n");
input_report_key(input, BTN_TOUCH, 0);
input_report_abs(input, ABS_PRESSURE, 0);
input_sync(input);
if (ts->clear_penirq)
ts->clear_penirq();
return IRQ_HANDLED;
}
这样加载驱动后,再运行lvgl demo就可以正常触摸了。
LittlevGL 使用 lvgl
LittlevGL 是一个开源免费的GUI,支持触摸屏操作,LittlevGL 自带了丰富的控件:窗口、按键、标签、list、图表等,还可以自定义控件;支持很多特效:透明、阴影、自动显示隐藏滚动条、界面切换动画、图标打开关闭动画、平滑的拖拽控件、分层显示、反锯齿、仅耗少量内存的字体等等。
中文翻译后的参考网站
http://lvgl.100ask.org/8.1/intro/index.html
git clone --recursive
把demo 连同 工程一起下来
git clone --recursive https://github.com/lvgl/lv_port_linux_frame_buffer
使用cmake构建makefile 安装cmake
apt-get install cmake
这步可以不要,下载的工程里有了makefil文件了 到工程目录里执行 make
#define LV_HOR_RES_MAX (480) //屏幕水平宽度 根据实际使用修改
#define LV_VER_RES_MAX (320) //屏幕垂直高度 根据实际使用修改
#define LV_COLOR_DEPTH 16 //LCD 屏幕的像素深度。一般的可能是rgb565 也有是rgb8888的就写 32 根据实际使用修改
#define LV_USE_GPU 1 //这个记得给他置0了一般的板子应该没有gpu
下面这几个可以不动
#define LV_USE_PERF_MONITOR 0 //右下角cpu信息输出。测试可以打开看下
# define LV_MEM_SIZE (32U * 1024U) //这里默认的是32K 用作lvgl的动态内存分配。可以根据实际情况修改,但是要大于等于2KB
#define LV_DISP_DEF_REFR_PERIOD 30 //刷新周期 30ms 就是刷新速率问题,看性能设置吧。
#define LV_INDEV_DEF_READ_PERIOD 30//输入设备的扫描时间,就是轮询按键的时间。默认30ms。
#define LV_USE_FILESYSTEM 1 //文件系统不用也可以给置0了
#define LV_USE_DEBUG 1 //debug信息输出可关闭
驱动修改
将lvgl driver模板拷贝出来修改 cp lv_drivers/lv_drv_conf_template.h ./lv_drv_conf.h
修改头 if 0改为 if 1
# define USE_FBDEV 0 //把这个置位为1
# define FBDEV_PATH "/dev/fb0" //确认是否为你设备的fb
闪动的光标 移除方法:
echo 0 > /sys/class/graphics/fbcon/cursor_blink
echo 0 > /sys/class/vtconsole/vtcon1/bind
lvgl加入input支持,1在头文件里使能。2加入input支持函数
/*tuch function */
evdev_init();
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type =LV_INDEV_TYPE_POINTER;
indev_drv.read_cb =evdev_read;
lv_indev_drv_register(&indev_drv);
注意:这部分函数要加在 屏幕显示设备初始化之后, 因为在lvgl中disp_drv 是所有对象的父节点。
在内核源码sun4i-lradc-keys.c 中加入printk函数 察看一些数据
static irqreturn_t sun4i_lradc_irq(int irq, void *dev_id)
{
struct sun4i_lradc_data *lradc = dev_id;
u32 i, ints, val, voltage, diff, keycode = 0, closest = 0xffffffff;
ints = readl(lradc->base + LRADC_INTS);
/*
* lradc supports only one keypress at a time, release does not give
* any info as to which key was released, so we cache the keycode.
*/
if (ints & CHAN0_KEYUP_IRQ) {
input_report_key(lradc->input, lradc->chan0_keycode, 0);
lradc->chan0_keycode = 0;
}
if ((ints & CHAN0_KEYDOWN_IRQ) && lradc->chan0_keycode == 0) {
val = readl(lradc->base + LRADC_DATA0) & 0x3f;
voltage = val * lradc->vref / 63;
for (i = 0; i < lradc->chan0_map_count; i++) {
diff = abs(lradc->chan0_map[i].voltage - voltage);
if (diff < closest) {
closest = diff;
keycode = lradc->chan0_map[i].keycode;
}
}
{
int reg = 0;
printk("val = %d,lradc voltage = %d,lradc->vref = %d\n",val,voltage,lradc->vref);
reg = readl(lradc->base + LRADC_CTRL);
printk("LRADC_CTRL=%x\n",reg);
printk("keycode=%x\n",keycode);
}
lradc->chan0_keycode = keycode;
input_report_key(lradc->input, lradc->chan0_keycode, 1);
}
input_sync(lradc->input);
writel(ints, lradc->base + LRADC_INTS);
return IRQ_HANDLED;
}
观察按下按键后的数据
[ 2762.695488] val = 13,lradc voltage = 412698,lradc->vref = 2000000
[ 2762.701589] LRADC_CTRL=2000141
[ 2762.704639] keycode=72
根据lradc voltage = 412698 修改设备树中
button-200 {
label = "Volume Up";
linux,code = <KEY_VOLUMEUP>;
channel = <0>;
voltage = <200000>;
};
各按键的电压值,可以改成一样或在附近的值.比如lradc voltage = 412698 可以把节点改成
button-200 {
label = "Volume Up";
linux,code = <KEY_VOLUMEUP>;
channel = <0>;
voltage = <412698>;
};
依次检测4个按键并修改设备树.
另外在调试总发现lrad 是非线性的.而且电压超过1.4v不能进中断,每个按键间隔最好在0.3V以上.通过上面修改,驱动部分基本正常了,每次按下都可以printk打印出原始电压,键值等.
接下来编写app测试,参看正点原子的教程,复制源码即可.
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <poll.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/input.h>
/* 定义一个 input_event 变量,存放输入事件信息 */
static struct input_event inputevent;
int main(int argc, char *argv[])
{
int fd;
int err = 0;
char *filename;
filename = argv[1];
if(argc != 2) {
printf("Error Usage!\r\n");
return -1;
}
fd = open(filename, O_RDWR);
if (fd < 0) {
printf("Can't open file %s\r\n", filename);
return -1;
}
while (1) {
err = read(fd, &inputevent, sizeof(inputevent));
if (err > 0) { /* 读取数据成功 */
switch (inputevent.type) {
case EV_KEY:
if (inputevent.code < BTN_MISC)
{ /* 键盘键值 */
printf("key %x %s\r\n", inputevent.code,inputevent.value ? "press" : "release");
}
else
{
printf("button %x %s\r\n", inputevent.code,inputevent.value ? "press" : "release");
}
break;
/* 其他类型的事件,自行处理 */
case EV_REL:
break;
case EV_ABS:
break;
case EV_MSC:
break;
case EV_SW:
break;
}
}
else {
printf("读取数据失败\r\n");
}
}
return 0;
}
运行app 每次按下松开会有如下打印:
[ 2763.057281] val = 0,lradc voltage = 0,lradc->vref = 2000000
[ 2763.062866] LRADC_CTRL=2000141
[ 2763.065917] keycode=73
key 73 press
key 73 release
关于lradc 调试
lradc是低精度adc,可以用来做按键检测.sunxi-keyboard.c中被调用
驱动编写
可以参考的例子有:
https://blog.csdn.net/u012577474/articl … .3001.4187
1)\linux-3.4\drivers\input\keyboard\sunxi-keyboard.c 用ADC实现的按钮动作驱动。
2)\linux-3.4\drivers\char\sunxi_ir_cut\ir-cut.c 用ADC读出ir cut的位置。
内核配置项路径如下:
Device Driver -> Input device support -> Keyboards -> <*> Allwinner sun4i low res adc attached tablet keys support
默认是打开的,
设备树中
lradc: lradc@1C23400 {
compatible = "allwinner,sun4i-a10-lradc-keys";
reg = <0x01C23400 0x400>;
interrupts = <22>;
status = "disabled";
};
&lradc {
vref-supply = <®_vcc3v0>;
status = "okay";
button-200 {
label = "Volume Up";
linux,code = <KEY_VOLUMEUP>;
channel = <0>;
voltage = <200000>;
};
button-400 {
label = "Volume Down";
linux,code = <KEY_VOLUMEDOWN>;
channel = <0>;
voltage = <400000>;
};
button-600 {
label = "Select";
linux,code = <KEY_SELECT>;
channel = <0>;
voltage = <600000>;
};
button-800 {
label = "Start";
linux,code = <KEY_OK>;
channel = <0>;
voltage = <800000>;
};
};
默认也有,
开机启动后 执行
cat /proc/interrupts
# cat /proc/interrupts
CPU0
16: 183732 sun4i_irq 13 Edge timer@1c20c00
17: 259564 sun4i_irq 10 Edge sun6i-spi
18: 304 sun4i_irq 29 Edge 1c0c000.lcd-controller
19: 470 sun4i_irq 7 Edge mv64xxx_i2c
23: 341287 sun4i_irq 23 Edge sunxi-mmc
24: 12 sun4i_irq 22 Edge sun4i-a10-lradc-keys
25: 1057 sun4i_irq 1 Edge ttyS0
26: 36 sun4i_irq 26 Edge musb-hdrc.1.auto
62: 1 sunxi_pio_edge 34 Edge usb0-id-det
Err: 0
会看到lradc中断
24: 12 sun4i_irq 22 Edge sun4i-a10-lradc-keys
usb 虚拟串口 CDC 测试
USB 有关的网址
http://trac.gateworks.com/wiki/linux/OTG
https://openwrt.org/docs/guide-user/hardware/usb_gadget
相关知识补充
一些驱动被指定为M 编译。但是没有安装。这些模块可以放到rootfs里面去。等真正需要的时候再加载。这些就是通过make modules和modules_install完成的
insmod是把模块加载进内核,加载之后才能运行。
make modules_install 只是把编译好的模块拷贝到系统目录下(一般是/lib/modules/)
也可自己指定ko安装路径:
make modules_install INSTALL_MOD_PATH=/home/luther/gliethttp_dir
拷贝到系统目录下的目的是方便使用。一般加载驱动使用modprobe XXX命令,该命令从系统目录下查找名为XXX的模块。其实你也可以不做make modules_install,但是这样的话你就需要每次手动从编译目录里运行insmod.
运行modules_install的另一个作用是会运行depmod去生成modules.dep文件,该文件记录了模块之间的依赖关系。这样当你modprobe XXX的时候就能够把XXX所依赖的模块一并加载了
https://whycan.com/t_2401.html
进入linux 内核目录
make ARCH=arm menuconfig
对应的 gadget 驱动程序.Device Driver -> USB support -> USB Gadget support
<*> USB Gadget precomposed configurations (Serial Gadget (with CDC ACM and CDC OBEX support)) --->
编译 ,这里可以 编译成模块加载 ,也可以编译到内核。
如果选编译到内核就可以上电 直接将USB 虚拟成 串口。
注意 USB 工作在从机模式 USB ID 应该是高电平,内核代码里是PE2 。需要上拉。
电脑端 Zadig 驱动下载
https://zadig.akeo.ie/#google_vignette
合并编译器-采用bulidroot中的编译器
由于之前的操作中buildroot 采用的默认编译器,与,linux kernel 和 uboot 不一样。导致应用程序 需要用buildroot 中的编译器才能 正常执行。
接下来统一采用buildroot中的工具链 ,重新编译 linux kernel 和uboot
打包烧录
先把arm-linux-gcc 的环境变量改成buildroot中的位置,同步好
编译linu
make ARCH=arm CROSS_COMPILE=arm-linux- -j4
编译uboot
make ARCH=arm CROSS_COMPILE=arm-linux- -j4
编译root
make
打包
整体烧录
sudo sh BuildMyImage.sh
sudo sunxi-fel -p spiflash-write 0 f1c100s_spiflash_16M.bin
2022/1/12
合并编译器-采用buildroot外部编译器
进入buildroot 目录,make menuconfig
设置如下:
Toolchain --->
Toolchain type (External toolchain) ---> //选择外部工具链
Toolchain (Custom toolchain) ---> //定制工具链
(/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi) Toolchain path
($(ARCH)-linux-gnueabi) Toolchain prefix
External toolchain gcc version (7.x) --->//根据实际外部工具链gcc 定
查看下gcc 版本
External toolchain kernel headers series (2.6.x) 先不改
External toolchain C library (glibc/eglibc) --->
make 看下效果
>>> toolchain-external-custom Extracting
>>> toolchain-external-custom Patching
>>> toolchain-external-custom Configuring
Incorrect selection of kernel headers: expected 2.6.x, got 4.10.x
make[1]: *** [package/pkg-generic.mk:220: /home/jonsen/f1c100s/buildroot-2017.08/output/build/toolchain-external-custom/.stamp_configured] Error 1
make: *** [Makefile:79: _all] Error 2
提示内核选择错误,重新make menuconfig 修改目标内核版本 改成
External toolchain kernel headers series (4.10.x)
/usr/bin/make -j1 O=/home/jonsen/f1c100s/buildroot-2017.08/output HOSTCC="/usr/bin/gcc" HOSTCXX="/usr/bin/g++" silentoldconfig
>>> toolchain-external-custom Configuring
>>> toolchain-external-custom Building
/usr/bin/gcc -O2 -I/home/jonsen/f1c100s/buildroot-2017.08/output/host/include -DBR_CPU='"arm926ej-s"' -DBR_ABI='"aapcs-linux"' -DBR_FLOAT_ABI='"soft"' -DBR_MODE='"arm"' -DBR_SOFTFLOAT=1 -DBR_CROSS_PATH_SUFFIX='""' -DBR_CROSS_PATH_ABS='"/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin"' -DBR_SYSROOT='"arm-buildroot-linux-gnueabi/sysroot"' -DBR_ADDITIONAL_CFLAGS='' -s -Wl,--hash-style=both toolchain/toolchain-wrapper.c -o /home/jonsen/f1c100s/buildroot-2017.08/output/build/toolchain-external-custom/toolchain-wrapper
>>> toolchain-external-custom Installing to staging directory
/usr/bin/install -D -m 0755 /home/jonsen/f1c100s/buildroot-2017.08/output/build/toolchain-external-custom/toolchain-wrapper /home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/toolchain-wrapper
ln: failed to create symbolic link '/home/jonsen/f1c100s/buildroot-2017.08/output/host/arm-buildroot-linux-gnueabi/sysroot/usr/lib': No such file or directory
make[1]: *** [package/pkg-generic.mk:269: /home/jonsen/f1c100s/buildroot-2017.08/output/build/toolchain-external-custom/.stamp_staging_installed] Error 1
make: *** [Makefile:79: _all] Error 2
提示 没有路径 ,尝试 sudo make
>>> toolchain-external-custom Installing to staging directory
/usr/bin/install -D -m 0755 /home/jonsen/f1c100s/buildroot-2017.08/output/build/toolchain-external-custom/toolchain-wrapper /home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/toolchain-wrapper
ln: failed to create symbolic link '/home/jonsen/f1c100s/buildroot-2017.08/output/host/arm-buildroot-linux-gnueabi/sysroot/usr/lib': No such file or directory
make: *** [package/pkg-generic.mk:269: /home/jonsen/f1c100s/buildroot-2017.08/output/build/toolchain-external-custom/.stamp_staging_installed] Error 1
还是提示No such file or directory
手动到该目录下 建立路径
cd output/host/arm-buildroot-linux-gnueabi/sysroot/
ls
mkdir usr
再回到buildroot根目录 make
看到 发现编译成功了
>>> Generating root filesystem image rootfs.tar
ls -al ./output/images/
total 1680
drwxr-xr-x 2 jonsen jonsen 4096 Jan 5 12:11 .
drwxrwxr-x 6 jonsen jonsen 4096 Jan 12 09:21 ..
-rw-r--r-- 1 jonsen jonsen 1710080 Jan 12 09:25 rootfs.tar
最新生成的.
复制rootfs.tar 到 打包目录
sudo cp buildroot-2017.08/output/images/rootfs.tar rootfs/
解压
sudo tar -xvf rootfs.tar
随便把 uboot 和linux 重新编译以下然后打包烧录
编译linu
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
编译uboot
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
打包
sudo ./BuildMyImage.sh
烧录
sudo sunxi-fel -p spiflash-write 0 f1c100s_spiflash_16M.bin
合并编译器
由于之前的操作中buildroot 采用的默认编译器,与,linux kernel 和 uboot 不一样。导致应用程序 需要用buildroot 中的编译器才能 正常执行。
接下来统一采用buildroot中的工具链 ,重新编译 linux kernel 和uboot
打包烧录
先把arm-linux-gcc 的环境变量改成buildroot中的位置,同步好
编译linux
make ARCH=arm CROSS_COMPILE=arm-linux- -j4
编译uboot
make ARCH=arm CROSS_COMPILE=arm-linux- -j4
编译root
make
打包
整体烧录
sudo sh BuildMyImage.sh
sudo sunxi-fel -p spiflash-write 0 f1c100s_spiflash_16M.bin
又是5分钟漫长的等待,,,,,,,,,,不知道情况怎么样
LittlevGL 使用 lvgl
LittlevGL 是一个开源免费的GUI,支持触摸屏操作,LittlevGL 自带了丰富的控件:窗口、按键、标签、list、图表等,还可以自定义控件;支持很多特效:透明、阴影、自动显示隐藏滚动条、界面切换动画、图标打开关闭动画、平滑的拖拽控件、分层显示、反锯齿、仅耗少量内存的字体等等。
git clone --recursive
把demo 连同 工程一起下来
git clone --recursive https://github.com/lvgl/lv_port_linux_frame_buffer
使用cmake构建makefile 安装cmake
apt-get install cmake
这步可以不要,下载的工程里有了makefil文件了
修改makefile 里cc = [--------] //自己编译器的 路径。。。编译后 生成 demo文件
rz
到板子运行。。
lcd适配
修改uboot
LCD上输出显示,请通过配置 ARM architecture ‣ Enable graphical uboot console on HDMI, LCD or VGA 为 Y
接着配置同级的 LCD panel timing details 为:
x:800,y:480,depth:18,pclk_khz:33000,le:87,ri:40,up:31,lo:13,hs:1,vs:1,sync:3,vmode:0
注:此块屏为为 800*480 规格,如为 480*272 请尝试如下配置 x:480,y:272,depth:18,pclk_khz:10000,le:42,ri:8,up:11,lo:4,hs:1,vs:1,sync:3,vmode:0
并将 LCD panel backlight pwm pin 设为:
PE6 (查自 Nano 原理图)
烧录到ram 测试
sudo sunxi-fel uboot u-boot-nano-lcd800480/u-boot-sunxi-with-spl.bin
sudo sunxi-fel -p spiflash-write 0 u-boot-nano-lcd800480/u-boot-sunxi-with-spl.bin
修改linux kernel
suniv-f1c100s-licheepi-nano.dts 修改
panel: panel {
//当前默认的 LCD配置 为480X272大小的屏幕,
compatible = "qiaodian,qd43003c0-40", "simple-panel";
若要修改为适配800X480的屏,此处应当:
/ { } 所包裹的根节点目录下,panel属性下的compatible,应修改为:
“lg,lb070wv8”, “simple-panel”
终端输入echo "123333" > /dev/tty0 屏幕有字符出现
重启进入uboot
print bootargs观察默认参数
bootargs=console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2
设置lcd 作为 终端控制台
setenv bootargs 'console=tty1 console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2'
保存
saveenv
修改/etc/inittab 文件 在里面加入下面这一行:
tty1::askfirst:-/bin/sh
修改完成以后保存/etc/inittab 并退出,然后重启开发板,重启以后开发板 LCD 屏幕最后一行会显示下面一行语句:
Please press Enter to activate this console
echo "Hello" > /dev/tty1
cat /dev/random > /dev/tty1
随机像素
cat /dev/urandom > /dev/fb0
新年第一帖,开源 全志f1c100s(200s)所有IO都引出,直接上图
F1C100s.zip
感谢大佬,
目前写成了,顺利编译
KERNELDIR := /home/jonsen/f1c100s/linux/
CURRENT_PATH := $(shell pwd)
CROSS_COMPILE:= /home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-
ARCH = arm
obj-m := chardevbase.o
build: kernel_modules
kernel_modules:
$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules
clean:
$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) clean
ARCH=arm
#当前目录
CUR_DIR = $(shell pwd)
#源码目录
KERNEL_DIR = /home/jonsen/f1c100s/linux
#交叉编译工具链
CROSS_COMPILE = arm-linux-gnueabihf-
#模块名字
MODULE_NAME = chrdevbaseifeq ($(KERNELRELEASE),)
all:
make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNEL_DIR) M=$(CUR_DIR) modules
clean:
#清除模块
make -C $(KERNEL_DIR) M=$(CUR_DIR) clean
else
obj-m+=$(MODULE_NAME).oendif
试试这个
晕哥 我这边编译 好多错误,怎么办呀,呼叫晕哥
程序复制了1楼的 ,Makefile复制了5楼并改了 路径
编译结果如下
jonsen@ubuntu:~/f1c100s/test_chrdevbase$ make
make -C /home/jonsen/f1c100s/linux/ M=/home/jonsen/f1c100s/test_chrdevbase modules
make[1]: Entering directory '/home/jonsen/f1c100s/linux'
CC [M] /home/jonsen/f1c100s/test_chrdevbase/chardevbase.o
In file included from ./arch/x86/include/asm/barrier.h:5,
from ./include/linux/compiler.h:242,
from ./include/linux/kernel.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/arch_hweight.h: In function ‘__arch_hweight64’:
./arch/x86/include/asm/arch_hweight.h:55:42: error: expected ‘:’ or ‘)’ before ‘POPCNT64’
55 | asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
| ^~~~~~~~
./arch/x86/include/asm/alternative.h:133:28: note: in definition of macro ‘ALTINSTR_REPLACEMENT’
133 | b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n\t"
| ^~~~~~~~
./arch/x86/include/asm/arch_hweight.h:55:7: note: in expansion of macro ‘ALTERNATIVE’
55 | asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
| ^~~~~~~~~~~
In file included from ./arch/x86/include/asm/atomic.h:276,
from ./include/linux/atomic.h:5,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/atomic64_64.h: At top level:
./arch/x86/include/asm/atomic64_64.h:20:40: error: unknown type name ‘atomic64_t’
20 | static inline long atomic64_read(const atomic64_t *v)
| ^~~~~~~~~~
In file included from ./include/linux/kernel.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h: In function ‘atomic64_read’:
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
22 | return READ_ONCE((v)->counter);
| ^~
./include/linux/compiler.h:246:17: note: in definition of macro ‘__READ_ONCE’
246 | union { typeof(x) __val; char __c[1]; } __u; \
| ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
22 | return READ_ONCE((v)->counter);
| ^~~~~~~~~
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
22 | return READ_ONCE((v)->counter);
| ^~
./include/linux/compiler.h:248:22: note: in definition of macro ‘__READ_ONCE’
248 | __read_once_size(&(x), __u.__c, sizeof(x)); \
| ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
22 | return READ_ONCE((v)->counter);
| ^~~~~~~~~
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
22 | return READ_ONCE((v)->counter);
| ^~
./include/linux/compiler.h:248:42: note: in definition of macro ‘__READ_ONCE’
248 | __read_once_size(&(x), __u.__c, sizeof(x)); \
| ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
22 | return READ_ONCE((v)->counter);
| ^~~~~~~~~
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
22 | return READ_ONCE((v)->counter);
| ^~
./include/linux/compiler.h:250:30: note: in definition of macro ‘__READ_ONCE’
250 | __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
| ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
22 | return READ_ONCE((v)->counter);
| ^~~~~~~~~
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
22 | return READ_ONCE((v)->counter);
| ^~
./include/linux/compiler.h:250:50: note: in definition of macro ‘__READ_ONCE’
250 | __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
| ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
22 | return READ_ONCE((v)->counter);
| ^~~~~~~~~
In file included from ./arch/x86/include/asm/atomic.h:276,
from ./include/linux/atomic.h:5,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/atomic64_64.h: At top level:
./arch/x86/include/asm/atomic64_64.h:32:33: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
32 | static inline void atomic64_set(atomic64_t *v, long i)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:44:50: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
44 | static __always_inline void atomic64_add(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:58:41: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
58 | static inline void atomic64_sub(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:74:50: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
74 | static inline bool atomic64_sub_and_test(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:85:42: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
85 | static __always_inline void atomic64_inc(atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:98:42: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
98 | static __always_inline void atomic64_dec(atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:113:42: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
113 | static inline bool atomic64_dec_and_test(atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:126:42: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
126 | static inline bool atomic64_inc_and_test(atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:140:50: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
140 | static inline bool atomic64_add_negative(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:152:57: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
152 | static __always_inline long atomic64_add_return(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:157:48: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
157 | static inline long atomic64_sub_return(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:162:47: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
162 | static inline long atomic64_fetch_add(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:167:47: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
167 | static inline long atomic64_fetch_sub(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:175:37: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
175 | static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:181:50: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
181 | static __always_inline bool atomic64_try_cmpxchg(atomic64_t *v, s64 *old, long new)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:186:34: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
186 | static inline long atomic64_xchg(atomic64_t *v, long new)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:200:40: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
200 | static inline bool atomic64_add_unless(atomic64_t *v, long a, long u)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:219:45: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
219 | static inline long atomic64_dec_if_positive(atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:230:41: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
230 | static inline void atomic64_and(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:238:47: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
238 | static inline long atomic64_fetch_and(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:247:40: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
247 | static inline void atomic64_or(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:255:46: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
255 | static inline long atomic64_fetch_or(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:264:41: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
264 | static inline void atomic64_xor(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:272:47: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
272 | static inline long atomic64_fetch_xor(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
In file included from ./include/linux/atomic.h:660,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/asm-generic/atomic64.h:21:18: error: conflicting types for ‘atomic64_read’
21 | extern long long atomic64_read(const atomic64_t *v);
| ^~~~~~~~~~~~~
In file included from ./arch/x86/include/asm/atomic.h:276,
from ./include/linux/atomic.h:5,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/atomic64_64.h:20:20: note: previous definition of ‘atomic64_read’ was here
20 | static inline long atomic64_read(const atomic64_t *v)
| ^~~~~~~~~~~~~
In file included from ./include/linux/atomic.h:660,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/asm-generic/atomic64.h:59: warning: "atomic64_inc_return" redefined
59 | #define atomic64_inc_return(v) atomic64_add_return(1LL, (v))
|
In file included from ./arch/x86/include/asm/atomic.h:276,
from ./include/linux/atomic.h:5,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/atomic64_64.h:172: note: this is the location of the previous definition
172 | #define atomic64_inc_return(v) (atomic64_add_return(1, (v)))
|
In file included from ./include/linux/atomic.h:660,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/asm-generic/atomic64.h:63: warning: "atomic64_dec_return" redefined
63 | #define atomic64_dec_return(v) atomic64_sub_return(1LL, (v))
|
In file included from ./arch/x86/include/asm/atomic.h:276,
from ./include/linux/atomic.h:5,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/atomic64_64.h:173: note: this is the location of the previous definition
173 | #define atomic64_dec_return(v) (atomic64_sub_return(1, (v)))
|
In file included from ./include/linux/atomic.h:660,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/asm-generic/atomic64.h:65: warning: "atomic64_inc_not_zero" redefined
65 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL)
|
In file included from ./arch/x86/include/asm/atomic.h:276,
from ./include/linux/atomic.h:5,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/atomic64_64.h:210: note: this is the location of the previous definition
210 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
|
In file included from ./arch/x86/include/asm/pgtable_types.h:324,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/asm-generic/pgtable-nopud.h:21: warning: "PUD_SHIFT" redefined
21 | #define PUD_SHIFT P4D_SHIFT
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/pgtable_64_types.h:56: note: this is the location of the previous definition
56 | #define PUD_SHIFT 30
|
In file included from ./arch/x86/include/asm/pgtable_types.h:324,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/asm-generic/pgtable-nopud.h:22: warning: "PTRS_PER_PUD" redefined
22 | #define PTRS_PER_PUD 1
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/pgtable_64_types.h:57: note: this is the location of the previous definition
57 | #define PTRS_PER_PUD 512
|
In file included from ./arch/x86/include/asm/pgtable_types.h:324,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/asm-generic/pgtable-nopud.h:23: warning: "PUD_SIZE" redefined
23 | #define PUD_SIZE (1UL << PUD_SHIFT)
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/pgtable_64_types.h:73: note: this is the location of the previous definition
73 | #define PUD_SIZE (_AC(1, UL) << PUD_SHIFT)
|
In file included from ./arch/x86/include/asm/pgtable_types.h:324,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/asm-generic/pgtable-nopud.h:24: warning: "PUD_MASK" redefined
24 | #define PUD_MASK (~(PUD_SIZE-1))
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/pgtable_64_types.h:74: note: this is the location of the previous definition
74 | #define PUD_MASK (~(PUD_SIZE - 1))
|
In file included from ./arch/x86/include/asm/pgtable_types.h:345,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/asm-generic/pgtable-nopmd.h:20: warning: "PMD_SHIFT" redefined
20 | #define PMD_SHIFT PUD_SHIFT
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/pgtable_64_types.h:63: note: this is the location of the previous definition
63 | #define PMD_SHIFT 21
|
In file included from ./arch/x86/include/asm/pgtable_types.h:345,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/asm-generic/pgtable-nopmd.h:21: warning: "PTRS_PER_PMD" redefined
21 | #define PTRS_PER_PMD 1
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/pgtable_64_types.h:64: note: this is the location of the previous definition
64 | #define PTRS_PER_PMD 512
|
In file included from ./arch/x86/include/asm/pgtable_types.h:345,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/asm-generic/pgtable-nopmd.h:22: warning: "PMD_SIZE" redefined
22 | #define PMD_SIZE (1UL << PMD_SHIFT)
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/pgtable_64_types.h:71: note: this is the location of the previous definition
71 | #define PMD_SIZE (_AC(1, UL) << PMD_SHIFT)
|
In file included from ./arch/x86/include/asm/pgtable_types.h:345,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/asm-generic/pgtable-nopmd.h:23: warning: "PMD_MASK" redefined
23 | #define PMD_MASK (~(PMD_SIZE-1))
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/pgtable_64_types.h:72: note: this is the location of the previous definition
72 | #define PMD_MASK (~(PMD_SIZE - 1))
|
In file included from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/processor.h:180: warning: "cache_line_size" redefined
180 | #define cache_line_size() (boot_cpu_data.x86_cache_alignment)
|
In file included from ./include/linux/printk.h:9,
from ./include/linux/kernel.h:14,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/linux/cache.h:79: note: this is the location of the previous definition
79 | #define cache_line_size() L1_CACHE_BYTES
|
In file included from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/processor.h: In function ‘load_cr3’:
./arch/x86/include/asm/processor.h:253:12: error: implicit declaration of function ‘__sme_pa’ [-Werror=implicit-function-declaration]
253 | write_cr3(__sme_pa(pgdir));
| ^~~~~~~~
In file included from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/linux/thread_info.h: At top level:
./include/linux/thread_info.h:96:19: error: redefinition of ‘arch_within_stack_frames’
96 | static inline int arch_within_stack_frames(const void * const stack,
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/thread_info.h:171:19: note: previous definition of ‘arch_within_stack_frames’ was here
171 | static inline int arch_within_stack_frames(const void * const stack,
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/elf.h:5,
from ./include/linux/module.h:15,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/elf.h: In function ‘elf_common_init’:
./arch/x86/include/asm/elf.h:180:3: error: ‘struct thread_struct’ has no member named ‘fsbase’
180 | t->fsbase = t->gsbase = 0;
| ^~
./arch/x86/include/asm/elf.h:180:15: error: ‘struct thread_struct’ has no member named ‘gsbase’
180 | t->fsbase = t->gsbase = 0;
| ^~
In file included from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/elf.h: In function ‘mmap_is_ia32’:
./include/linux/thread_info.h:91:22: error: implicit declaration of function ‘current_thread_info’ [-Werror=implicit-function-declaration]
91 | test_ti_thread_flag(current_thread_info(), flag)
| ^~~~~~~~~~~~~~~~~~~
./arch/x86/include/asm/elf.h:306:3: note: in expansion of macro ‘test_thread_flag’
306 | test_thread_flag(TIF_ADDR32));
| ^~~~~~~~~~~~~~~~
./include/linux/thread_info.h:91:22: warning: passing argument 1 of ‘test_ti_thread_flag’ makes pointer from integer without a cast [-Wint-conversion]
91 | test_ti_thread_flag(current_thread_info(), flag)
| ^~~~~~~~~~~~~~~~~~~~~
| |
| int
./arch/x86/include/asm/elf.h:306:3: note: in expansion of macro ‘test_thread_flag’
306 | test_thread_flag(TIF_ADDR32));
| ^~~~~~~~~~~~~~~~
./include/linux/thread_info.h:77:59: note: expected ‘struct thread_info *’ but argument is of type ‘int’
77 | static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
| ~~~~~~~~~~~~~~~~~~~~^~
In file included from ./include/linux/cache.h:6,
from ./include/linux/printk.h:9,
from ./include/linux/kernel.h:14,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/elf.h: At top level:
./arch/x86/include/asm/cache.h:8:25: error: ‘CONFIG_X86_L1_CACHE_SHIFT’ undeclared here (not in a function); did you mean ‘CONFIG_ARM_L1_CACHE_SHIFT’?
8 | #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
./arch/x86/include/asm/cache.h:9:30: note: in expansion of macro ‘L1_CACHE_SHIFT’
9 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
| ^~~~~~~~~~~~~~
./include/linux/cache.h:13:25: note: in expansion of macro ‘L1_CACHE_BYTES’
13 | #define SMP_CACHE_BYTES L1_CACHE_BYTES
| ^~~~~~~~~~~~~~
./include/linux/cache.h:35:58: note: in expansion of macro ‘SMP_CACHE_BYTES’
35 | #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
| ^~~~~~~~~~~~~~~
./arch/x86/include/asm/elf.h:381:3: note: in expansion of macro ‘____cacheline_aligned’
381 | } ____cacheline_aligned;
| ^~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/module.h:24,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./arch/x86/include/asm/module.h:67:2: error: #error unknown processor family
67 | #error unknown processor family
| ^~~~~
In file included from ./include/linux/kernel.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/linux/sched.h: In function ‘need_resched’:
./include/linux/thread_info.h:91:22: warning: passing argument 1 of ‘test_ti_thread_flag’ makes pointer from integer without a cast [-Wint-conversion]
91 | test_ti_thread_flag(current_thread_info(), flag)
| ^~~~~~~~~~~~~~~~~~~~~
| |
| int
./include/linux/compiler.h:77:42: note: in definition of macro ‘unlikely’
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
./include/linux/thread_info.h:93:28: note: in expansion of macro ‘test_thread_flag’
93 | #define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED)
| ^~~~~~~~~~~~~~~~
./include/linux/sched.h:1613:18: note: in expansion of macro ‘tif_need_resched’
1613 | return unlikely(tif_need_resched());
| ^~~~~~~~~~~~~~~~
In file included from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:2:
./include/linux/thread_info.h:77:59: note: expected ‘struct thread_info *’ but argument is of type ‘int’
77 | static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
| ~~~~~~~~~~~~~~~~~~~~^~
In file included from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:7:
./include/linux/gpio.h: At top level:
./include/linux/gpio.h:49:10: fatal error: asm/gpio.h: No such file or directory
49 | #include <asm/gpio.h>
| ^~~~~~~~~~~~
cc1: some warnings being treated as errors
compilation terminated.
make[2]: *** [scripts/Makefile.build:323: /home/jonsen/f1c100s/test_chrdevbase/chardevbase.o] Error 1
make[1]: *** [Makefile:1508: _module_/home/jonsen/f1c100s/test_chrdevbase] Error 2
make[1]: Leaving directory '/home/jonsen/f1c100s/linux'
make: *** [Makefile:9: all] Error 2
可以的,亲自试过。
改后有变化,错误信息还是有,大佬再看下
jonsen@ubuntu:~/f1c100s/test_chrdevbase$ make
make -C /home/jonsen/f1c100s/linux M=/home/jonsen/f1c100s/test_chrdevbase modules
make[1]: Entering directory '/home/jonsen/f1c100s/linux'
CC [M] /home/jonsen/f1c100s/test_chrdevbase/chardevbase.o
In file included from ./arch/x86/include/asm/barrier.h:5,
from ./include/linux/compiler.h:242,
from ./include/linux/kernel.h:10,
from ./include/linux/list.h:9,
from ./include/linux/module.h:9,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/arch_hweight.h: In function ‘__arch_hweight64’:
./arch/x86/include/asm/arch_hweight.h:55:42: error: expected ‘:’ or ‘)’ before ‘POPCNT64’
55 | asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
| ^~~~~~~~
./arch/x86/include/asm/alternative.h:133:28: note: in definition of macro ‘ALTINSTR_REPLACEMENT’
133 | b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n\t"
| ^~~~~~~~
./arch/x86/include/asm/arch_hweight.h:55:7: note: in expansion of macro ‘ALTERNATIVE’
55 | asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)
| ^~~~~~~~~~~
In file included from ./arch/x86/include/asm/atomic.h:276,
from ./include/linux/atomic.h:5,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h: At top level:
./arch/x86/include/asm/atomic64_64.h:20:40: error: unknown type name ‘atomic64_t’
20 | static inline long atomic64_read(const atomic64_t *v)
| ^~~~~~~~~~
In file included from ./include/linux/kernel.h:10,
from ./include/linux/list.h:9,
from ./include/linux/module.h:9,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h: In function ‘atomic64_read’:
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
22 | return READ_ONCE((v)->counter);
| ^~
./include/linux/compiler.h:246:17: note: in definition of macro ‘__READ_ONCE’
246 | union { typeof(x) __val; char __c[1]; } __u; \
| ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
22 | return READ_ONCE((v)->counter);
| ^~~~~~~~~
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
22 | return READ_ONCE((v)->counter);
| ^~
./include/linux/compiler.h:248:22: note: in definition of macro ‘__READ_ONCE’
248 | __read_once_size(&(x), __u.__c, sizeof(x)); \
| ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
22 | return READ_ONCE((v)->counter);
| ^~~~~~~~~
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
22 | return READ_ONCE((v)->counter);
| ^~
./include/linux/compiler.h:248:42: note: in definition of macro ‘__READ_ONCE’
248 | __read_once_size(&(x), __u.__c, sizeof(x)); \
| ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
22 | return READ_ONCE((v)->counter);
| ^~~~~~~~~
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
22 | return READ_ONCE((v)->counter);
| ^~
./include/linux/compiler.h:250:30: note: in definition of macro ‘__READ_ONCE’
250 | __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
| ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
22 | return READ_ONCE((v)->counter);
| ^~~~~~~~~
./arch/x86/include/asm/atomic64_64.h:22:22: error: request for member ‘counter’ in something not a structure or union
22 | return READ_ONCE((v)->counter);
| ^~
./include/linux/compiler.h:250:50: note: in definition of macro ‘__READ_ONCE’
250 | __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
| ^
./arch/x86/include/asm/atomic64_64.h:22:9: note: in expansion of macro ‘READ_ONCE’
22 | return READ_ONCE((v)->counter);
| ^~~~~~~~~
In file included from ./arch/x86/include/asm/atomic.h:276,
from ./include/linux/atomic.h:5,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h: At top level:
./arch/x86/include/asm/atomic64_64.h:32:33: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
32 | static inline void atomic64_set(atomic64_t *v, long i)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:44:50: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
44 | static __always_inline void atomic64_add(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:58:41: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
58 | static inline void atomic64_sub(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:74:50: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
74 | static inline bool atomic64_sub_and_test(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:85:42: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
85 | static __always_inline void atomic64_inc(atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:98:42: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
98 | static __always_inline void atomic64_dec(atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:113:42: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
113 | static inline bool atomic64_dec_and_test(atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:126:42: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
126 | static inline bool atomic64_inc_and_test(atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:140:50: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
140 | static inline bool atomic64_add_negative(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:152:57: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
152 | static __always_inline long atomic64_add_return(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:157:48: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
157 | static inline long atomic64_sub_return(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:162:47: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
162 | static inline long atomic64_fetch_add(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:167:47: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
167 | static inline long atomic64_fetch_sub(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:175:37: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
175 | static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:181:50: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
181 | static __always_inline bool atomic64_try_cmpxchg(atomic64_t *v, s64 *old, long new)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:186:34: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
186 | static inline long atomic64_xchg(atomic64_t *v, long new)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:200:40: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
200 | static inline bool atomic64_add_unless(atomic64_t *v, long a, long u)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:219:45: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
219 | static inline long atomic64_dec_if_positive(atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:230:41: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
230 | static inline void atomic64_and(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:238:47: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
238 | static inline long atomic64_fetch_and(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:247:40: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
247 | static inline void atomic64_or(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:255:46: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
255 | static inline long atomic64_fetch_or(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:264:41: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
264 | static inline void atomic64_xor(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
./arch/x86/include/asm/atomic64_64.h:272:47: error: unknown type name ‘atomic64_t’; did you mean ‘atomic_t’?
272 | static inline long atomic64_fetch_xor(long i, atomic64_t *v)
| ^~~~~~~~~~
| atomic_t
In file included from ./include/linux/atomic.h:660,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/atomic64.h:21:18: error: conflicting types for ‘atomic64_read’
21 | extern long long atomic64_read(const atomic64_t *v);
| ^~~~~~~~~~~~~
In file included from ./arch/x86/include/asm/atomic.h:276,
from ./include/linux/atomic.h:5,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h:20:20: note: previous definition of ‘atomic64_read’ was here
20 | static inline long atomic64_read(const atomic64_t *v)
| ^~~~~~~~~~~~~
In file included from ./include/linux/atomic.h:660,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/atomic64.h:59: warning: "atomic64_inc_return" redefined
59 | #define atomic64_inc_return(v) atomic64_add_return(1LL, (v))
|
In file included from ./arch/x86/include/asm/atomic.h:276,
from ./include/linux/atomic.h:5,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h:172: note: this is the location of the previous definition
172 | #define atomic64_inc_return(v) (atomic64_add_return(1, (v)))
|
In file included from ./include/linux/atomic.h:660,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/atomic64.h:63: warning: "atomic64_dec_return" redefined
63 | #define atomic64_dec_return(v) atomic64_sub_return(1LL, (v))
|
In file included from ./arch/x86/include/asm/atomic.h:276,
from ./include/linux/atomic.h:5,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h:173: note: this is the location of the previous definition
173 | #define atomic64_dec_return(v) (atomic64_sub_return(1, (v)))
|
In file included from ./include/linux/atomic.h:660,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/atomic64.h:65: warning: "atomic64_inc_not_zero" redefined
65 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL)
|
In file included from ./arch/x86/include/asm/atomic.h:276,
from ./include/linux/atomic.h:5,
from ./include/linux/jump_label.h:186,
from ./arch/x86/include/asm/string_64.h:6,
from ./arch/x86/include/asm/string.h:5,
from ./include/linux/string.h:19,
from ./arch/x86/include/asm/page_32.h:35,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/atomic64_64.h:210: note: this is the location of the previous definition
210 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
|
In file included from ./arch/x86/include/asm/pgtable_types.h:324,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopud.h:21: warning: "PUD_SHIFT" redefined
21 | #define PUD_SHIFT P4D_SHIFT
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:56: note: this is the location of the previous definition
56 | #define PUD_SHIFT 30
|
In file included from ./arch/x86/include/asm/pgtable_types.h:324,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopud.h:22: warning: "PTRS_PER_PUD" redefined
22 | #define PTRS_PER_PUD 1
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:57: note: this is the location of the previous definition
57 | #define PTRS_PER_PUD 512
|
In file included from ./arch/x86/include/asm/pgtable_types.h:324,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopud.h:23: warning: "PUD_SIZE" redefined
23 | #define PUD_SIZE (1UL << PUD_SHIFT)
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:73: note: this is the location of the previous definition
73 | #define PUD_SIZE (_AC(1, UL) << PUD_SHIFT)
|
In file included from ./arch/x86/include/asm/pgtable_types.h:324,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopud.h:24: warning: "PUD_MASK" redefined
24 | #define PUD_MASK (~(PUD_SIZE-1))
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:74: note: this is the location of the previous definition
74 | #define PUD_MASK (~(PUD_SIZE - 1))
|
In file included from ./arch/x86/include/asm/pgtable_types.h:345,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopmd.h:20: warning: "PMD_SHIFT" redefined
20 | #define PMD_SHIFT PUD_SHIFT
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:63: note: this is the location of the previous definition
63 | #define PMD_SHIFT 21
|
In file included from ./arch/x86/include/asm/pgtable_types.h:345,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopmd.h:21: warning: "PTRS_PER_PMD" redefined
21 | #define PTRS_PER_PMD 1
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:64: note: this is the location of the previous definition
64 | #define PTRS_PER_PMD 512
|
In file included from ./arch/x86/include/asm/pgtable_types.h:345,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopmd.h:22: warning: "PMD_SIZE" redefined
22 | #define PMD_SIZE (1UL << PMD_SHIFT)
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:71: note: this is the location of the previous definition
71 | #define PMD_SIZE (_AC(1, UL) << PMD_SHIFT)
|
In file included from ./arch/x86/include/asm/pgtable_types.h:345,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/asm-generic/pgtable-nopmd.h:23: warning: "PMD_MASK" redefined
23 | #define PMD_MASK (~(PMD_SIZE-1))
|
In file included from ./arch/x86/include/asm/pgtable_types.h:250,
from ./arch/x86/include/asm/processor.h:19,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/pgtable_64_types.h:72: note: this is the location of the previous definition
72 | #define PMD_MASK (~(PMD_SIZE - 1))
|
In file included from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/processor.h:180: warning: "cache_line_size" redefined
180 | #define cache_line_size() (boot_cpu_data.x86_cache_alignment)
|
In file included from ./include/linux/printk.h:9,
from ./include/linux/kernel.h:14,
from ./include/linux/list.h:9,
from ./include/linux/module.h:9,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/linux/cache.h:79: note: this is the location of the previous definition
79 | #define cache_line_size() L1_CACHE_BYTES
|
In file included from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/processor.h: In function ‘load_cr3’:
./arch/x86/include/asm/processor.h:253:12: error: implicit declaration of function ‘__sme_pa’ [-Werror=implicit-function-declaration]
253 | write_cr3(__sme_pa(pgdir));
| ^~~~~~~~
In file included from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/linux/thread_info.h: At top level:
./include/linux/thread_info.h:96:19: error: redefinition of ‘arch_within_stack_frames’
96 | static inline int arch_within_stack_frames(const void * const stack,
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/thread_info.h:171:19: note: previous definition of ‘arch_within_stack_frames’ was here
171 | static inline int arch_within_stack_frames(const void * const stack,
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/elf.h:5,
from ./include/linux/module.h:15,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/elf.h: In function ‘elf_common_init’:
./arch/x86/include/asm/elf.h:180:3: error: ‘struct thread_struct’ has no member named ‘fsbase’
180 | t->fsbase = t->gsbase = 0;
| ^~
./arch/x86/include/asm/elf.h:180:15: error: ‘struct thread_struct’ has no member named ‘gsbase’
180 | t->fsbase = t->gsbase = 0;
| ^~
In file included from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/seqlock.h:36,
from ./include/linux/time.h:6,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:10,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/elf.h: In function ‘mmap_is_ia32’:
./include/linux/thread_info.h:91:22: error: implicit declaration of function ‘current_thread_info’ [-Werror=implicit-function-declaration]
91 | test_ti_thread_flag(current_thread_info(), flag)
| ^~~~~~~~~~~~~~~~~~~
./arch/x86/include/asm/elf.h:306:3: note: in expansion of macro ‘test_thread_flag’
306 | test_thread_flag(TIF_ADDR32));
| ^~~~~~~~~~~~~~~~
./include/linux/thread_info.h:91:22: warning: passing argument 1 of ‘test_ti_thread_flag’ makes pointer from integer without a cast [-Wint-conversion]
91 | test_ti_thread_flag(current_thread_info(), flag)
| ^~~~~~~~~~~~~~~~~~~~~
| |
| int
./arch/x86/include/asm/elf.h:306:3: note: in expansion of macro ‘test_thread_flag’
306 | test_thread_flag(TIF_ADDR32));
| ^~~~~~~~~~~~~~~~
./include/linux/thread_info.h:77:59: note: expected ‘struct thread_info *’ but argument is of type ‘int’
77 | static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
| ~~~~~~~~~~~~~~~~~~~~^~
In file included from ./include/linux/cache.h:6,
from ./include/linux/printk.h:9,
from ./include/linux/kernel.h:14,
from ./include/linux/list.h:9,
from ./include/linux/module.h:9,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/elf.h: At top level:
./arch/x86/include/asm/cache.h:8:25: error: ‘CONFIG_X86_L1_CACHE_SHIFT’ undeclared here (not in a function); did you mean ‘CONFIG_ARM_L1_CACHE_SHIFT’?
8 | #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
./arch/x86/include/asm/cache.h:9:30: note: in expansion of macro ‘L1_CACHE_SHIFT’
9 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
| ^~~~~~~~~~~~~~
./include/linux/cache.h:13:25: note: in expansion of macro ‘L1_CACHE_BYTES’
13 | #define SMP_CACHE_BYTES L1_CACHE_BYTES
| ^~~~~~~~~~~~~~
./include/linux/cache.h:35:58: note: in expansion of macro ‘SMP_CACHE_BYTES’
35 | #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
| ^~~~~~~~~~~~~~~
./arch/x86/include/asm/elf.h:381:3: note: in expansion of macro ‘____cacheline_aligned’
381 | } ____cacheline_aligned;
| ^~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/module.h:24,
from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./arch/x86/include/asm/module.h:67:2: error: #error unknown processor family
67 | #error unknown processor family
| ^~~~~
In file included from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/linux/module.h:131:6: warning: ‘init_module’ specifies less restrictive attribute than its target ‘chardevbase_init’: ‘cold’ [-Wmissing-attributes]
131 | int init_module(void) __attribute__((alias(#initfn)));
| ^~~~~~~~~~~
/home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:15:1: note: in expansion of macro ‘module_init’
15 | module_init(chardevbase_init);
| ^~~~~~~~~~~
/home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:3:19: note: ‘init_module’ target declared here
3 | static int __init chardevbase_init(void)
| ^~~~~~~~~~~~~~~~
In file included from /home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:1:
./include/linux/module.h:137:7: warning: ‘cleanup_module’ specifies less restrictive attribute than its target ‘chardevbase_exit’: ‘cold’ [-Wmissing-attributes]
137 | void cleanup_module(void) __attribute__((alias(#exitfn)));
| ^~~~~~~~~~~~~~
/home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:17:1: note: in expansion of macro ‘module_exit’
17 | module_exit(chardevbase_exit);
| ^~~~~~~~~~~
/home/jonsen/f1c100s/test_chrdevbase/chardevbase.c:9:20: note: ‘cleanup_module’ target declared here
9 | static void __exit chardevbase_exit(void)
| ^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:323: /home/jonsen/f1c100s/test_chrdevbase/chardevbase.o] Error 1
make[1]: *** [Makefile:1508: _module_/home/jonsen/f1c100s/test_chrdevbase] Error 2
make[1]: Leaving directory '/home/jonsen/f1c100s/linux'
make: *** [Makefile:8: kernel_modules] Error 2
把$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) kernel_modules
改成$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules
试试
按照正点原子的驱动教程 在vscode下写了如下代码
#include <linux/module.h>
static int __init chardevbase_init(void)
{
return 0;
}
static void __exit chardevbase_exit(void)
{
;
}
module_init(chardevbase_init);
module_exit(chardevbase_exit);
在Makefile里写了
KERNELDIR := /home/jonsen/f1c100s/linux
CURRENT_PATH := $(shell pwd)
obj-m := chrdevbase.o
build:kernel_modules
kernel_modules:
$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) kernel_modules
Clean:
$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) chean
c_cpp_properties.json修改了如下
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/home/jonsen/f1c100s/linux/include",
"/home/jonsen/f1c100s/linux/arch/arm/include/",
"/home/jonsen/f1c100s/linux/arch/arm/include/generated/"
],
"defines": [],
//"compilerPath": "/usr/bin/gcc",
"compilerPath":"/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
make 后
出现 :
jonsen@ubuntu:~/f1c100s/test_chrdevbase$ make
make -C /home/jonsen/f1c100s/linux M=/home/jonsen/f1c100s/test_chrdevbase kernel_modules
make[1]: Entering directory '/home/jonsen/f1c100s/linux'
make[1]: *** No rule to make target 'kernel_modules'. Stop.
make[1]: Leaving directory '/home/jonsen/f1c100s/linux'
make: *** [Makefile:8: kernel_modules] Error 2
不知怎么处理了,大佬们 帮忙指指路。。。
晕哥
这楼代码一样 在MAKE 时 出现这个错误
jonsen@ubuntu:~/f1c100s/Linux_Drivers/chrdevbase$ make
make -C /home/jonsen/f1c100s/linux M=/home/jonsen/f1c100s/Linux_Drivers/chrdevbase modules
make[1]: Entering directory '/home/jonsen/f1c100s/linux'
make[2]: *** No rule to make target '/home/jonsen/f1c100s/Linux_Drivers/chrdevbase/hello.c', needed by '/home/jonsen/f1c100s/Linux_Drivers/chrdevbase/hello.o'. Stop.
make[1]: *** [Makefile:1508: _module_/home/jonsen/f1c100s/Linux_Drivers/chrdevbase] Error 2
make[1]: Leaving directory '/home/jonsen/f1c100s/linux'
make: *** [Makefile:20: default] Error 2
我想交叉编译一个可以在v3s开发板上运行hello.ko内核模块,下面分别是我的.C文件和Makefile文件
#include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> static int hello_init(void) { printk(KERN_INFO "Hello world enter\n"); return 0; } static void hello_exit(void) { printk(KERN_INFO "Hello world exit\n"); } module_init(hello_init); module_exit(hello_exit); MODULE_LICENSE("Dual BSD/GPL"); MODULE_DESCRIPTION("A simple hello worild Module"); MODULE_ALIAS("a simplest module");
KERNELDIR:=/home/zhang/linux obj-m += hello.o default: $(MAKE) -C $(KERNELDIR) M=$(shell pwd) modules clean: $(MAKE) -C $(KERNELDIR) M=$(shell pwd) modules clean
我用的编译命令是make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
我进行编译是出现的大量的warning和error,能帮忙看下代码,是不是Makefile写得有问题?
你好 LinJie :
哈 ,搞定了;首先感谢下楼主的指引,谢谢!
具体情况和1楼帖子里描写的有点出入。分享在这里。给后来人引导一下。
1、通过buildroot 里 make menuconfig 搜索 lrzsz ,确定好目录。把lrzsz 改成Y
2、复制rootfs.tar文件到打包目录,并且打包,bin文件烧录
3、启动会出现 mount: you must be root. can't open /dev/console: Permission denied这种错误。
4、参考这里 https://www.cnblogs.com/Rainingday/p/12483773.html
修改文件权限,sudo chown root * -R
5、重新打包烧录
6、登录后 SecureCRT 工具里 输入 rz PC发送文件到板子,sz板子发送文件到pc
参考这里 https://jingyan.baidu.com/article/91f5db1b7775401c7e05e37b.html
你好 Linjie:
尝试了好几次,make 后 在bin里没看到 lrzsz出来
很奇怪,晚上麻烦看下你那有么有?
LinuxGo 说:你好 linjie
buildroot 里配置了
Search Results ─
│ Symbol: BR2_PACKAGE_LRZSZ [=y] 这里
│ Type : boolean
│ Prompt: lrzsz
│ Location:
│ -> Target packages
│ (1) -> Networking applications
│ Defined at package/lrzsz/Config.in:1
│ Depends on: !BR2_STATIC_LIBS [=n]
编译后 在 output/images/rootfs.tar /bin 里没有找到 lrz命令,,,,
# cd ../
# ls
bin hello lib32 media proc sbin usr
dev hellonano linuxrc mnt root sys var
etc lib main.c opt run tmp
# cd bin
# ls
ash dumpkmap linux64 nice sh
busybox echo ln pidof sleep
cat egrep login ping stty
chattr false ls pipe_progress su
chgrp fdflush lsattr printenv sync
chmod fgrep mkdir ps tar
chown getopt mknod pwd touch
cp grep mktemp rm true
cpio gunzip more rmdir umount
date gzip mount run-parts uname
dd hostname mountpoint sed usleep
df kill mt setarch vi
dmesg link mv setpriv watch
dnsdomainname linux32 netstat setserial zcat
# lrz
/bin/sh: lrz: not found
#LinjieGuo 说:是的,先运行绿色.bat,输入Y,破解,然后退出,找到SecureCRT.exe执行程序,连接串口就ok了。
在buildroot里勾选,是可以的喔,我测试过。我电脑在家里,我得晚上回去看看,现在不方便搞f1c100s,你看看是不是勾选错了,或者直接下载我配置好的虚拟机,
你好 linjie
buildroot 里配置了
Search Results ─
│ Symbol: BR2_PACKAGE_LRZSZ [=y] 这里
│ Type : boolean
│ Prompt: lrzsz
│ Location:
│ -> Target packages
│ (1) -> Networking applications
│ Defined at package/lrzsz/Config.in:1
│ Depends on: !BR2_STATIC_LIBS [=n]
编译后 在 output/images/rootfs.tar /bin 里没有找到 lrz命令,,,,
# cd ../
# ls
bin hello lib32 media proc sbin usr
dev hellonano linuxrc mnt root sys var
etc lib main.c opt run tmp
# cd bin
# ls
ash dumpkmap linux64 nice sh
busybox echo ln pidof sleep
cat egrep login ping stty
chattr false ls pipe_progress su
chgrp fdflush lsattr printenv sync
chmod fgrep mkdir ps tar
chown getopt mknod pwd touch
cp grep mktemp rm true
cpio gunzip more rmdir umount
date gzip mount run-parts uname
dd hostname mountpoint sed usleep
df kill mt setarch vi
dmesg link mv setpriv watch
dnsdomainname linux32 netstat setserial zcat
# lrz
/bin/sh: lrz: not found
#
LinuxGo 说:你好 linjie
那我重新编译 打包 烧录到芯片后
pc下载 SecureCRT.zip 这个工具就能跑了啊
不用自己装了LinjieGuo 说:感谢万能的坑友,我搜索了一下,buildroot中确实有这个功能,可以通过搜索lrzsz,找到了它位于这个目录中:
Target packages --->
Networking applications --->
[v] lrzsz
勾选之后,编译,根文件系统中就有这个工具了。是的,先运行绿色.bat,输入Y,破解,然后退出,找到SecureCRT.exe执行程序,连接串口就ok了。
我还没法下载,去别的地方下了
LinuxGo 说:你好 linjie
那我重新编译 打包 烧录到芯片后
pc下载 SecureCRT.zip 这个工具就能跑了啊
不用自己装了LinjieGuo 说:感谢万能的坑友,我搜索了一下,buildroot中确实有这个功能,可以通过搜索lrzsz,找到了它位于这个目录中:
Target packages --->
Networking applications --->
[v] lrzsz
勾选之后,编译,根文件系统中就有这个工具了。是的,先运行绿色.bat,输入Y,破解,然后退出,找到SecureCRT.exe执行程序,连接串口就ok了。
你好 linjie
问题依旧,,,,
jonsen@ubuntu:~/f1c100s/lrzsz/lrzsz-0.12.20$ sudo make CC=/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc
make all-recursive
make[1]: Entering directory '/home/jonsen/f1c100s/lrzsz/lrzsz-0.12.20'
Making all in lib
make[2]: Entering directory '/home/jonsen/f1c100s/lrzsz/lrzsz-0.12.20/lib'
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -c long-options.c
long-options.c: In function ‘parse_long_options’:
long-options.c:65:4: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
exit (0);
^~~~
long-options.c:65:4: warning: incompatible implicit declaration of built-in function ‘exit’
long-options.c:65:4: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -c xstrtol.c
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -c xstrtoul.c
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -c error.c
rm -f libzmodem.a
ar cru libzmodem.a long-options.o xstrtol.o xstrtoul.o error.o
ar: `u' modifier ignored since `D' is the default (see `U')
ranlib libzmodem.a
make[2]: Leaving directory '/home/jonsen/f1c100s/lrzsz/lrzsz-0.12.20/lib'
Making all in intl
make[2]: Entering directory '/home/jonsen/f1c100s/lrzsz/lrzsz-0.12.20/intl'
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -c -DLOCALEDIR=\"/usr/local/share/locale\" -DGNULOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale:.\" -DHAVE_CONFIG_H -I.. -I. -I../intl -I../lib -g -O2 intl-compat.c
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -c -DLOCALEDIR=\"/usr/local/share/locale\" -DGNULOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale:.\" -DHAVE_CONFIG_H -I.. -I. -I../intl -I../lib -g -O2 bindtextdom.c
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -c -DLOCALEDIR=\"/usr/local/share/locale\" -DGNULOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale:.\" -DHAVE_CONFIG_H -I.. -I. -I../intl -I../lib -g -O2 dcgettext.c
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -c -DLOCALEDIR=\"/usr/local/share/locale\" -DGNULOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale:.\" -DHAVE_CONFIG_H -I.. -I. -I../intl -I../lib -g -O2 dgettext.c
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -c -DLOCALEDIR=\"/usr/local/share/locale\" -DGNULOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale:.\" -DHAVE_CONFIG_H -I.. -I. -I../intl -I../lib -g -O2 gettext.c
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -c -DLOCALEDIR=\"/usr/local/share/locale\" -DGNULOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale:.\" -DHAVE_CONFIG_H -I.. -I. -I../intl -I../lib -g -O2 finddomain.c
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -c -DLOCALEDIR=\"/usr/local/share/locale\" -DGNULOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale:.\" -DHAVE_CONFIG_H -I.. -I. -I../intl -I../lib -g -O2 loadmsgcat.c
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -c -DLOCALEDIR=\"/usr/local/share/locale\" -DGNULOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale:.\" -DHAVE_CONFIG_H -I.. -I. -I../intl -I../lib -g -O2 localealias.c
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -c -DLOCALEDIR=\"/usr/local/share/locale\" -DGNULOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale:.\" -DHAVE_CONFIG_H -I.. -I. -I../intl -I../lib -g -O2 textdomain.c
/home/jonsen/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc -c -DLOCALEDIR=\"/usr/local/share/locale\" -DGNULOCALEDIR=\"/usr/local/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/local/share/locale:.\" -DHAVE_CONFIG_H -I.. -I. -I../intl -I../lib -g -O2 l10nflist.c
l10nflist.c:42:19: fatal error: argz.h: No such file or directory
# include <argz.h>
^
compilation terminated.
make[2]: *** [Makefile:78: l10nflist.o] Error 1
make[2]: Leaving directory '/home/jonsen/f1c100s/lrzsz/lrzsz-0.12.20/intl'
make[1]: *** [Makefile:172: all-recursive] Error 1
make[1]: Leaving directory '/home/jonsen/f1c100s/lrzsz/lrzsz-0.12.20'
make: *** [Makefile:282: all-recursive-am] Error 2
LinuxGo 说:你好 linjie
我在编译 的时候出现
l10nflist.c:42:19: fatal error: argz.h: No such file or directory
# include <argz.h>
^
compilation terminated.
make[2]: *** [Makefile:78: l10nflist.o] Error 1
make[2]: Leaving directory '/home/jonsen/f1c100s/lrzsz/lrzsz-0.12.20/intl'
make[1]: *** [Makefile:172: all-recursive] Error 1
make[1]: Leaving directory '/home/jonsen/f1c100s/lrzsz/lrzsz-0.12.20'
make: *** [Makefile:282: all-recursive-am] Error 2不知如何处理?
直接进buildroot里,make menuconfig,然后找到lrzsz这个支持包,勾选上,然后编译。就有了,这种编译的过程学习一下就ok了。
你好 linjie
我在编译 的时候出现
l10nflist.c:42:19: fatal error: argz.h: No such file or directory
# include <argz.h>
^
compilation terminated.
make[2]: *** [Makefile:78: l10nflist.o] Error 1
make[2]: Leaving directory '/home/jonsen/f1c100s/lrzsz/lrzsz-0.12.20/intl'
make[1]: *** [Makefile:172: all-recursive] Error 1
make[1]: Leaving directory '/home/jonsen/f1c100s/lrzsz/lrzsz-0.12.20'
make: *** [Makefile:282: all-recursive-am] Error 2
不知如何处理?
尝试从一开发F1C100s应用
既然尝试从零构建F1C100s开发环境成功,我们便开始开发这个神奇的芯片吧。
在这之前,我们写了一个hello程序,我们是怎么装进文件系统里的呢?拷贝到根文件系统,与uboot,内核打包在一起,然后烧写。显然,这样子影响flash寿命不说,肯定大大的减少了我们的开发效率。所以我们不得不采取一种高效的措施,将文件传输到我们的目标板中。
废话不多说,随意概括一下,本贴将包含了以下内容:
1、终端传文件给linux注意,本贴禁止回复"mark"!
注意,本贴禁止回复"mark"!
注意,本贴禁止回复"mark"!
----------------------------------------
1、使用终端传文件给linux
目标板与外界传文件的方法非多,但是其他方法(NFS启动、wifi传输等),对于我们现在从零构建的工程基础,显然,非常不现实。经过多方面的考虑,最终,选择使用已经能够成功控制单板的串口终端来传输文件。
网上有一个工具,lrzsz,我们可以获取其源码,编译到目标板中。
(1)获取资源
①lrzsz源码:https://whycan.cn/files/members/1845/lrzsz-0_12_20_tar.gz
②终端工具:https://whycan.cn/files/members/1845/SecureCRT.zip
(2)编译这个lrzsz
①新建一个目录存放这个包
mkdir /home/book/f1c100s/lrzsz
②自己想办法将下载到的lrzsz-0_12_20_tar.gz上传到/home/book/f1c100s/lrzsz目录下。
③进入该目录并解压lrzsz包cd /home/book/f1c100s/lrzsz tar -xzvf lrzsz-0_12_20_tar.gz
④进入解压出来的目录
cd lrzsz-0.12.20/
⑤输入一下命令生成配置文件
./configure --cache=arm-linux
⑥明确自己交叉编译工具链的位置
我们使用buildroot输出的交叉编译工具链,与根文件系统一致。我的编译器的目录位于这个路径:
/home/book/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc
⑦使用这个交叉编译工具链,编译它make CC=/home/book/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-gcc
编译出来,生成了两个文件,复制这两个文件到我们的根文件系统bin目录下
sudo cp ./src/lsz /home/book/f1c100s/rootfs/bin/
sudo cp ./src/lrz /home/book/f1c100s/rootfs/bin/
⑧看看我们有没有缺少什么运行库
==>检查第1个文件/home/book/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-readelf -d ./src/lsz
可以看到,这个程序依赖于这样的运行库
标记 类型 名称/值
0x00000001 (NEEDED) 共享库:[libc.so.0]
==>检查第2个文件/home/book/f1c100s/buildroot-2017.08/output/host/bin/arm-linux-readelf -d ./src/lrz
发现依赖库跟第一个一样。
⑨复制依赖库,到根文件系统的lib目录下。
那么问题来了,依赖库放在哪里呢?我们在交叉编译工具链哪里搜索一下:cd /home/book/f1c100s/buildroot-2017.08/output/host/ find -name "libc.so.0"
结果如下:
./arm-buildroot-linux-uclibcgnueabi/sysroot/lib/libc.so.0复制这个库文件到根文件目录lib中,
sudo cp /home/book/f1c100s/buildroot-2017.08/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/lib/libc.so.0 /home/book/f1c100s/rootfs/lib/
⑩打包并烧写镜像。
sudo sh /home/book/f1c100s/BuildMyImage.sh
(3)使用这个工具
使用串口CRT工具连接终端,输入命令"lrz",回车,CRT会弹出一个框框,我们可以发送一个文件到目标板
上个图就好了,自己折腾吧。速度有点慢,聊胜于无。(/笑)
https://whycan.cn/files/members/1845/none_20200501-1622.png
你好 linjie
首先向楼主道个喜,哈!看了楼主的帖子 我终于进了系统。 谢谢!
其次:向后来人 指下路,,,板子上装 xt25f128 的flash 在这里要改成
原来 :
6.3 修改内核配置
(1)make ARCH=arm menuconfig
(2)勾选 File systems ‣ Miscellaneous filesystems ‣ Journalling Flash File System v2 (JFFS2) support
(3)修改源码下的 ./drivers/mtd/spi-nor.c
vi ./drivers/mtd/spi-nor/spi-nor.c
注释掉以下一行:
//{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
在这一行下面增加一项:
{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, 0) },
注意这里:{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, 0) }, 包括涉及到w25q128 的地方都改成 xt25f128
生成 红色文本
6 打包出烧写spi flash的bin文件
先将已经被解压过的文件,统统存放在一个文件夹里,防止干扰视线。
mkdir Pack
mv buildroot-2017.08.tar.gz Pack
mv f1c100s-480272lcd-test.zip Pack
mv gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi.tar.xz Pack
mv uboot.tar Pack
如果想保持官方路线,将当前根据官方操作流程而产生的文件打包,备用
tar -cf UKB.tar buildroot-2017.08 gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi linux-f1c100s-480272lcd-test u-boot
mv UKB.tar Pack
6.1 修改uboot以适配spi flashd
(1)修改源码
在uboot源码目录下 进入 ./include/configs/,修改 suniv.h
#define CONFIG_BOOTCOMMAND "sf probe 0:50000000; " \
"sf read 0x80C00000 0x100000 0x4000; " \
"sf read 0x80008000 0x110000 0x400000; " \
"bootz 0x80008000 - 0x80C00000"
(2)更改配置
回到 uboot 源码一级目录, 进入TUI配置
make ARCH=arm menuconfig
取消勾选 [] Enable a default value for bootcmd
勾选 [v] Enable boot arguments;
在下方一项中填入 bootargs 参数:
console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2
(3)回到根目录重新编译
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
6.2 修改dts以适配spi flash
(1)修改源码
修改内核源码目录下的 ./arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts
将原来的&spi0{...}替换为:
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins_a>;
status = "okay";
spi-max-frequency = <50000000>;
flash: w25q128@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "winbond,w25q128", "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;partition@0 {
label = "u-boot";
reg = <0x000000 0x100000>;
read-only;
};partition@100000 {
label = "dtb";
reg = <0x100000 0x10000>;
read-only;
};partition@110000 {
label = "kernel";
reg = <0x110000 0x400000>;
read-only;
};partition@510000 {
label = "rootfs";
reg = <0x510000 0xAF0000>;
};
};
};
};
(2)重新编译设备树
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- dtbs -j46.3 修改内核配置
(1)make ARCH=arm menuconfig
(2)勾选 File systems ‣ Miscellaneous filesystems ‣ Journalling Flash File System v2 (JFFS2) support
(3)修改源码下的 ./drivers/mtd/spi-nor.c
vi ./drivers/mtd/spi-nor/spi-nor.c
注释掉以下一行:
//{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
在这一行下面增加一项:
{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, 0) },
(4)重新编译内核
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j46.4 打包生成用于少些spiflash的bin文件
(1)在f1c100s目录下,新建文件夹rootfs
mkdir rootfs
(2)复制rootfs.tar到rootfs文件夹中
cp buildroot-2017.08/output/images/rootfs.tar rootfs/
(3)解压rootfs目录下的rootfs.tar
cd rootfs
sudo tar -xvf rootfs.tar
(4)删除rootfs.tar
sudo rm rootfs.tar
(5)回到f1c100s目录,编写打包命令
cd ..
vim BuildMyImage.sh
填写如下内容:
#!/bin/sh
dd if=/dev/zero of=f1c100s_spiflash_16M.bin bs=1M count=16 &&\
dd if=u-boot/u-boot-sunxi-with-spl.bin of=f1c100s_spiflash_16M.bin bs=1K conv=notrunc &&\
dd if=linux-f1c100s-480272lcd-test/arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dtb of=f1c100s_spiflash_16M.bin bs=1K seek=1024 conv=notrunc &&\
dd if=linux-f1c100s-480272lcd-test/arch/arm/boot/zImage of=f1c100s_spiflash_16M.bin bs=1K seek=1088 conv=notrunc &&\
mkfs.jffs2 -s 0x100 -e 0x10000 --pad=0xAF0000 -d rootfs/ -o rootfs.jffs2 &&\
dd if=rootfs.jffs2 of=f1c100s_spiflash_16M.bin bs=1k seek=5184 conv=notrunc &&\
sync
(6)运行打包脚本
sudo sh BuildMyImage.sh
-----------------------------------------------
提示错误:
BuildMyImage.sh: 6: BuildMyImage.sh: mkfs.jffs2: not found
安装mtd-utils工具:
sudo apt-get install mtd-utils
安装过程中,有可能出现超时情况,多尝试几遍或者更换源试试。
-----------------------------------------------
继续运行打包脚本:
sudo sh BuildMyImage.sh
稍等片刻,打包便能完成。
打包完成后,在当前目录,生成一个名为f1c100s_spiflash_16M.bin的文件。
你好 linjie 按上面的检查了一遍 都一样 还是卡在那
看看14楼的内容,是否勾选上了。
http://whycan.com/t_3138.html#p26711
你好,linjie
目前我卡在这里,配置和你一样还是不行 ,,, 错误也一样。,,,
[ 1.372966] ALSA device list:
[ 1.375940] #0: Loopback 1
[ 1.379707] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 1.388454] cfg80211: failed to load regulatory.db
[ 1.394132] Waiting for root device /dev/mtdblock3...
[ 202.722558] random: crng init done
编译完毕,打包后烧写bin文件。非常遗憾,结果依旧!
https://whycan.cn/files/members/1845/log3.png
观察.config里的配置项
https://whycan.cn/files/members/1845/config%E4%B8%ADMTD%E9%80%89%E9%A1%B9.png
文件中,可以看出,MTD_BLOCK已经配置为y,但依然没能成功启动。
我怀疑也许是根文件系统配置的问题。夜深了,明日继续。
算了,还是再搞搞把,这么早休息实在没劲,继续折腾。
观察启动log,发现,卡住的地方,有一条记录: #0: Loopback 1
再次进入配置界面:make ARCH=arm menuconfig
Device Drivers --->Block devices --->
[v]Loopback device support,勾选,看到其他有的选项,也勾上吧,相信也无妨,贴图:
https://whycan.cn/files/members/1845/DeviceDrivers__Blockdevices.png
保存配置,继续编译。
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
打包后烧录验证。
你好 linjie 这里去掉了,我再尝试 https://blog.csdn.net/kencaber/article/details/107575210 这里提到的问题
再次编写,我的板子是 xt 的flash ,,,坑。。。 按上链接修改了 可以 引导内核了
帖子上面说了,这是个坑。
晕哥 说:@LinjieGuo 去掉冒号, 那个地方是荔枝派文档挖的大坑。
u-boot 的 bootcmd 里面 sf probe 0:500000
上面命令行的冒号。
你好 linjie
按步骤,到这里时下载进去后 启动 进不了系统,, 下面是信息,不知怎么办了
U-Boot SPL 2018.01-05679-g013ca457fd-dirty (Jan 13 2021 - 14:37:47)
DRAM: 32 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI
U-Boot 2018.01-05679-g013ca457fd-dirty (Jan 13 2021 - 14:37:47 +0800) Allwinner Technology
CPU: Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM: 32 MiB
MMC: SUNXI SD/MMC: 0
SF: unrecognized JEDEC id bytes: 0b, 40, 18
*** Warning - spi_flash_probe_bus_cs() failed, using default environment
Setting up a 800x480 lcd console (overscan 0x0)
In: serial@1c25000
Out: serial@1c25000
Err: serial@1c25000
Net: No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot: 0
SF: unrecognized JEDEC id bytes: 0b, 40, 18
Failed to initialize SPI flash at 0:0 (error -2)
No SPI flash selected. Please run `sf probe'
No SPI flash selected. Please run `sf probe'
=>
7 烧写验证
(1)参考文章:https://whycan.cn/t_444.html
编译、安装Windows版本sunxi-fel步骤 (32M spi flash补丁,支持W25Q256/MX25L256)
安装好驱动,烧写bin文件到单板上。
(2)观察串口输出:
https://whycan.cn/files/members/1845/log.png
明显是存在问题,但是不知道问题出在哪里,太晚了,只能先睡觉。
你好 请问这里 选择分支:点击Branch->f1c100s-480272 480272 这个版本和屏幕有关系吗? 分支里只有f1c100s-480272lcd-test 我的屏幕时800*480 也用这个分支吗?
4 编译linux内核
4.1 获取linux内核源码
(1)打开链接:https://github.com/Icenowy/linux.git
(2)选择分支:点击Branch->f1c100s-480272
(3)打包下载
(4)传到ubuntu中,解压
unzip f1c100s-480272lcd-test.zip
(5)下载别人配置好的配置文件
http://dl.sipeed.com/LICHEE/Nano/SDK/config
复制下载的文件到linux源码根目录,并改名字为".config"(6)体验可视化配置
make ARCH=arm menuconfig
(7)编译
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
-----------------------------------------------
出现错误:
scripts/extract-cert.c:21:10: fatal error: openssl/bio.h: 没有那个文件或目录
安装工具:
sudo apt-get install libssl-dev
-----------------------------------------------
继续编译:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
成功编译,生成的 zImage 在 arch ‣ arm ‣ boot 目录下
大佬 我到这步卡住了
记录了16+0 的读入
记录了16+0 的写出
16777216 bytes (17 MB, 16 MiB) copied, 0.0912342 s, 184 MB/s
记录了984+0 的读入
记录了984+0 的写出
1007616 bytes (1.0 MB, 984 KiB) copied, 0.0097831 s, 103 MB/s
记录了7+1 的读入
记录了7+1 的写出
7999 bytes (8.0 kB, 7.8 KiB) copied, 0.000651522 s, 12.3 MB/s
记录了3800+1 的读入
记录了3800+1 的写出
3891312 bytes (3.9 MB, 3.7 MiB) copied, 0.0505016 s, 77.1 MB/s
mkfs.jffs2: error!: rootfs/
error 2 (No such file or directory)
两个错误
不知怎么办了,。,
6 打包出烧写spi flash的bin文件
先将已经被解压过的文件,统统存放在一个文件夹里,防止干扰视线。
mkdir Pack
mv buildroot-2017.08.tar.gz Pack
mv f1c100s-480272lcd-test.zip Pack
mv gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi.tar.xz Pack
mv uboot.tar Pack
如果想保持官方路线,将当前根据官方操作流程而产生的文件打包,备用
tar -cf UKB.tar buildroot-2017.08 gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi linux-f1c100s-480272lcd-test u-boot
mv UKB.tar Pack
6.1 修改uboot以适配spi flashd
(1)修改源码
在uboot源码目录下 进入 ./include/configs/,修改 suniv.h
#define CONFIG_BOOTCOMMAND "sf probe 0:50000000; " \
"sf read 0x80C00000 0x100000 0x4000; " \
"sf read 0x80008000 0x110000 0x400000; " \
"bootz 0x80008000 - 0x80C00000"
(2)更改配置
回到 uboot 源码一级目录, 进入TUI配置
make ARCH=arm menuconfig
取消勾选 [] Enable a default value for bootcmd
勾选 [v] Enable boot arguments;
在下方一项中填入 bootargs 参数:
console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2
(3)回到根目录重新编译
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
6.2 修改dts以适配spi flash
(1)修改源码
修改内核源码目录下的 ./arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts
将原来的&spi0{...}替换为:
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins_a>;
status = "okay";
spi-max-frequency = <50000000>;
flash: w25q128@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "winbond,w25q128", "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;partition@0 {
label = "u-boot";
reg = <0x000000 0x100000>;
read-only;
};partition@100000 {
label = "dtb";
reg = <0x100000 0x10000>;
read-only;
};partition@110000 {
label = "kernel";
reg = <0x110000 0x400000>;
read-only;
};partition@510000 {
label = "rootfs";
reg = <0x510000 0xAF0000>;
};
};
};
};
(2)重新编译设备树
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- dtbs -j46.3 修改内核配置
(1)make ARCH=arm menuconfig
(2)勾选 File systems ‣ Miscellaneous filesystems ‣ Journalling Flash File System v2 (JFFS2) support
(3)修改源码下的 ./drivers/mtd/spi-nor.c
vi ./drivers/mtd/spi-nor/spi-nor.c
注释掉以下一行:
//{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
在这一行下面增加一项:
{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, 0) },
(4)重新编译内核
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j46.4 打包生成用于少些spiflash的bin文件
(1)在f1c100s目录下,新建文件夹rootfs
mkdir rootfs
(2)复制rootfs.tar到rootfs文件夹中
cp buildroot-2017.08/output/images/rootfs.tar rootfs/
(3)解压rootfs目录下的rootfs.tar
cd rootfs
sudo tar -xvf rootfs.tar
(4)删除rootfs.tar
sudo rm rootfs.tar
(5)回到f1c100s目录,编写打包命令
cd ..
vim BuildMyImage.sh
填写如下内容:
#!/bin/sh
dd if=/dev/zero of=f1c100s_spiflash_16M.bin bs=1M count=16 &&\
dd if=u-boot/u-boot-sunxi-with-spl.bin of=f1c100s_spiflash_16M.bin bs=1K conv=notrunc &&\
dd if=linux-f1c100s-480272lcd-test/arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dtb of=f1c100s_spiflash_16M.bin bs=1K seek=1024 conv=notrunc &&\
dd if=linux-f1c100s-480272lcd-test/arch/arm/boot/zImage of=f1c100s_spiflash_16M.bin bs=1K seek=1088 conv=notrunc &&\
mkfs.jffs2 -s 0x100 -e 0x10000 --pad=0xAF0000 -d rootfs/ -o rootfs.jffs2 &&\
dd if=rootfs.jffs2 of=f1c100s_spiflash_16M.bin bs=1k seek=5184 conv=notrunc &&\
sync
(6)运行打包脚本
sudo sh BuildMyImage.sh
-----------------------------------------------
提示错误:
BuildMyImage.sh: 6: BuildMyImage.sh: mkfs.jffs2: not found
安装mtd-utils工具:
sudo apt-get install mtd-utils
安装过程中,有可能出现超时情况,多尝试几遍或者更换源试试。
-----------------------------------------------
继续运行打包脚本:
sudo sh BuildMyImage.sh
稍等片刻,打包便能完成。
打包完成后,在当前目录,生成一个名为f1c100s_spiflash_16M.bin的文件。
你好 Linjie 我按你这步骤编译 后 放入 执行后 一点反应都没有,,,,不知什么回事
感谢晕哥的指点,我们操作:
../buildroot-2017.08/output/host/bin/arm-linux-gcc -o Boardhello2 hello.c
依然是打包进根文件系统烧录到单板。
执行./Boardhello2程序,观察输出。
https://whycan.cn/files/members/1845/BoardHello2_OK.png
显然是成功了!
页次: 1