我正在构建linux内核,如果我的内核在git下,那么内核版本每次都是:
Image Name: Linux-2.6.39+
Run Code Online (Sandbox Code Playgroud)
如果我不使用git,那么一切都没问题,最后没有任何加分.
我知道这是由scripts/setlocalversion脚本完成的:
if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
# full scm version string
res="$res$(scm_version)"
else
# append a plus sign if the repository is not in a clean
# annotated or signed tagged state (as git describe only
# looks at signed or annotated tags - git tag -a/-s) and
# LOCALVERSION= is not specified
if test "${LOCALVERSION+set}" != "set"; then
scm=$(scm_version --short)
res="$res${scm:++}"
fi
fi
Run Code Online (Sandbox Code Playgroud)
那么,没有代码更改就可以说构建系统不需要在版本行的末尾添加"+"?
我将设置构建环境,为AT91SAM9X25板制作自己的linux嵌入式系统.我正在使用buildroot来做到这一点.make命令构建所有目标,第一个构建工具链然后打包,然后rootfs和rootfs(tar,cpio ...)的图像.要重建rootfs,我通常使用make clean然后make.make clean命令删除所有包括工具链.
所以我的第一个问题是:有没有办法在不构建工具链的情况下重制rootfs?这需要很多时间.
我也在buildroot中构建linux内核.我在buildroot中打开了BR2_LINUX_KERNEL [= y].linux配置为使用初始RAM文件系统,因此要构建内核,需要rootfs的映像(应该由buildroot创建).当我在buildroot的root下运行make时,构建失败并出现错误无法打开'buildroot-2013.05/output/images/rootfs.cpio'.因为(如果我理解正确的话)构建序列是工具链--pakages - rootfs - linux内核 - rootfs的图像.当它尝试构建linux内核时,不会创建rootfs.cpio映像.
所以第二个问题是:如果我想使用初始RAM文件系统,如何在buildroot中构建linux?
可能是比buildroot更有效的替代品?
提前致谢.
为什么fw_setenv工具只为一种环境设置变量值?
我正在使用带有冗余环境的uboot(#define CONFIG_ENV_OFFSET 0xc0000、#define CONFIG_ENV_OFFSET_REDUND 0x100000),并且我将从linux设置uboot环境变量的值。有 fw_setenv/fw_printenv 工具可以执行此操作:
# fw_printenv rootfs
rootfs=mtd6
# fw_setenv rootfs mtd7
Run Code Online (Sandbox Code Playgroud)
检查它是否确实已设置:
# fw_printenv rootfs
rootfs=mtd7
Run Code Online (Sandbox Code Playgroud)
看起来没问题,但是重启系统并进入u-boot控制台后,rootfs变量的值是以前的值。uboot读取以前的值:
=> printenv
rootfs=mtd6
Run Code Online (Sandbox Code Playgroud)
然后我查看了 uboot env 放置的 mtd 设备的 hexdump 输出。
# hexdump -C /dev/mtd3 | 头-n 200
. . . . .
000000a0 65 6c 61 79 3d 35 00 62 61 75 64 72 61 74 65 3d |elay=5.baudrate=|
000000b0 31 31 35 32 30 30 00 72 6f 6f 74 66 73 3d …Run Code Online (Sandbox Code Playgroud) 在我的测试中,我发现在free()之后可以使用指针.我有以下代码:
typedef struct{
int module_id;
int adc_id;
struct config_line * pnext;
} config_line;
config_line * create_list()
{
config_line * phead = (config_line *) malloc(sizeof(config_line));
phead->pnext=NULL;
phead->module_id = 1;
phead->adc_id = 2;
printf("module_id=%d adc_id=%d\n",phead->module_id, phead->adc_id);
free(phead);
printf("module_id=%d adc_id=%d\n",phead->module_id, phead->adc_id);
phead->module_id = 2;
phead->adc_id = 5;
printf("module_id=%d adc_id=%d\n",phead->module_id, phead->adc_id);
}
Run Code Online (Sandbox Code Playgroud)
此代码的输出是:
module_id=1 adc_id=2
module_id=0 adc_id=2
module_id=2 adc_id=5
Run Code Online (Sandbox Code Playgroud)
为什么在free(phead)之后我可以访问(读写)指针?为什么没有分段错误?
buildroot支持从git repo下载软件包。但是我的git repo包含子模块。
如何命令buildroot下载带有子模块的软件包?
我有几个注册的中断分配给gpios,并在用户空间中应用.如何通知应用程序有关发生的中断和有哪些中断?
可能fasync适用于此目标,但我可以找到如何从中断处理程序向用户空间应用程序发送信息的示例.
如果你能提供一些有用的例子,那就太好了.
提前致谢.
这是来自http://www.cplusplus.com/reference/condition_variable/condition_variable/wait_for/的简单代码
如果我用起始线程评论行,为什么wait_for()会立即返回?
像这样:
// condition_variable::wait_for example
#include <iostream> // std::cout
#include <thread> // std::thread
#include <chrono> // std::chrono::seconds
#include <mutex> // std::mutex, std::unique_lock
#include <condition_variable> // std::condition_variable, std::cv_status
std::condition_variable cv;
int value;
void read_value() {
std::cin >> value;
cv.notify_one();
}
int main ()
{
std::cout << "Please, enter an integer (I'll be printing dots): ";
//std::thread th (read_value);
std::mutex mtx;
std::unique_lock<std::mutex> lck(mtx);
while (cv.wait_for(lck,std::chrono::seconds(1))==std::cv_status::timeout) {
std::cout << '.';
}
std::cout << "You entered: " << value << '\n'; …Run Code Online (Sandbox Code Playgroud) 如何从源地图中正确查找元素并将其插入另一个地图?
std::map<int, std::shared_prt<Obj>> src_map
std::map<int, std::shared_prt<Obj>> target_map
int key = 6;
auto found_elem = src_map.find(key);
if (found_elem != src_map.end()) {
if (target_map.find(key) == target_map.end()) {
target_map.insert(found_elem ); <---- How to correctly insert found element from src_map to target_map
}
}
Run Code Online (Sandbox Code Playgroud)