Buildroot 打包文件系统流程跟踪
/*********************************************************************************
* Buildroot 打包文件系统流程跟踪
* 说明:
* 之前在使用Buildroot过程中,发现其自身生成的rootfs.tar.bz2文件系统可以正常运行
* 但自己使用命令打包的文件系统就有问题,于是跟一下其脚本运行的输出信息,原来使用到
* 了fakeroot来模拟root权限。
*
* 2017-10-11 深圳 南山平山村 曾剑锋
********************************************************************************/ 一、输出信息分析:
[7m>>> Finalizing target directory[27m
rm -f /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/glib-2.0/schemas/*.xml /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/usr/share/glib-2.0/schemas/*.dtd
/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/usr/bin/glib-compile-schemas /home/zengjf/zengjfos/buildroot-2017.02.3/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/share/glib-2.0/schemas --targetdir=/home/zengjf/zengjfos/buildroot-2017.02.3/output/target/usr/share/glib-2.0/schemas
No schema files found: doing nothing.
PYTHONPATH="/home/zengjf/zengjfos/buildroot-2017.02.3/output/target/usr/lib/python3.5/sysconfigdata/:/home/zengjf/zengjfos/buildroot-2017.02.3/output/target/usr/lib/python3.5/site-packages/" /home/zengjf/zengjfos/buildroot-2017.02.3/output/host/usr/bin/python3.5 support/scripts/pycompile.py /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/usr/lib/python3.5
find /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/usr/lib/python3.5 -name '*.py' -print0 | xargs -0 --no-run-if-empty rm -f
find /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/usr/lib/python3.5 -name '*.opt-1.pyc' -print0 -o -name '*.opt-2.pyc' -print0 | xargs -0 --no-run-if-empty rm -f
# 创建etc目录
mkdir -p /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/etc
# 创建hostname目录
echo "AplexOS" > /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/etc/hostname
# 使用sed对文件进行操作
/bin/sed -i -e '$a \127.0.1.1\tAplexOS' -e '/^127.0.1.1/d' /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/etc/hosts
mkdir -p /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/etc
# 登录前欢迎语句
echo "Welcome to AplexOS" > /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/etc/issue
# 创建network目录
mkdir -p /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/etc/network/
# 设置loopback设备,这也就是为什么interfaces如果这里不进行修改,每次都会被修改的原因
( echo "# interface file auto-generated by buildroot"; echo ; echo "auto lo"; echo "iface lo inet loopback"; ) > /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/etc/network/interfaces
# 设置eth0设备
( echo ; echo "auto eth0"; echo "iface eth0 inet static"; echo " address 192.168.1.202"; echo " netmask 255.255.255.0"; echo " broadcast 0.0.0.0"; echo " gateway 192.168.1.1"; ) >> /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/etc/network/interfaces
/usr/bin/install -m 0755 -D package/skeleton//nfs_check /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/etc/network/nfs_check
# 生成root账户及密码
/bin/sed -i -e s,^root:[^:]*:,root:"`/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/usr/bin/mkpasswd -m "md5" "aplex"`":, /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/etc/shadow
# debug port
/bin/sed -i -e '/# GENERIC_SERIAL$/s~^.*#~console::respawn:/sbin/getty -L console 0 vt100 #~' /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/etc/inittab
# 修改inittab文件
/bin/sed -i -e '/^#.*-o remount,rw \/$/s~^#\+~~' /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/etc/inittab
rm -f /home/zengjf/zengjfos/buildroot-2017.02.3/output/build/locales.nopurge
for i in C en_US locale-archive; do echo $i >> /home/zengjf/zengjfos/buildroot-2017.02.3/output/build/locales.nopurge; done
for dir in /home/zengjf/zengjfos/buildroot-2017.02.3/output/target/usr/share/locale; do for langdir in $dir/*; do if [ -e "${langdir}" ]; then grep -qx "${langdir##*/}" /home/zengjf/zengjfos/buildroot-2017.02.3/output/build/locales.nopurge || rm -rf $langdir; fi done; done
if [ -d /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/X11/locale ]; then for lang in C en_US; do if [ -f /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/X11/locale/$lang/XLC_LOCALE ]; then echo "$lang/XLC_LOCALE: $lang"; fi done > /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/X11/locale/locale.dir; fi
rm -rf /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/include /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/aclocal \
/home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/lib/pkgconfig /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/pkgconfig \
/home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/lib/cmake /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/cmake
find /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/{lib,share}/ -name '*.cmake' -print0 | xargs - rm -f
find /home/zengjf/zengjfos/buildroot-2017.02./output/target/lib/ /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/lib/ /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/libexec/ \
\( -name '*.a' -o -name '*.la' \) -print0 | xargs - rm -f
rm -rf /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/gdb
rm -rf /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/bash-completion
rm -rf /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/zsh
rm -rf /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/man /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/man
rm -rf /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/info /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/info
rm -rf /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/doc /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/doc
rm -rf /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share/gtk-doc
rmdir /home/zengjf/zengjfos/buildroot-2017.02./output/target/usr/share >/dev/null || true
find /home/zengjf/zengjfos/buildroot-2017.02./output/target -type f \( -perm / -o -name '*.so*' \) -not \( -name 'libpthread*.so*' -o -name 'ld-*.so*' -o -name '*.ko' \) -print0 | xargs - /home/zengjf/zengjfos/buildroot-2017.02./output/host/usr/bin/arm-buildroot-linux-gnueabi-strip --remove-section=.comment --remove-section=.note >/dev/null || true
find /home/zengjf/zengjfos/buildroot-2017.02./output/target/lib/ -type f -name 'libpthread*.so*' | \
xargs -r /home/zengjf/zengjfos/buildroot-2017.02./output/host/usr/bin/arm-buildroot-linux-gnueabi-strip --remove-section=.comment --remove-section=.note --strip-debug
find /home/zengjf/zengjfos/buildroot-2017.02./output/target/lib/ -type f -name 'ld-*.so*' | \
xargs -r /home/zengjf/zengjfos/buildroot-2017.02./output/host/usr/bin/arm-buildroot-linux-gnueabi-strip --remove-section=.comment --remove-section=.note --strip-debug
# 检查一些库的存在
test -f /home/zengjf/zengjfos/buildroot-2017.02./output/target/etc/ld.so.conf && \
{ echo "ERROR: we shouldn't have a /etc/ld.so.conf file"; exit ; } || true
test -d /home/zengjf/zengjfos/buildroot-2017.02./output/target/etc/ld.so.conf.d && \
{ echo "ERROR: we shouldn't have a /etc/ld.so.conf.d directory"; exit ; } || true
mkdir -p /home/zengjf/zengjfos/buildroot-2017.02./output/target/etc
( \
echo "NAME=Buildroot"; \
echo "VERSION=2017.02.3"; \
echo "ID=buildroot"; \
echo "VERSION_ID=2017.02.3"; \
echo "PRETTY_NAME=\"Buildroot 2017.02.3\"" \
) > /home/zengjf/zengjfos/buildroot-2017.02./output/target/etc/os-release
[7m>>> Generating root filesystem image rootfs.tar[27m
rm -f /home/zengjf/zengjfos/buildroot-2017.02./output/build/_fakeroot.fs
rm -f /home/zengjf/zengjfos/buildroot-2017.02./output/target/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
rm -f /home/zengjf/zengjfos/buildroot-2017.02./output/build/_users_table.txt
echo '#!/bin/sh' > /home/zengjf/zengjfos/buildroot-2017.02./output/build/_fakeroot.fs
echo "set -e" >> /home/zengjf/zengjfos/buildroot-2017.02./output/build/_fakeroot.fs
echo "chown -h -R 0:0 /home/zengjf/zengjfos/buildroot-2017.02.3/output/target" >> /home/zengjf/zengjfos/buildroot-2017.02./output/build/_fakeroot.fs
printf ' sshd -1 sshd -1 * - - - SSH drop priv user\n ftp -1 ftp -1 * /home/ftp - - Anonymous FTP User\n\n' >> /home/zengjf/zengjfos/buildroot-2017.02./output/build/_users_table.txt
PATH="/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/bin:/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/sbin:/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/usr/bin:/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/usr/sbin:/home/bin:/home/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zengjf/zengjfos/buildroot-2016.08/output/host/opt/ext-toolchain/bin::/home/zengjf/zengjfos/AplexOS/git-repo:/home/linux/pycharm-community-2017.1.3/bin" /home/zengjf/zengjfos/buildroot-2017.02./support/scripts/mkusers /home/zengjf/zengjfos/buildroot-2017.02./output/build/_users_table.txt /home/zengjf/zengjfos/buildroot-2017.02./output/target >> /home/zengjf/zengjfos/buildroot-2017.02./output/build/_fakeroot.fs
cat system/device_table.txt > /home/zengjf/zengjfos/buildroot-2017.02./output/build/_device_table.txt
printf ' /bin/busybox f 4755 0 0 - - - - -\n /dev/console c 622 0 0 5 1 - - -\n\n' >> /home/zengjf/zengjfos/buildroot-2017.02./output/build/_device_table.txt
echo "/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/usr/bin/makedevs -d /home/zengjf/zengjfos/buildroot-2017.02.3/output/build/_device_table.txt /home/zengjf/zengjfos/buildroot-2017.02.3/output/target" >> /home/zengjf/zengjfos/buildroot-2017.02./output/build/_fakeroot.fs
# 这里很重要,因为这里可以将target中的内容打包进入rootfs.tar中去
printf ' (cd /home/zengjf/zengjfos/buildroot-2017.02.3/output/target; find -print0 | LC_ALL=C sort -z | tar -cf /home/zengjf/zengjfos/buildroot-2017.02.3/output/images/rootfs.tar --null --no-recursion -T - --numeric-owner)\n' >> /home/zengjf/zengjfos/buildroot-2017.02./output/build/_fakeroot.fs
# 给_fakeroot.fs加执行权限
chmod a+x /home/zengjf/zengjfos/buildroot-2017.02./output/build/_fakeroot.fs
# 用fakeroot执行_fakeroot.fs
PATH="/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/bin:/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/sbin:/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/usr/bin:/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/usr/sbin:/home/bin:/home/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zengjf/zengjfos/buildroot-2016.08/output/host/opt/ext-toolchain/bin::/home/zengjf/zengjfos/AplexOS/git-repo:/home/linux/pycharm-community-2017.1.3/bin" /home/zengjf/zengjfos/buildroot-2017.02./output/host/usr/bin/fakeroot -- /home/zengjf/zengjfos/buildroot-2017.02./output/build/_fakeroot.fs
rootdir=/home/zengjf/zengjfos/buildroot-2017.02./output/target
table='/home/zengjf/zengjfos/buildroot-2017.02.3/output/build/_device_table.txt'
# 相当于拷贝,同时可以设定权限
/usr/bin/install -m support/misc/target-dir-warning.txt /home/zengjf/zengjfos/buildroot-2017.02./output/target/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
# 使用bzip2进行压缩
PATH="/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/bin:/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/sbin:/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/usr/bin:/home/zengjf/zengjfos/buildroot-2017.02.3/output/host/usr/sbin:/home/bin:/home/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zengjf/zengjfos/buildroot-2016.08/output/host/opt/ext-toolchain/bin::/home/zengjf/zengjfos/AplexOS/git-repo:/home/linux/pycharm-community-2017.1.3/bin" bzip2 - -c /home/zengjf/zengjfos/buildroot-2017.02./output/images/rootfs.tar > /home/zengjf/zengjfos/buildroot-2017.02./output/images/rootfs.tar.bz2 二、fakeroot使用:
. 参考命令:fakeroot -- /home/zengjf/zengjfos/buildroot-2017.02./output/build/_fakeroot.fs
. cd <your path> && fakeroot -- tar jcvf rootfs.tar.bz2 *
Buildroot 打包文件系统流程跟踪的更多相关文章
- buildroot制作文件系统
/******************************************************************* * buildroot制作文件系统 * 使用buildroot ...
- iOS开发基础:最新的APP打包上架流程
之前有人留言让我更新部分文章,下面就为大家分享一下iOS的APP打包上架流程: 上传至apple developer 1.1 上传准备工作 更新上架和发布上架不同,在原始版本首次上架的时候就将描述文件 ...
- activiti流程跟踪图算法
流程跟踪图-推导算法 工作中使用activiti实现流程图相关业务,但是上线后遇到问题,偶尔流程图出不来.查阅了一下画流程图的实现,基本上是参见:activiti-流程图颜色变化之一篇. 核心类,参见 ...
- I.MX6 Linux Qt 启动流程跟踪
/************************************************************************** * I.MX6 Linux Qt 启动流程跟踪 ...
- cordova打包apk流程
一.打包 条件: 1.java-jdk 2.Android-sdk ( 安装教程:https://blog.csdn.net/qq_36577136/article/details/80632674 ...
- Pyinstaller打包通用流程
Pyinstaller打包通用流程 前言 什么是Pyinstaller Pyinstaller是用于打包python项目的一个工具, 可以将项目代码打包成可执行文件, 在其他机器上使用. 通俗的说, ...
- iOS 程序打包,安装流程
一.发布测试,是指将你的程序给 * 你的测试人员,因为程序总归是要测试的 * 你的客户,在正式发布之前,客户肯定是要先看(验收)的 在他们的iOS设备(iphone,ipod, ipad)安装 ...
- 【Egret】Wing3发布移动APP功能,打包APK流程以及会遇到的问题
流程:1.安装好wing 3,然后 插件--Egret项目工具--发布移动APP--Build android native project 2.配置发布环境: Android 1.egret eng ...
- Linux 下RPM打包制作流程
原文地址:https://www.cnblogs.com/postgres/p/5726339.html 开始前的准备 安装rpmbuild软件包 yum -y install rpm-build 生 ...
随机推荐
- 【Lua】LDoc生成Lua文档工具的使用
参考资料: http://my.oschina.net/wangxuanyihaha/blog/188909 LDoc介绍: LDoc是一个Lua的文档生成工具,过去,比较常用的Lua生成 ...
- 禁止或强制使用堆分配---《C++必知必会》 条款34
有时候,指明一些特定类的对象不应该被分配到堆(heap)上是个好主意.通常这是为了确保该对象的析构函数一定会得到调用.维护对象本身(body object)的引用计数的句柄对象(handle obje ...
- 2018 Multi-University Training Contest 4 Solution
A - Problem A. Integers Exhibition 留坑. B - Problem B. Harvest of Apples 题意:计算$\sum_{i = 0}^{i = m}C( ...
- C#——图片操作类简单封装
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Dr ...
- 如何写一个自己的渣渣PHP框架
原文链接:https://www.opqnext.com/2017/01/18/%E5%A6%82%E4%BD%95%E5%86%99%E4%B8%80%E4%B8%AA%E8%87%AA%E5%B7 ...
- FMC简介
FMC简介 FMC ( FPGA Mezzanine Card ) 简而言之,是具有特定功能的子卡模块. Developed by a consortium of companies ranging ...
- Python学习札记(三十六) 面向对象编程 Object Oriented Program 7 __slots__
参考:slots NOTE 1.动态语言灵活绑定属性及方法. #!/usr/bin/env python3 class MyClass(object): def __init__(self): pas ...
- POJ 2262 Goldbach's Conjecture(Eratosthenes筛法)
http://poj.org/problem?id=2262 题意: 哥德巴赫猜想,把一个数用两个奇素数表示出来. 思路:先用Eratosthenes筛法打个素数表,之后枚举即可. #include& ...
- FW: How to use Hibernate Lazy Fetch and Eager Fetch Type – Spring Boot + MySQL
原帖 https://grokonez.com/hibernate/use-hibernate-lazy-fetch-eager-fetch-type-spring-boot-mysql In the ...
- Codeforces Round #307 (Div. 2) C. GukiZ hates Boxes 二分
C. GukiZ hates Boxes time limit per test 2 seconds memory limit per test 256 megabytes input standar ...