BuildKernelWithChroot

Differences between revisions 1 and 16 (spanning 15 versions)
Revision 1 as of 2009-06-17 10:00:53
Size: 2134
Editor: 210
Comment:
Revision 16 as of 2009-06-22 06:11:18
Size: 3524
Editor: 210
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
1. sudo apt-get install schroot
2. sudo mkdir /var/chroot
3. Add following content to the end of /etc/schroot/schroot.conf
<<Include(KernelTeamHeader)>>
||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;"><<TableOfContents>>||

== Summary ==
This wiki page is the step-by-step document for build the environment of chroot for build kernel image

== Install necessary package on host ==
host# '''sudo apt-get install schroot debootstrap'''

== Where the root of chroot is ==
host# '''sudo mkdir /var/chroot'''

== Modify the schroot config file ==
host# '''sudo vi /etc/schroot/schroot.conf'''<<BR>>
''Append the following context''
Line 5: Line 17:
[hardy-lpia]
Line 8: Line 21:
users=<your_userid_on_your_machine> users=<your_userid_on_your_host>
Line 13: Line 26:
4. sudo debootstrap --variant=buildd --arch lpia hardy /var/chroot/hardy-lpia http://ports.ubuntu.com/
5. sudo cp /etc/resolv.conf /var/chroot/hardy-lpia/etc/resolv.conf
6. Remove everything in /var/chroot/hardy-lpia/etc/apt/sources.list and add following line

== Install basic package into chroot environment ==
host# '''sudo debootstrap --variant=buildd --arch lpia hardy /var/chroot/hardy-lpia `http://ports.ubuntu.com/`'''<<BR>>
host# '''sudo cp /etc/resolv.conf /var/chroot/hardy-lpia/etc/resolv.conf'''<<BR>>
host# '''sudo vi /var/chroot/hardy-lpia/etc/apt/sources.list'''<<BR>>
''Remove everything and add following line''
Line 20: Line 36:
7. sudo chroot /var/chroot/hardy-lpia
8. apt-get install wget debconf devscripts gnupg nano vim
9. apt-get update
10. apt-get install locales dialog
11. locale-gen en_US.UTF-8
12. tzselect
13. echo "export TZ='Asia/Taipei'" >> /root/.profile
14. exit # from chroot
15. sudo vi /etc/fstab and add following line

== Now you can chroot in and install more package ==
host# '''sudo chroot /var/chroot/hardy-lpia'''<<BR>>
root@chroot# '''apt-get install gnupg; apt-get update'''<<BR>>
root@chroot# '''apt-get install wget debconf devscripts dialog nano vim debhelper locales sudo kernel-wedge'''<<BR>>
root@chroot# '''locale-gen en_US.UTF-8'''<<BR>>
root@chroot# '''tzselect'''<<BR>>
root@chroot# '''exit'''<<BR>>

== Bind several directory with chroot and host ==
host# '''sudo vi /etc/fstab'''<<BR>>
''Append the following lines''<<BR>>
''Take care it will bind /home between your host and chroot environment''<<BR>>
''If you want to remove chroot environment, '''*umount them first*'''''
Line 39: Line 60:
16. sudo mount -a
17.
sudo cp /etc/passwd /var/chroot/hardy-lpia/etc/
18.
sudo sed 's/\([^:]*\):[^:]*:/\1:*:/' /etc/shadow | sudo tee /var/chroot/hardy-lpia/etc/shadow
19.
sudo cp /etc/group /var/chroot/hardy-lpia/etc/
20.
sudo cp /etc/hosts /var/chroot/hardy-lpia/etc/
21.
sudo cp /etc/sudoers /var/chroot/hardy-lpia/etc/
22.
sudo chroot /var/chroot/hardy-lpia/
23.
dpkg-reconfigure passwd
24.
passwd <your-user-id>
25. apt-get install sudo
26.
echo hardy-lpia > etc/debian_chroot
27
. sudo vi /etc/dchroot.conf and add following line
host# '''sudo mount -a'''<<BR>>

== Setup userid/password in chroot ==
host# '''
sudo cp /etc/passwd /var/chroot/hardy-lpia/etc/'''<<BR>>
host# '''`
sudo sed 's/\([^:]*\):[^:]*:/\1:*:/' /etc/shadow | sudo tee /var/chroot/hardy-lpia/etc/shadow`'''<<BR>>
host# '''
sudo cp /etc/group /var/chroot/hardy-lpia/etc/'''<<BR>>
host# '''
sudo cp /etc/hosts /var/chroot/hardy-lpia/etc/'''<<BR>>
host# '''
sudo cp /etc/sudoers /var/chroot/hardy-lpia/etc/'''<<BR>>
host# '''
sudo chroot /var/chroot/hardy-lpia/'''<<BR>>
chroot# '''
dpkg-reconfigure passwd'''<<BR>>
chroot# '''
passwd <your_userid_on_your_host>'''<<BR>>
chroot# '''
echo hardy-lpia > /etc/debian_chroot'''<<BR>>
chroot# '''exit'''

== Setup final information for dchroot
.conf ==
host# '''
sudo vi /etc/dchroot.conf'''<<BR>>
''Append with the
following content''
Line 54: Line 80:
28. dchroot -c hardy-lpia -d
== Congratulations, everything is done ==
host# '''dchroot -c hardy-lpia -d'''<<BR>>
''your shall prompt shall be something like this''
{{{
(hardy-lpia)ikepanhc@laptop:~$
}}}

Summary

This wiki page is the step-by-step document for build the environment of chroot for build kernel image

Install necessary package on host

host# sudo apt-get install schroot debootstrap

Where the root of chroot is

host# sudo mkdir /var/chroot

Modify the schroot config file

host# sudo vi /etc/schroot/schroot.conf
Append the following context

[hardy-lpia]
description=Ubuntu hardy lpia 32 bit
location=/var/chroot/hardy-lpia
priority=3
users=<your_userid_on_your_host>
groups=sbuild
root-groups=root
personality=linux32

Install basic package into chroot environment

host# sudo debootstrap --variant=buildd --arch lpia hardy /var/chroot/hardy-lpia http://ports.ubuntu.com/
host# sudo cp /etc/resolv.conf /var/chroot/hardy-lpia/etc/resolv.conf
host# sudo vi /var/chroot/hardy-lpia/etc/apt/sources.list
Remove everything and add following line

deb http://ports.ubuntu.com hardy main restricted multiverse universe
deb-src http://ports.ubuntu.com hardy main restricted multiverse universe

Now you can chroot in and install more package

host# sudo chroot /var/chroot/hardy-lpia
root@chroot# apt-get install gnupg; apt-get update
root@chroot# apt-get install wget debconf devscripts dialog nano vim debhelper locales sudo kernel-wedge
root@chroot# locale-gen en_US.UTF-8
root@chroot# tzselect
root@chroot# exit

Bind several directory with chroot and host

host# sudo vi /etc/fstab
Append the following lines
Take care it will bind /home between your host and chroot environment
If you want to remove chroot environment, *umount them first*

#
# Hardy-lpia
#
/home           /var/chroot/hardy-lpia/home        none    bind            0       0
/tmp            /var/chroot/hardy-lpia/tmp         none    bind            0       0
/dev            /var/chroot/hardy-lpia/dev         none    bind            0       0
proc-chroot     /var/chroot/hardy-lpia/proc        proc    defaults        0       0
devpts-chroot   /var/chroot/hardy-lpia/dev/pts     devpts  defaults        0       0

host# sudo mount -a

Setup userid/password in chroot

host# sudo cp /etc/passwd /var/chroot/hardy-lpia/etc/
host# sudo sed 's/\([^:]*\):[^:]*:/\1:*:/' /etc/shadow | sudo tee /var/chroot/hardy-lpia/etc/shadow
host# sudo cp /etc/group /var/chroot/hardy-lpia/etc/
host# sudo cp /etc/hosts /var/chroot/hardy-lpia/etc/
host# sudo cp /etc/sudoers /var/chroot/hardy-lpia/etc/
host# sudo chroot /var/chroot/hardy-lpia/
chroot# dpkg-reconfigure passwd
chroot# passwd <your_userid_on_your_host>
chroot# echo hardy-lpia > /etc/debian_chroot
chroot# exit

Setup final information for dchroot.conf

host# sudo vi /etc/dchroot.conf
Append with the following content

hardy-lpia /var/chroot/hardy-lpia/

Congratulations, everything is done

host# dchroot -c hardy-lpia -d
your shall prompt shall be something like this

(hardy-lpia)ikepanhc@laptop:~$ 

KernelTeam/BuildKernelWithChroot (last edited 2009-11-11 07:58:25 by 210)