1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
5 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
6 <meta name="author" content="Frederik Vanrenterghem" />
7 <meta name="Description" content="Personal homepage - GNU/Linux stuff - Installing Debian on A20 development board" />
8 <title>vanrenterghem.biz - GNU/Linux - Debian armhf on A20-OLinuXino-Lime2</title>
9 <link rel="stylesheet" href="/styles/header.css" type="text/css" />
10 <link rel="stylesheet" href="/styles/main.css" type="text/css" />
13 <!--#include virtual='/header.shtml' -->
15 <h1>Installing Debian GNU/Linux to your A20-OLinuXino-Lime2.</h1>
17 So you bought an open hardware <a href="https://www.olimex.com/wiki/A20-OLinuXino-LIME2">Lime2 board</a>, and
18 now would like to install Debian on it, without resorting to pre-compiled images offered on the Olimex wiki. Since
19 February 2015, this is actually possible using Debian-provided binaries.
21 <h2>Prepare u-boot</h2>
23 Easiest is to use <a href="http://ftp.au.debian.org/debian/pool/main/u/u-boot/u-boot-sunxi_2014.10+dfsg1-4_armhf.deb">u-boot from unstable</a>, and extract <code>/usr/lib/u-boot/A20-OLinuXino-Lime2/u-boot-sunxi-with-spl.bin</code> from it.
24 Alternatively, you will need to cross-compile u-boot for your A20 board on your Debian GNU/Linux box. The needed architecture
25 for this processor is armhf.
29 sudo dpkg --add-architecture armhf<br />
31 sudo apt-get install crossbuild-essential-armhf<br />
34 Download the <a href="ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2">latest release of u-boot</a>,
35 at the time of writing <a href="ftp://ftp.denx.de/pub/u-boot/u-boot-2015.01.tar.bz2">u-boot-2015.01</a>.
36 This version already supports everything needed to get Debian on your Lime2 using an SD card, USB stick and
37 a network install of the OS. We will install Debian (and u-boot) to the SD card. The USB stick is only used
38 during the installation process, and can be re-used for other purposes once all is done. (As of April 2015, it
39 is also possible to do without an USB stick altogether and install from an SD card.)
42 Compile u-boot as follows:
46 make A20-OLinuXino-Lime2_config ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-<br />
47 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
50 <h2>Copy u-boot to an SD card</h2>
52 Copy the compiled or extracted u-boot image to your micro SD card. No need for partitioning it - one VFAT or ext2 partition should do.
56 sudo dd if=~/Downloads/u-boot-2015.01/u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1024 seek=8
59 <h2>Prepare the Debian Installer</h2>
61 At the time of writing, the weekly images of the CD build are broken, so the <a href="https://wiki.debian.org/InstallingDebianOn/Allwinner#Installing_from_a_USB_stick">excellent tutorial on installing Debian on the Allwinner</a> cannot be fully followed. Instead, unpack the <a href="http://d-i.debian.org/daily-images/armhf/daily/hd-media/hd-media.tar.gz">hd-media image of d-i</a>
62 on your USB stick. Next, download 2 files.
65 wget http://d-i.debian.org/daily-images/armhf/daily/netboot/vmlinuz<br />
66 wget http://d-i.debian.org/daily-images/armhf/daily/netboot/initrd.gz<br />
69 and overwrite the copy of <code>vmlinuz</code> on the USB stick with this one.
72 We will modify the initrd.gz image slightly.
73 Since you may not have a console cable, it's useful to perform the install using preseeding. This way, the Debian
74 installer will get its answers from a file instead of through your input. I opted to automate as many answers as possible,
75 except for the partitioning. These can be answered by logging in to the installer using SSH. It's truly an awesome,
79 First, create <code>preseed.cfg</code>. For Debian Jessie, the following file will work.
84 #### Contents of the preconfiguration file (for jessie)<br />
85 ### Localization<br />
86 # Preseeding only locale sets language, country and locale.<br />
87 d-i debian-installer/locale string en_AU<br />
89 # The values can also be preseeded individually for greater flexibility.<br />
90 #d-i debian-installer/language string en<br />
91 #d-i debian-installer/country string NL<br />
92 #d-i debian-installer/locale string en_GB.UTF-8<br />
94 # Keyboard selection.<br />
95 d-i keyboard-configuration/xkb-keymap select au<br />
96 # d-i keyboard-configuration/toggle select No toggling<br />
98 ### Network configuration<br />
99 # netcfg will choose an interface that has link if possible. This makes it<br />
100 # skip displaying a list if there is more than one interface.<br />
101 d-i netcfg/choose_interface select auto<br />
103 # To pick a particular interface instead:<br />
104 #d-i netcfg/choose_interface select eth1<br />
106 # To set a different link detection timeout (default is 3 seconds).<br />
107 # Values are interpreted as seconds.<br />
108 #d-i netcfg/link_wait_timeout string 10<br />
110 # If you have a slow dhcp server and the installer times out waiting for<br />
111 # it, this might be useful.<br />
112 #d-i netcfg/dhcp_timeout string 60<br />
113 #d-i netcfg/dhcpv6_timeout string 60<br />
115 # If you prefer to configure the network manually, uncomment this line and<br />
116 # the static network configuration below.<br />
117 d-i netcfg/disable_autoconfig boolean true<br />
119 # If you want the preconfiguration file to work on systems both with and<br />
120 # without a dhcp server, uncomment these lines and the static network<br />
121 # configuration below.<br />
122 #d-i netcfg/dhcp_failed note<br />
123 #d-i netcfg/dhcp_options select Configure network manually<br />
125 # Static network configuration.<br />
128 d-i netcfg/get_ipaddress string 192.168.2.10<br />
129 d-i netcfg/get_netmask string 255.255.255.0<br />
130 d-i netcfg/get_gateway string 192.168.2.1<br />
131 d-i netcfg/get_nameservers string 192.168.2.1<br />
132 d-i netcfg/confirm_static boolean true<br />
134 # Any hostname and domain names assigned from dhcp take precedence over<br />
135 # values set here. However, setting the values still prevents the questions<br />
136 # from being shown, even if values come from dhcp.<br />
137 d-i netcfg/get_hostname string YOURHOSTNAME<br />
138 d-i netcfg/get_domain string YOURDOMAIN.TLD<br />
140 # If you want to force a hostname, regardless of what either the DHCP<br />
141 # server returns or what the reverse DNS entry for the IP is, uncomment<br />
142 # and adjust the following line.<br />
143 #d-i netcfg/hostname string somehost<br />
145 # Disable that annoying WEP key dialog.<br />
146 d-i netcfg/wireless_wep string<br />
147 # The wacky dhcp hostname that some ISPs use as a password of sorts.<br />
148 #d-i netcfg/dhcp_hostname string radish<br />
150 # If non-free firmware is needed for the network or other hardware, you can<br />
151 # configure the installer to always try to load it, without prompting. Or<br />
152 # change to false to disable asking.<br />
153 d-i hw-detect/load_firmware boolean true<br />
155 ### Network console<br />
156 # Use the following settings if you wish to make use of the network-console<br />
157 # component for remote installation over SSH. This only makes sense if you<br />
158 # intend to perform the remainder of the installation manually.<br />
159 d-i anna/choose_modules string network-console<br />
160 #d-i network-console/authorized_keys_url string http://10.0.0.1/openssh-key<br />
161 d-i network-console/password password STRONGPASSWORD<br />
162 d-i network-console/password-again password STRONGPASSWORD<br />
164 ### Mirror settings<br />
165 # If you select ftp, the mirror/country string does not need to be set.<br />
166 #d-i mirror/protocol string ftp<br />
167 d-i mirror/country string Australia<br />
168 d-i mirror/http/hostname string ftp.au.debian.org<br />
169 d-i mirror/http/directory string /debian<br />
170 d-i mirror/http/proxy string<br />
172 # Suite to install.<br />
173 d-i mirror/suite string testing<br />
174 # Suite to use for loading installer components (optional).<br />
175 #d-i mirror/udeb/suite string testing<br />
177 ### Account setup<br />
178 # Skip creation of a root account (normal user account will be able to<br />
180 #d-i passwd/root-login boolean false<br />
181 # Alternatively, to skip creation of a normal user account.<br />
182 #d-i passwd/make-user boolean false<br />
184 # Root password, either in clear text<br />
185 d-i passwd/root-password password VERYSTRONG<br />
186 d-i passwd/root-password-again password VERYSTRONG<br />
187 # or encrypted using an MD5 hash.<br />
188 #d-i passwd/root-password-crypted password [MD5 hash]<br />
190 # To create a normal user account.<br />
191 d-i passwd/user-fullname string Your Full Name<br />
192 d-i passwd/username string yoursystemname<br />
193 # Normal user's password, either in clear text<br />
194 d-i passwd/user-password password REALLYSTRONG<br />
195 d-i passwd/user-password-again password REALLYSTRONG<br />
196 # or encrypted using an MD5 hash.<br />
197 #d-i passwd/user-password-crypted password [MD5 hash]<br />
198 # Create the first user with the specified UID instead of the default.<br />
199 #d-i passwd/user-uid string 1010<br />
201 # The user account will be added to some standard initial groups. To<br />
202 # override that, use this.<br />
203 #d-i passwd/user-default-groups string audio cdrom video<br />
205 ### Clock and time zone setup<br />
206 # Controls whether or not the hardware clock is set to UTC.<br />
207 d-i clock-setup/utc boolean true<br />
209 # You may set this to any valid setting for $TZ; see the contents of<br />
210 # /usr/share/zoneinfo/ for valid values.<br />
211 d-i time/zone string Australia/Perth<br />
213 # Controls whether to use NTP to set the clock during the install<br />
214 d-i clock-setup/ntp boolean true<br />
215 # NTP server to use. The default is almost always fine here.<br />
216 #d-i clock-setup/ntp-server string ntp.example.com<br />
218 ### Partitioning<br />
220 ## Partitioning example<br />
221 # If the system has free space you can choose to only partition that space.<br />
222 # This is only honoured if partman-auto/method (below) is not set.<br />
223 #d-i partman-auto/init_automatically_partition select biggest_free<br />
225 # Alternatively, you may specify a disk to partition. If the system has only<br />
226 # one disk the installer will default to using that, but otherwise the device<br />
227 # name must be given in traditional, non-devfs format (so e.g. /dev/hda or<br />
228 # /dev/sda, and not e.g. /dev/discs/disc0/disc).<br />
229 # For example, to use the first SCSI/SATA hard disk:<br />
230 #d-i partman-auto/disk string /dev/sda<br />
231 # The SD card of your OLinuXino-Lime2 will probably be mmcblk0<br />
232 #d-i partman-auto/disk string /dev/mmcblk0<br />
234 # In addition, you'll need to specify the method to use.<br />
235 # The presently available methods are:<br />
236 # - regular: use the usual partition types for your architecture<br />
237 # - lvm: use LVM to partition the disk<br />
238 # - crypto: use LVM within an encrypted partition<br />
239 #d-i partman-auto/method string lvm<br />
241 # If one of the disks that are going to be automatically partitioned<br />
242 # contains an old LVM configuration, the user will normally receive a<br />
243 # warning. This can be preseeded away...<br />
244 #d-i partman-lvm/device_remove_lvm boolean true<br />
245 # The same applies to pre-existing software RAID array:<br />
246 #d-i partman-md/device_remove_md boolean true<br />
247 # And the same goes for the confirmation to write the lvm partitions.<br />
248 #d-i partman-lvm/confirm boolean true<br />
249 #d-i partman-lvm/confirm_nooverwrite boolean true<br />
251 # You can choose one of the three predefined partitioning recipes:<br />
252 # - atomic: all files in one partition<br />
253 # - home: separate /home partition<br />
254 # - multi: separate /home, /var, and /tmp partitions<br />
255 #d-i partman-auto/choose_recipe select atomic<br />
257 # This makes partman automatically partition without confirmation, provided<br />
258 # that you told it what to do using one of the methods above.<br />
259 #d-i partman-partitioning/confirm_write_new_label boolean true<br />
260 #d-i partman/choose_partition select finish<br />
261 #d-i partman/confirm boolean true<br />
262 #d-i partman/confirm_nooverwrite boolean true<br />
265 # This makes partman automatically partition without confirmation.<br />
266 #d-i partman-md/confirm boolean true<br />
267 #d-i partman-partitioning/confirm_write_new_label boolean true<br />
268 #d-i partman/choose_partition select finish<br />
269 #d-i partman/confirm boolean true<br />
270 #d-i partman/confirm_nooverwrite boolean true<br />
272 ## Controlling how partitions are mounted<br />
273 # The default is to mount by UUID, but you can also choose "traditional" to<br />
274 # use traditional device names, or "label" to try filesystem labels before<br />
275 # falling back to UUIDs.<br />
276 d-i partman/mount_style select uuid<br />
278 ### Base system installation<br />
279 # Configure APT to not install recommended packages by default. Use of this<br />
280 # option can result in an incomplete system and should only be used by very<br />
281 # experienced users.<br />
282 #d-i base-installer/install-recommends boolean false<br />
284 # The kernel image (meta) package to be installed; "none" can be used if no<br />
285 # kernel is to be installed.<br />
286 #d-i base-installer/kernel/image string linux-image-586<br />
289 # You can choose to install non-free and contrib software.<br />
290 #d-i apt-setup/non-free boolean true<br />
291 #d-i apt-setup/contrib boolean true<br />
292 # Uncomment this if you don't want to use a network mirror.<br />
293 #d-i apt-setup/use_mirror boolean false<br />
294 # Select which update services to use; define the mirrors to be used.<br />
295 # Values shown below are the normal defaults.<br />
296 d-i apt-setup/services-select multiselect security, updates<br />
297 d-i apt-setup/security_host string security.debian.org<br />
299 # Additional repositories, local[0-9] available<br />
300 #d-i apt-setup/local0/repository string \<br />
301 # http://local.server/debian stable main<br />
302 #d-i apt-setup/local0/comment string local server<br />
303 # Enable deb-src lines<br />
304 #d-i apt-setup/local0/source boolean true<br />
305 # URL to the public key of the local repository; you must provide a key or<br />
306 # apt will complain about the unauthenticated repository and so the<br />
307 # sources.list line will be left commented out<br />
308 #d-i apt-setup/local0/key string http://local.server/key<br />
310 # By default the installer requires that repositories be authenticated<br />
311 # using a known gpg key. This setting can be used to disable that<br />
312 # authentication. Warning: Insecure, not recommended.<br />
313 #d-i debian-installer/allow_unauthenticated boolean true<br />
315 ### Package selection<br />
316 tasksel tasksel/first multiselect standard<br />
318 # Individual additional packages to install<br />
319 d-i pkgsel/include string openssh-server<br />
320 # Whether to upgrade packages after debootstrap.<br />
321 # Allowed values: none, safe-upgrade, full-upgrade<br />
322 d-i pkgsel/upgrade select none<br />
324 # Some versions of the installer can report back on what software you have<br />
325 # installed, and what software you use. The default is not to report back,<br />
326 # but sending reports helps the project determine what software is most<br />
327 # popular and include it on CDs.<br />
328 popularity-contest popularity-contest/participate boolean false<br />
330 ### Boot loader installation<br />
331 # Grub is the default boot loader (for x86). If you want lilo installed<br />
332 # instead, uncomment this:<br />
333 #d-i grub-installer/skip boolean true<br />
334 # To also skip installing lilo, and install no bootloader, uncomment this<br />
336 #d-i lilo-installer/skip boolean true<br />
339 # This is fairly safe to set, it makes grub install automatically to the MBR<br />
340 # if no other operating system is detected on the machine.<br />
341 d-i grub-installer/only_debian boolean true<br />
343 # This one makes grub-installer install to the MBR if it also finds some other<br />
344 # OS, which is less safe as it might not be able to boot that other OS.<br />
345 d-i grub-installer/with_other_os boolean true<br />
347 # Due notably to potential USB sticks, the location of the MBR can not be<br />
348 # determined safely in general, so this needs to be specified:<br />
349 #d-i grub-installer/bootdev string /dev/sda<br />
350 # To install to the first device (assuming it is not a USB stick):<br />
351 #d-i grub-installer/bootdev string default<br />
353 # Alternatively, if you want to install to a location other than the mbr,<br />
354 # uncomment and edit these lines:<br />
355 #d-i grub-installer/only_debian boolean false<br />
356 #d-i grub-installer/with_other_os boolean false<br />
357 #d-i grub-installer/bootdev string (hd0,1)<br />
358 # To install grub to multiple disks:<br />
359 #d-i grub-installer/bootdev string (hd0,1) (hd1,1) (hd2,1)<br />
361 # Optional password for grub, either in clear text<br />
362 #d-i grub-installer/password password r00tme<br />
363 #d-i grub-installer/password-again password r00tme<br />
364 # or encrypted using an MD5 hash, see grub-md5-crypt(8).<br />
365 #d-i grub-installer/password-crypted password [MD5 hash]<br />
367 # Use the following option to add additional boot parameters for the<br />
368 # installed system (if supported by the bootloader installer).<br />
369 # Note: options passed to the installer will be added automatically.<br />
370 #d-i debian-installer/add-kernel-opts string nousb<br />
372 ### Finishing up the installation<br />
373 # During installations from serial console, the regular virtual consoles<br />
374 # (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next<br />
375 # line to prevent this.<br />
376 d-i finish-install/keep-consoles boolean true<br />
378 # Avoid that last message about the install being complete.<br />
379 d-i finish-install/reboot_in_progress note<br />
384 Next, add your <code>preseed.cfg</code> to the downloaded initrd.gz
387 mkdir /tmp/initrd && cd /tmp/initrd<br />
388 gzip -d < ~/Downloads/initrd.gz |cpio --extract --verbose --make-directories --no-absolute-filenames</br />
389 cp ~/preseed.cfg .</br />
390 find . | cpio -H newc --create --verbose | gzip -9 > ../initrd.gz<br />
393 Copy the new initrd.gz to your USB stick.
395 <h2>Install Debian on your Lime2</h2>
397 If you want to follow along on a console (not really necessary, but easier to debug things this way.)
400 sudo apt-get install minicom
401 sudo minicom --device /dev/ttyUSB0
404 Now plug in the micro SD card as well as the USB stick and power up your Lime2. After a little while, you will
405 be able to <code>ssh installer@192.168.2.10</code> with your chosen password to set up the partitions. A while later,
406 your Lime2 will be ready to use!
409 <h2>Installing wireless</h2>
411 I purchased a USB Wireless N WIFI dongle based on an Atheros chip. At the moment, this is the only chipset with
412 a free firmware implementation supporting 802.11n. Please consider doing the same, to ensure this technology remains
413 available for customers.
416 <a href="https://wiki.debian.org/ath9k_htc/open_firmware">Build and install the firmware as explained on the Debian wiki.</a>
417 This will take a while, as the whole toolchain to build the firmware will be compiled for some reason.
420 Once you've installed the compiled firmware as explained, plug in the wifi dongle. The firmware will be
421 loaded automatically.
424 <h2>Configuring your Lime2 as a wireless access point</h2>
426 Given the total lack of support for free software on ADSL2 modems, I have a very simple one and use my Lime2
427 board as wireless router. This instead of acquiring an expensive modem/router combo running proprietary software. The combined price is equivalent, and I have an option of installing some other software on the Lime2 too. Too bad one needs to ringfence an ADSL2 modem in your own house as if it's part of the internet, but that seems to be today's reality.
430 On the Lime2, install the following:
434 sudo apt-get install iw wireless-tools hostapd isc-dhcp-server<br />
437 Edit 3 files as in the examples below.<br />
440 <h3>/etc/network/interfaces</h3>
444 iface wlan0 inet static<br />
445 address 192.168.3.1<br />
446 netmask 255.255.255.0<br />
447 hostapd /etc/hostapd/hostapd.conf<br />
449 <h3>/etc/hostapd/hostapd.conf</h3>
452 interface=wlan0<br />
457 # 802.11n support<br />
461 # set country code<br />
462 country_code=AU<br />
467 wpa_passphrase=PASSPHRASE<br />
468 wpa_key_mgmt=WPA-PSK<br />
469 wpa_pairwise=TKIP CCMP<br />
470 wpa_ptk_rekey=600<br />
474 <h3>/etc/dhcp/dhcpd.conf</h3>
476 To configure your DHCP server, get your <a href="http://www.opennicproject.org/nearest-servers/">OpenNic DNS servers in the area</a> - most of the server operators respect your privacy by not maintaining logs.
480 subnet 192.168.3.0 netmask 255.255.255.0 {<br />
481 range 192.168.3.20 192.168.3.100;<br />
482 option domain-name-servers 103.25.56.238, 111.223.227.125;<br />
483 option routers 192.168.3.1;<br />
484 interface wlan0;<br />
489 Restart networking & start the DHCP server, or reboot the system and you should be good to go.
491 <!--#include virtual='/footer.shtml' -->