【发布时间】:2014-12-19 01:38:43
【问题描述】:
我在 chroot-ed Debian armel 环境中看到了一些非常奇怪的东西。
但首先,有一点背景故事......这很长,但问题是 很复杂,任何潜在的帮助都取决于了解完整的故事。
我有一个运行 Linux 的嵌入式 ARM SoC - 更具体地说,
Debian armelLenny 在 2.6.17 内核上。 Debian 发行版本身是
可轻松升级到更高版本 (sudo apt-get dist-upgrade)
因此可以加快速度,达到armel 的版本
squeeze 甚至是wheezy。
问题是内核是定制的……ARM SoC 有问题不是主线内核的一部分,所以它很漂亮 在 2.6.17 被遗弃了很多。
如果您了解 Linux 和 GLIBC 的工作原理,您已经可以看到 问题 - GLIBC 版本编译时支持的最低限度 内核版本......它已经超过了 2.6.17。所以如果我们尝试 例如chroot 到 Debian 挤压...
$ # From inside the little ARM machine running Debian Lenny
$ sudo debootstrap --arch armel squeeze /squeeze \
http://ftp.whateverCountry.debian.org/debian
$ sudo -i
# mount -t proc none /squeeze/proc
# mount -t sysfs none /squeeze/sys
# mount -t devpts none /squeeze/dev/pts
# chroot /squeeze
Fatal: Kernel too old
...我们看到来自squeeze 的 GLIBC 的消息,告诉我们
它没有被编译为与这个旧内核 (2.6.17) 一起使用。
wheezy 也会出现同样的问题 - 因为它比 挤压——事实上,从现在开始,任何 Debian 版本都会发生这种情况, 因为他们的 GLIBC 无法在我的 2.6.17 内核上运行。
起初我认为这会破坏交易 - 但后来我意识到 我可以理论上重新编译 GLIBC 以使用旧版本 我的 SoC 正在使用的内核......但我需要一个相同的环境 用于构建 libc6 包的内容,例如Debian 挤压。
我在猜测 GLIBC 的编译和准备 libc6_2.11.3-4.deb 文件是通过自动交叉编译完成的 Debian 之神发明的机器。
我不是上帝...我在 Google 上也找不到任何关于如何
成为一个 - 即如何使用我的 Core i5 作为主机,
使用与打包的完全相同的设置交叉编译 GLIBC
版本(在 Debian squeeze 内部)正在使用。
所以我欺骗了它 - 我想出了如何设置 ARM 版本
我的 Core i5 上的 Debian 挤压(一种使用静态
qemu-arm 二进制文件的版本)。
在我的 x86 托管版本 Debian-armel-squeeze chroot 后,
我能够简单地...
$ cd /var/tmp
$ apt-get source libc6
...
$ # edit this in - compile for my kernel...
$ vi eglibc-2.11.3/debian/sysdeps/linux.mk
...
MIN_KERNEL_SUPPORTED := 2.6.17
...
$ export DEB_BUILD_OPTS="nocheck parallel=1"
$ cd eglibc-2.11.3
$ dpkg-buildpackage -b -d -us -uc
...3 小时后(Core i5 托管的 chroot 版本的
Debian-armel-squeeze 比本地机器慢很多...)
我得到了我的 libc6 .deb 包。大概需要3个月
在我的 SoC 中进行此构建,所以我没有抱怨。
回到我真正的 ARM SoC,我复制了所有的 libc 文件 (.so)的新包的默认值的挤压和 尝试 chroot...
# chroot squeeze/
root@ttsiodras:/#
是的!有效! (或者看起来)
我的自定义 libc 从 chroot 内部报告:
# /lib/libc.so.6
GNU C Library (Debian EGLIBC 2.11.3-4) stable release version 2.11.3, by Roland McGrath et al.
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.4.5.
Compiled on a Linux 2.6.26 system on 2014-10-23.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
Support for some architectures added on, not maintained in glibc core.
BIND-8.2.3-T5B
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.
似乎一切正常 - 我复制了一个文件,调用了 ls...
但是当我尝试使用apt-get 安装来自squeeze 的一些应用程序时,我开始收到......一些意外错误:
# apt-get install indent
Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed:
indent
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 110 kB of archives.
After this operation, 516 kB of additional disk space will be used.
Get:1 http://ftp.gr.debian.org/debian/ squeeze/main indent armel 2.2.11-1 [110 kB]
Fetched 110 kB in 0s (236 kB/s)
tar: ./control: Cannot utime: Function not implemented
tar: ./md5sums: Cannot utime: Function not implemented
tar: .: Cannot utime: Function not implemented
tar: Exiting with failure status due to previous errors
dpkg-deb: subprocess tar returned error exit status 2
dpkg: error processing /var/cache/apt/archives/indent_2.2.11-1_armel.deb (--unpack):
subprocess dpkg-deb --control returned error exit status 2
configured to not write apport reports
rm: cannot remove `/var/lib/dpkg/tmp.ci': Function not implemented
dpkg: error while cleaning up:
subprocess rm cleanup returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/indent_2.2.11-1_armel.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
哦-哦...一堆Function not implemented。这听起来像 GLIBC 报告
基本的东西不起作用......
我设法 strace(不要问如何)并发现所有 -at 函数
失败:openat、mkdirat、renameat 等 - 他们都在报告 ENOSYS。
看来我只是部分成功了——一些系统调用失败了 在我的新 GLIBC 中。
在2.6.17下编译一个squeeze或者wheeze GLIBC是不可能的吗?
任何关于我做错了什么和/或如何继续的想法/指针将不胜感激......
【问题讨论】: