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 生 ...
随机推荐
- NULL头文件
#include<stddef.h> NULL不是C语言基本类型,其定义在stddef.h文件中,作为最基本的语言依赖宏存在.但是随着C/C++的发展,很多文件只要涉及了系统或者标准操作都 ...
- (15)如何使用Cocos2d-x 3.0制作基于tilemap的游戏:第三部分(完)
引言 程序截图: 在第二部分教程中,Ray教大家如何在地图中制作可碰撞的区域,如何使用tile属性,如何制作可以拾取的物品以及如何动态修改地图.如何使用“Heads up display”来显示分数. ...
- 文件名含中文的JavaWeb文件下载
在javaweb项目中实现文件下载,当文件名中包含中文文字时,需要进行如下的处理,才能在浏览器端正常显示中文文件名: response.setContentType("octets/stre ...
- tomcat jdbc pool
文中内容主要转自:http://www.open-open.com/lib/view/open1327478028639.html http://www.open-open.com/lib/view/ ...
- Fms3和Flex打造在线视频录制和回放
本博推荐文章快速导航: Sql Server2005 Transact-SQL 新兵器学习MCAD学习 代码阅读总结 ASP.NET状态管理 DB(数据库)WAPWinFormFlex,Fms aie ...
- c/c++获取系统时间函数
参考:http://blog.sina.com.cn/s/blog_6f2caee40100uu41.html Coordinated Universal Time(UTC): 协调世界时,又称为 ...
- Kali视频学习21-25
Kali视频学习21-25 (21)密码攻击之在线攻击工具 一.cewl可以通过爬行网站获取关键信息创建一个密码字典. 二.CAT (Cisco-Auditing-Tool)很小的安全审计工具,扫描C ...
- Ubuntu16.04下配置pip国内镜像源加速安装【转】
本文转载自:https://blog.csdn.net/yucicheung/article/details/79095742 问题描述 基于国内网速的问题,我们直接pip安装包通常速度非常慢,而且经 ...
- Bzoj1101: [POI2007]Zap 莫比乌斯反演+整除分块
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1101 莫比乌斯反演 1101: [POI2007]Zap 设 \(f(i)\) 表示 \(( ...
- NOIP 2018 兔纸旅游记
今年是第一次参加tg呢... Day0 早上出发去中旅坐大巴,走有 lz 特色的OI比赛道路. 车上谈笑风生,看 jw 的 GDOI 的小本本. 到动车站取票入站,看 lmh 和 zn 的爱恨情 ...