OpenWRT playground » Historial » Versió 16
Xavier León, 15-07-2011 18:12
1 | 1 | Xavier León | h1. OpenWRT playground |
---|---|---|---|
2 | |||
3 | 4 | Pau Escrich | h2. Preparing build scenario |
4 | 1 | Xavier León | |
5 | 6 | Pau Escrich | You need some packages like: gcc, make, zlib, flex, quilt, subversion and some others. Also you need to install the devel packages of each of them. But don't worry about this, during the compilation process openwrt will tell you which one is missing. |
6 | 1 | Xavier León | |
7 | 4 | Pau Escrich | First of all we are going to download the sources: |
8 | <pre> |
||
9 | svn co svn://svn.openwrt.org/openwrt/branches/backfire |
||
10 | </pre> |
||
11 | 1 | Xavier León | |
12 | 4 | Pau Escrich | A good practice is to put download directory (where all packages will be stored) outside your source directoy. By this way you can use it for more source checkouts. |
13 | 1 | Xavier León | |
14 | 4 | Pau Escrich | <pre> |
15 | cd backfire |
||
16 | mkdir ../dl |
||
17 | ln -s ../dl |
||
18 | </pre> |
||
19 | |||
20 | Let's go to install all feeds (extra packages). |
||
21 | <pre> |
||
22 | scripts/feeds update -a |
||
23 | scripts/feeds install -a |
||
24 | </pre> |
||
25 | |||
26 | And now we can start with configuration process: |
||
27 | <pre> |
||
28 | make menuconfig |
||
29 | make kernel_menuconfig |
||
30 | </pre> |
||
31 | |||
32 | menuconfig: you can select the packages you want to have inside your system installed (*) or only avaiable to install (M) |
||
33 | kernel_menuconfig: this is the standard menuconfig of the linux vanilla kernel |
||
34 | |||
35 | Then we can start compilation: |
||
36 | <pre> |
||
37 | make V=99 |
||
38 | </pre> |
||
39 | First time it can have one or more hours. |
||
40 | |||
41 | If all goes fine. You will find the images ready to install inside: bin/ARCH/openwrt-* |
||
42 | |||
43 | For instance, if you want to use squashfs image using a USB pendrive, SD or CF: |
||
44 | <pre> |
||
45 | dd if=openwrt-*-generic-combined-squashfs.img of=/dev/sdX |
||
46 | </pre> |
||
47 | |||
48 | The first time openWRT boots, you can access using telnet to change the password. |
||
49 | |||
50 | <pre> |
||
51 | 1 | Xavier León | telnet 192.168.1.1 |
52 | passwd root |
||
53 | reboot |
||
54 | 4 | Pau Escrich | </pre> |
55 | 1 | Xavier León | |
56 | 4 | Pau Escrich | After that, telnet session will disappear. Then you can use ssh to manage the device. |
57 | 1 | Xavier León | |
58 | 4 | Pau Escrich | h2. PlanetLab & OpenWRT |
59 | 5 | Pau Escrich | |
60 | 3 | Xavier León | - PlanetLab boot process mail http://lists.planet-lab.org/pipermail/devel/2006-November/001739.html |
61 | 7 | Xavier León | |
62 | Requirements: |
||
63 | Need packages: |
||
64 | * /bin/bash |
||
65 | * python |
||
66 | * perl |
||
67 | * lvm2 |
||
68 | |||
69 | Filesystem: |
||
70 | * /etc/resolv.conf cannot be a symbolic link |
||
71 | * /boot should be copied from build_dir/linux*/root.grub/boot (script in /home/xleon) |
||
72 | 8 | Xavier León | * Everything you put on <pre>~/backfire/files</pre> directory overwrites the base file system in <pre>~/backfire/build_dir/target-i386_uClibc-0.9.30.1/root-x86</pre> |
73 | 7 | Xavier León | |
74 | once copied in myplc, remember to do a sha1sum of the bootstrapfs-openwrt.... |
||
75 | 9 | Xavier León | |
76 | Problems: |
||
77 | the BootManager code needs to update the rpm database with the PLC ssh keys... but the rpm version of busybox does not allow that. |
||
78 | 10 | Xavier León | |
79 | Need to change the BootManager code. To deploy the new code, from the source tree (and once the code has been modified) just do: |
||
80 | 11 | Xavier León | <pre>make sync DEPLOYMENT=openwrt PLC=myplc.pc.ac.upc.edu</pre> |
81 | 16 | Xavier León | where `openwrt` is the deployment tag of the node and myplc.pc.ac.upc.edu (root:myplc5) is the boot server of the PLC. |
82 | 12 | Xavier León | |
83 | h3. Testing ConfineLab environment (MyPLC + virtualized node with KVM) |
||
84 | |||
85 | Objective: Run a openwrt image using the MyPLC infrastructure to create and manage nodes (bootcd, bootstrapfs and bootmanager). |
||
86 | |||
87 | Requirements: MyPLC code (http://git.onelab.eu/ bootcd, bootstrapfs, bootmanager). |
||
88 | |||
89 | Very unfinished/disorganized (to understand some things you may have need to read the documentation provided by MyPLC). |
||
90 | |||
91 | myplc.pc.ac.upc.edu (http). MyPLC deployment (ConfineLab). Accessible through http. If you want to play with it, just create a new account (below the login box, remember to associate the account to the UPC site) and I will give you admin access. |
||
92 | |||
93 | We prepared in sorma2.pc.ac.upc.edu (root:openwrt11confine) a openwrt build environment (to create openwrt custom images) and a virtual node environment to execute a node on ConfineLab (the PlanetLab/OpenWRT test environment). |
||
94 | |||
95 | 13 | Xavier León | |
96 | 12 | Xavier León | h4. Steps: |
97 | 15 | Xavier León | |
98 | 12 | Xavier León | * install virt-manager package on your PC (there are mainstream packages for ubuntu/fedora). |
99 | * connect to the libvirtd daemon in sorma2.pc.ac.upc.edu through virt-manager (it will ask for the root pass of sorma2.pc). |
||
100 | 1 | Xavier León | * start de virtual machine (called openwrt1.pc.ac.upc.edu) |
101 | 16 | Xavier León | > * sorma2.pc is configured to use a bridge interface so the virtual machine is able to get a public IP for testing (already registered on the DAC network). |
102 | 15 | Xavier León | > * this virtual machine has a bootCD attached (an image of the BootCD actually) which checks the state of the node with MyPLC. If the state is `boot`, the node will try to boot from the hard drive. If the state is `reinstall`, the node will pull a bootstrapfs (/var/www/html/boot/bootstrapfs-openwrt.tar.bz2 on myplc.pc.ac.upc.edu). |
103 | 12 | Xavier León | * This bootstrapfs is selected because in MyPLC with have defined this node with the `deployment` tag = `openwrt`. If we don't do this, it will download the regular image which is a Fedora based system already prepared for running on MyPLC (not based on openwrt). |
104 | |||
105 | h4. How to create bootstrapfs-openwrt.tar.bz2 |
||
106 | |||
107 | Read sections before `Testing ConfineLab`. |
||
108 | Once we have an image on ~/backfire/bin/x86/openwrt*, execute the script in ~/backfire/genera_imatge.sh |
||
109 | 1 | Xavier León | This script do: |
110 | 13 | Xavier León | |
111 | 12 | Xavier León | * decompresses the openwrt rootfs |
112 | * includes a boot directory with the openwrt kernel and some necessary files for the boot process to succeed (/dev/random, /dev/null, etc.). They may not be necessary in the future if we change the bootmanager behaviour. |
||
113 | * connects to myplc.pc.ac.upc.edu to put the image on the corresponding directory (/var/www/html/boot). |
||
114 | |||
115 | 1 | Xavier León | Problems so far: |
116 | 13 | Xavier León | |
117 | 12 | Xavier León | * The node's fs is installed and configured with LVM. |
118 | * Kernel Panic in the last step of the boot process (when changing from the kernel of the bootcd to the openwrt kernel). I have the impression it's something related to modules not compiled in the kernel althgouh I have compiled the kernel with LVM support in it (not as modules but inside the kernel). We may need a initrd image but I haven't found a way to create an initrd image for openwrt so far (you can create a WHOLE INITRAMDDISK, but it will not apply changes to the HD). |
||
119 | |||
120 | Maybe we should change how the bootmanager manages the partition. |
||
121 | |||
122 | h4. If you need to change the bootmanager code |
||
123 | |||
124 | Within your source tree (pulled from the git repo), change whatever you want and do: |
||
125 | |||
126 | To deploy the new code, from the source tree (and once the code has been modified) just do: |
||
127 | <pre>make sync DEPLOYMENT=openwrt PLC=myplc.pc.ac.upc.edu</pre> |
||
128 | 1 | Xavier León | where `openwrt` is the deployment tag of the node and myplc.pc.ac.upc.edu is the boot server of the PLC. |
129 | |||
130 | 16 | Xavier León | h4. Remember! IMPORTANT!!!!! |
131 | |||
132 | 1. If you change the bootstrapfs the node has to use, you need to set it as reinstall on the MyPLC web interface.1 |
||
133 | 2. If you need to change the bootmanager, take it from / |