Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
chroot to build an embedded filesystem?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
zephyr1256
Apprentice
Apprentice


Joined: 10 Mar 2003
Posts: 170
Location: Kingsport, TN

PostPosted: Fri Jun 06, 2003 6:45 pm    Post subject: chroot to build an embedded filesystem? Reply with quote

I'm working on an embedded project, and I need to compile much of my filesystem for it with optimizations to reduce size and for a different architecture. I thought portage would be useful for this, I could just build the filesystem, and then hand pick the config files, binaries, and library files I need from this system to stick into a compressed file system. I thought I might make a directory for this, and extract a stage 3 tarball in the directory, to get the base filesystem, do a gentoo install, possibly skipping kernel compile, and emerging only the packages I need. Of course this would have more stuff than I really need, so after it is done, I would grab I needed to put in compressed filesystems to go on some floppies. I want to do this because I don't really want to rebuild my whole system to a lower common denominator in terms of architecture, and I don't have a free partition to install such a system anyway(well I could wipe my NTFS drive, which I never use except as storage for mp3s and the like, but I'd have to do a fair bit to back all that up.). I might do a kernel for it as well, but as I already have a bootdisk, I'm not sure yet if it will be needed.

So would this idea work? Any danger of messing my system(assuming I correctly chroot and env-update before starting to emerge stuff)?
_________________
The Congress shall have power...To promote the progress of science and useful arts, by securing for limited times to authors and inventors the exclusive right to their respective writings and discoveries; --U.S. Constitution. Article 1, Section 8.
Back to top
View user's profile Send private message
Pythonhead
Developer
Developer


Joined: 16 Dec 2002
Posts: 1801
Location: Redondo Beach, Republic of Calif.

PostPosted: Fri Jun 06, 2003 7:04 pm    Post subject: Reply with quote

This sounds plausible to me. I had a functioning Red Hat system where I installed Gentoo using that method. I was running KDE and slowly but surely had Gentoo compiling away in a chroot environment. Worked like a charm.
Back to top
View user's profile Send private message
dol-sen
Retired Dev
Retired Dev


Joined: 30 Jun 2002
Posts: 2805
Location: Richmond, BC, Canada

PostPosted: Sat Jun 07, 2003 7:30 am    Post subject: Reply with quote

I did that to make my gentoo firewall system on my new machine since the firewall will have minimal hard drive space (read not enough to install gentoo with). It works much faster that way. I just created its own directory (/home/firewall) and created a script to automate the chroot process. I do it in a su'd terminal window

Code:
big_squirt root # cat gofire.sh
#/bin/bash
 
mount -t proc /proc /home/firewall/proc
mount -o bind /dev /home/firewall/dev
mount -o bind /usr/portage /home/firewall/usr/portage
chroot /home/firewall /bin/bash

Then
Code:
env-update
source /etc/profile


I mount the /usr/portage directory as well for the chroot, that way you have an up to date portage tree with a populated distfiles directory for emerges.
_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
aja
l33t
l33t


Joined: 26 Aug 2002
Posts: 705
Location: Edmonton, Canada

PostPosted: Sat Jun 07, 2003 7:43 am    Post subject: Reply with quote

Are you sure you want to use Gentoo for an embedded device? It's a bit heavy for that application - I'd normally used a tuned-for-embedding kernel like ucLinux -> and I'm not sure what you get by chroot'ing - you wouldn't be able to run any programs (or a kernel) compiled for a different architecture, and compiling to support both architectures would defeat the purpose. I can't see it would be any less work than using a development directory and alien toolchain. Generally, embedded systems have very few applications installed -> why portage (particularly since the sources for many packages in portage won't work on alternate architectures) and not simply make files for code that is specifiec to your embedded architecture?
Back to top
View user's profile Send private message
zephyr1256
Apprentice
Apprentice


Joined: 10 Mar 2003
Posts: 170
Location: Kingsport, TN

PostPosted: Sat Jun 07, 2003 1:58 pm    Post subject: Reply with quote

aja wrote:
Are you sure you want to use Gentoo for an embedded device? It's a bit heavy for that application - I'd normally used a tuned-for-embedding kernel like ucLinux -> and I'm not sure what you get by chroot'ing - you wouldn't be able to run any programs (or a kernel) compiled for a different architecture, and compiling to support both architectures would defeat the purpose. I can't see it would be any less work than using a development directory and alien toolchain. Generally, embedded systems have very few applications installed -> why portage (particularly since the sources for many packages in portage won't work on alternate architectures) and not simply make files for code that is specifiec to your embedded architecture?


Well, its for a class, and we are doing "mock" embedded systems actually running on desktops(ie, it's an architecture that can portage can easily be used to compile for) with the whole file system loaded from a few floppies(boot disk, root disk, and 1 or 2 utility disks). That said, the whole install is only going to be oh, maybe 10 MB, most of what will be in the chroot filesystem will not be used, I'm hand picking my files for just what the system needs.
_________________
The Congress shall have power...To promote the progress of science and useful arts, by securing for limited times to authors and inventors the exclusive right to their respective writings and discoveries; --U.S. Constitution. Article 1, Section 8.
Back to top
View user's profile Send private message
guy
Apprentice
Apprentice


Joined: 31 Mar 2003
Posts: 286
Location: USA

PostPosted: Sun Nov 23, 2003 2:21 am    Post subject: Reply with quote

Why chroot and not just do something like ROOT="firewalldir" emerge stuff ?
_________________
www.manatee.servemp3.com
www.seas.upenn.edu/~bdodson/gina
www.goatse.cx [it will rise again!]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum