1 | | Debwrt is developed on Debian systems and alike systems as Ubuntu. |
2 | | |
3 | | This page about building / developing on ''[http://en.wikipedia.org/wiki/Xeno Xeno] systems''. |
4 | | It describes how to setup a ''chroot environment'' for doing so. |
5 | | |
6 | | = Prerequisites & Assumptions = |
7 | | |
8 | | * You have an up to date development system |
9 | | * You know your way around the system |
10 | | * You have a lot of patience |
11 | | * You want your DebWrt router to be Debian Squeeze based |
12 | | |
13 | | = Debootstrap = |
14 | | |
15 | | Download current release of debootstrap. |
16 | | {{{ |
17 | | cd ~ |
18 | | wget http://ftp.us.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.26_all.deb |
19 | | }}} |
20 | | |
21 | | Unpack the archive |
22 | | {{{ |
23 | | cd / |
24 | | ar p ~/debootstrap_1.0.26_all.deb data.tar.gz | tar zx |
25 | | }}} |
26 | | |
27 | | Now you should have access to debootstrap. Make sure it works: |
28 | | {{{ |
29 | | # sudo debootstrap --version |
30 | | root's password: |
31 | | debootstrap 1.0.26 |
32 | | }}} |
33 | | |
34 | | If not - make sure you have {{{/usr/sbin}}} added to your PATH variable. |
35 | | |
36 | | = Create your build environment = |
37 | | |
38 | | Go somewhere you have few spare GB of disk space and set up your build environment there. |
39 | | For me it was {{{/srv/krystian/x}}} so if you see this path somewhere in my listings, know this is path to my build directory. |
40 | | To make things easier let's just assign a variable name to it: {{{DEBWRT_BUILD}}} |
41 | | {{{ |
42 | | export DEBWRT_BUILD=/path/to/your/build/dir |
43 | | }}} |
44 | | |
45 | | Create the build environment: |
46 | | {{{ |
47 | | sudo debootstrap --arch=amd64 squeeze $DEBWRT_BUILD |
48 | | }}} |
49 | | You might want to adjust the --arch parameter to suite your architecture. |
50 | | Please note that Debian uses amd64 name for x86_64 architecture. |
51 | | After a moment you should have your build environment created. |
52 | | |
53 | | = Configure the environment = |
54 | | |
55 | | First thing to do is to chroot to your new environment and set your locale to C. |
56 | | |
57 | | {{{ |
58 | | sudo chroot $DEBWRT_BUILD |
59 | | export LANG=C |
60 | | mount -t proc proc /proc |
61 | | }}} |
62 | | |
63 | | == Installing required packages == |
64 | | |
65 | | Install few packages which are needed during the build. Please note, there are probably packages missing from this listing, |
66 | | so in case you get an error somewhere down the road about something missing... install it. |
67 | | If you get an error saying a package is not found, just use aptitude and search for it as there might be a typo. |
68 | | |
69 | | {{{ |
70 | | apt-get install sudo fakeroot gawk python unzip \ |
71 | | flex zlibc build-essential libncurses5-dev subversion \ |
72 | | zlib1g-dev git debootstrap |
73 | | }}} |
74 | | You will be asked whether you want to install from unverified source. Answer yes. |
75 | | |
76 | | {{{ |
77 | | apt-get install makedev |
78 | | }}} |
79 | | |
80 | | You might get few strange messages after installing makedev, like: |
81 | | {{{ |
82 | | Can not write log, openpty() failed (/dev/pts not mounted?) |
83 | | Setting up makedev (2.3.1-89) ... |
84 | | .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. |
85 | | .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. |
86 | | .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. |
87 | | .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. |
88 | | .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. |
89 | | .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. |
90 | | .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. |
91 | | .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. |
92 | | .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. |
93 | | .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. |
94 | | .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. |
95 | | .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. |
96 | | }}} |
97 | | Just ignore them. |
98 | | |
99 | | |
100 | | == Add and configure a user == |
101 | | |
102 | | Now add a user, which will be used during the build process |
103 | | {{{ |
104 | | # adduser debwrt |
105 | | Adding user `debwrt' ... |
106 | | Adding new group `debwrt' (1002) ... |
107 | | Adding new user `debwrt' (1002) with group `debwrt' ... |
108 | | Creating home directory `/home/debwrt' ... |
109 | | Copying files from `/etc/skel' ... |
110 | | Enter new UNIX password: |
111 | | Retype new UNIX password: |
112 | | passwd: password updated successfully |
113 | | Changing the user information for debwrt |
114 | | Enter the new value, or press ENTER for the default |
115 | | Full Name []: |
116 | | Room Number []: |
117 | | Work Phone []: |
118 | | Home Phone []: |
119 | | Other []: |
120 | | Is the information correct? [Y/n] |
121 | | }}} |
122 | | |
123 | | Password doesn't really matter, since we will never use it. |
124 | | Now it's time to allow our user to use sudo without password. |
125 | | You can use {{{visudo}}} to add this line to the file: |
126 | | {{{ |
127 | | debwrt ALL=NOPASSWD: ALL |
128 | | }}} |
129 | | |
130 | | Since we will be working in /usr/src directory, we want to make sure our user has proper rights in this directory. |
131 | | Since this is a chrooted env used only for build purposes I am just going to change owner: |
132 | | |
133 | | {{{ |
134 | | chown -R debwrt /usr/src |
135 | | }}} |
136 | | |
137 | | == Build DebWrt == |
138 | | |
139 | | Change user to debwrt and download DebWrt sources: |
140 | | |
141 | | {{{ |
142 | | su debwrt |
143 | | cd /usr/src |
144 | | svn checkout https://svn.debwrt.net/debwrt/trunk debwrt |
145 | | cd debwrt |
146 | | }}} |
147 | | |
148 | | You will probably want to change the device for which we are going to build the release, so: |
149 | | {{{ |
150 | | make menuconfig |
151 | | }}} |
152 | | |
153 | | and adjust DebWrt settings to your needs. I am not gonig to cover in here any particular settings. |
154 | | There are other wiki pages which cover all of that. What we want to achieve here is a proper build with no customizations. |
155 | | |
156 | | After you set everything up: |
157 | | |
158 | | {{{ |
159 | | make |
160 | | }}} |
161 | | |
162 | | This should take a little bit of time and you should end up with an output like: |
163 | | |
164 | | {{{ |
165 | | Make DebWrt completed |
166 | | |
167 | | DEBWRTVERSION : angel - 2.0-1 - [ 20 February 2011 (r174) ] |
168 | | TARGET_ARCH : mips |
169 | | BOARD : ar71xx |
170 | | SUB_BOARD : generic_WNDR3700 |
171 | | LINUX_VERSION : (default) |
172 | | }}} |
173 | | |
174 | | And you are done. |
175 | | If there was something wrong with the build, maybe there's something you have to install or check current tickets on DebWrt for known issues. |
176 | | |
177 | | = Feedback = |
178 | | |
179 | | Here some notes ... |
180 | | |
181 | | == Why this page? == |
182 | | |
183 | | This wiki page was original created for ticket #76 and #77 |
184 | | |
185 | | == Why chroot, why not full virtualization? == |
186 | | |
187 | | Build debwrt is a heavy task, you don't want do that in a virtual server. |
188 | | But if you have enough CPU power, |
189 | | a VM is another way to get a Debian build host. |
190 | | |
191 | | == Succes stories == |
192 | | |
193 | | * OpenSUSE x86_64 build for Netgear WNDR3700 v2, february 20th 2011 |
194 | | * ..., ... |
195 | | * your system here, date |
196 | | |
197 | | |
198 | | See also SmallSteps |
| 1 | Unbelievable how well-written and inofarmtvie this was. |