Buildroot Quick Start

来自Jack's Lab
2021年2月9日 (二) 15:35Comcat (讨论 | 贡献)的版本

跳转到: 导航, 搜索

1 Overview

目录结构:

comcat@jackslab:~/f1c/buildroot-2020.11.2$ ls
arch  board  boot  CHANGES  Config.in  Config.in.legacy  configs  COPYING  DEVELOPERS  dl  docs  fs  linux  Makefile  Makefile.legacy  output  package  README  support  system  toolchain  utils


2 准备代码

$ mkdir ~/helloworld_src

放入 helloworld.c Makefile:

helloworld.c:

#include <stdio.h>
#include <unistd.h>

int main(int argc, int *argv[])
{
	while(1)
	{
		printf("Hello world\n");
		sleep(1);
	}
	return 0;
}

Makefile:

OBJS=helloworld.o

all:	helloworld

helloworld:	$(OBJS)
	$(CC) $(LDFLAGS) -o helloworld $(OBJS)

$(OBJS): %.o:	%.c
	$(CC) $(CFLAGS) -c -o $@ $<


个人工具
名字空间

变换
操作
导航
工具箱