164 | | = Detail = |
165 | | |
166 | | The CAN simulation environment is based on QEMU-1.4.2, you can download it from https://github.com/Jin-Yang/QEMU-1.4.2 or get a copy using the following command(Linux) |
| 164 | = Building a Minimal Linux Environment in Qemu = |
| 165 | |
| 166 | The purpose of starting with a minimal Linux (as opposed to RTEMS) environment in qemu is the software configurations have been more thoroughly tested and documented. The first phase of the project should start out using the last stable release... unless it's minor digit is a 0... usually the minor digit being anything above a 0 means the free and open source software FOSS had some bug-fix releases. |
| 167 | = CAN project example = |
| 168 | |
| 169 | The section below is largely based upon http://jin-yang.github.io/2013/07/24/build-minimal-linux-environment.html by Jin-Yang during the summer of 2013. |
| 170 | The CAN simulation environment is based on QEMU-1.4.2, because 1.5.0 was just released, and we wanted a solid starting point. |
| 171 | |
| 172 | ''NOTE: before you compile QEMU, "libglib2-dev" should be installed, or you will get the error "ERROR: glib-2.12 required to compile QEMU". In Ubuntu, we use command "sudo apt-get install libglib2-dev" to do that.'' |
| 173 | You can download the qemu-can project from https://github.com/Jin-Yang/QEMU-1.4.2 or get a copy using the following command(Linux). |
| 174 | |
| 175 | First, we should configure QEMU using the following command, this will take about two minutes. |
168 | | Then you can build it through |
169 | | ./configure --prefix=/opt/qemu --target-list="i386-softmmu" --enable-sdl && make && make install |
| 177 | |
| 178 | QEMU has two modes to simulate a platform, the user mode and the system mode. We only need the i386 system simulation environment here, so only system mode (i386-softmmu) is needed. In order to save time, we just compile the source-code that relates to i386-softmmu.[http://jin-yang.github.io/2013/07/24/build-minimal-linux-environment html [1<nowiki>]</nowiki>]. For simplicity of coding, we select the hard-coded --prefix=/opt/qemu so we can write scripts assuming that's where our installed qemu is. |
| 179 | |
| 180 | ./configure --prefix=/opt/qemu --target-list="i386-softmmu" --enable-sdl && make && sudo make install |
| 181 | |
| 182 | * --prefix: specify the location where you want to install. |
| 183 | * --target-list: the platform you want to simulation, here we only need the i386-softmmu. |
| 184 | * --enable-sdl: we also need the sdl (Simple DirectMedia Layer) support. |
| 185 | |
| 186 | To call the just installed qemu you can add ''/opt/qemu/bin'' to the PATH environment variable or just use ''/opt/qemu/bin/qemu-system-i386'' to start QEMU. |