u-boot源码怎么样根据编译时候访问的文件来删除无关的源码?

lingdulebaishi 2017-07-27 03:03:08
网上看到一个脚本
#!/bin/bash

set -e
set -o pipefail
git ls-tree -r HEAD --name-only |tee mark| xargs touch
touch mark
echo 'echo -00122-g512f9aa; exit 0' > ./tools/setlocalversion
(cd $(lookup-file .repo/..); . build/envsetup.sh; cd boot; BUILD_UBOOT_OBM=true; set -x; . ../.buildenv.sh; cd uboot; time make -j8 ${1:-kunlun_ff_config}; time make -j8 -k) 2>&1 | tee ~/1.txt

find . -type f -anewer mark -print -o -type l -print | perl -npe 's!^\./!!' > newer
file-arg1-arg2 mark newer | pn 1 | xargs git rm -f
应该是稍微修改一下make方式,会根据make时候访问的文件来删除其余多余的源码的,不过我的linux里面touch不支持这种方式,不知道哪位大仙有更好的办法。
脚本是http://baohaojun.github.io/remove-unneeded-files-for-code-reading.html这里看到的,里面还有内核的筛选删除脚本,暂时还没用到,请问哪位大牛有这方面经验的。
...全文
1286 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lingdulebaishi 2018-01-17
  • 打赏
  • 举报
回复
自己写了个这个还凑合用,删除arch和board里面的无关c和S文件,头文件就无能为力了 #!/bin/bash echo "All uncompiled programs will be deleted!" cd ${PWD} || exit read -r -p "Have you confirmed the compilation,Invalid input is NO! [Y/n] " input case $input in [yY][eE][sS]|[yY]) echo "Yes" ;; [nN][oO]|[nN]) echo "No" exit ;; *) echo "No" exit ;; esac find ./arch ./board -name *.o > tmp.txt sed 's/.$//' tmp.txt > tmp2.txt || exit sed 's/$/&*/g' tmp2.txt > tmp3.txt || exit cat tmp3.txt tar -zcvf bk.tar.gz `cat tmp3.txt` || exit find ./arch ./board -name *.S | xargs rm -rf find ./arch ./board -name *.c | xargs rm -rf rm -rf tmp.txt tmp2.txt tmp3.txt tar -zxvf bk.tar.gz rm -rf bk.tar.gz
ma100 2017-07-28
  • 打赏
  • 举报
回复
别乱删, 说不定什么时候有用 真删的话可以把cpu相关的删了, 比如你是arm就把什么x86.ppc,mips什么的都删了

4,436

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧