Re: Building minimal rootfs to use as non-root on arm device

Corbin Champion <[email protected]>
Newsgroups gmane.linux.debian.devel.embedded
Message-ID <CABxzp7D78ku_DG4saPDfpH9VxoS=Z28m=oWc+CSiJNouAEvUQg@mail.gmail.com>
>> I have created a rootfs using buildroot, but using a crosstool-ng
toolchain
>> with glibc.  This showed me the minimal set of files necessary.  I then
>> replaced all the libraries with ones pulled straight from the squeeze
.deb
>> packages for armel.

>Hmm. If the problem was to find out the minimal set of files, wouldn't
>grip dependencies do the same?

Good point.  This issue, dns not working, also occurred when doing a full
debootstrap (fakechroot variant), but that is also different.

>> Entering the same setup, but using qemu and chroot on my host machine
>> works

>Are "using qemu and chroot" two distinct test cases?

No.  I copied qemu_arm_static to /usr/bin and used chroot to make this my
root.  So, I was on an x86 machine, but used chroot with qemu to emulate
being on an arm device with the given root.

>> When I run "*strace ping google.com*" I get the following:

> Is this on the target?

Yes

>> *open("/data/local/target/bin/ping", O_RDONLY) = 3*

> If yes, how is the rootfs mounted, and what is /data/local/target?

fakechroot is what I use and /data/local/target is the location that I want
to be my root.

I use this command:
/data/local/target/usr/bin/fakeroot-sysv -f
/data/local/target/usr/bin/faked-sysv -l
/data/local/target/usr/lib/libfakeroot/libfakeroot-sysv.so
/data/local/target/usr/bin/fakechroot -l
/data/local/target/usr/lib/fakechroot/libfakechroot.so
/data/local/target/usr/sbin/chroot /data/local/target ash

>> *open("/etc/resolv.conf", O_RDONLY)      = -1 ENOENT (No such file or
>> directory)*
>...
>> *connect(3, {sa_family=AF_INET, sin_port=htons(53),
>> sin_addr=inet_addr("127.0.0.1"
)}, 16) = 0*
>...
>> *open("/data/local/target/etc/hosts", O_RDONLY|O_CLOEXEC) = 3*
>...
>> it figured out that
>> the host file wasn't simply at /etc/hosts, but why do you think it didn't
>> look in the correct location for nsswitch.conf and resolv.conf?

>The fastest way to answer your question would probably be to look at your
>implementation of gethostbyname & Co.

I don't implement these.  libc uses fopen to open these files and I thought
fakechroot should modify the path that it is looking for them.  It does
that in other cases.  Trying to figure out why this specifically is not
working.

>Do you mean that the correct location should be
>/data/local/target/etc/resolv.conf? If yes, why? What is the problem
>using /etc/resolv.conf?

Yes.  Just like it knew to add /data/local/target to the beginning of where
it was looking for the hosts file.  This is because I have run fakechroot.

>With kind regards,
>Baurzhan.

Thanks,
Corbin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.