Download presentation
Presentation is loading. Please wait.
Published byPercival Bailey Modified over 8 years ago
1
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 - OS Kernel 2014/10/21/ 16 1
2
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Learn how to build Linux kernel image for PXA270. 2014/10/21/ 16 2
3
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Host System Windows XP Build System VirtualBox + Ubuntu 8.04 Target System Creator XScale PXA270 Software Linux for PXA270 linux-2.6.15.3-creator-pxa270.patch mkimage utility Root filesystem image (15M) You can find all software on RSWiki CSL Course Software.RSWiki CSL Course Software 2014/10/21/ 16 3
4
Lab 5 Department of Computer Science and Information Engineering National Taiwan University After the 1.0 release and prior to version 2.6, the number was composed as “A.B.C”, where the number A denoted the kernel version, the number B denoted the major revision of the kernel and the number C indicated the minor revision of the kernel. In 2004, after version 2.6.0 was released, the kernel developers no longer uses this system, instead now simply incrementing the third number, using a fourth number as necessary. In 2011, the kernel version was bumped to 3.0 for the release following 2.6.39, to commemorate the 20th anniversary of Linux. 2014/10/21/ 16 4 Reference: wikipedia – Linux kernel http://en.wikipedia.org/wiki/Linux_kernelhttp://en.wikipedia.org/wiki/Linux_kernel
5
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Step 1: download Linux source codes (mt-linux-2.6.15.3.tar.gz) for PXA270.mt-linux-2.6.15.3.tar.gz Step 2: extract the source codes. Step 3: apply the patch. % cd pxa270/create-pxa270 % wget http://eraser.csie.ntu.edu.tw/courses/csl/10201/lab5/software/linux -2.6.15.3-creator-pxa270.patch http://eraser.csie.ntu.edu.tw/courses/csl/10201/lab5/software/linux -2.6.15.3-creator-pxa270.patch % patch -p0 < linux-2.6.15.3-creator-pxa270.patch 2014/10/21/ 16 5
6
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Step 4: configure the Linux kernel (check Lab3’s arm-unknown-linux-gnu- * toolchain path in PATH). % cd../linux % make mrproper % make creator_pxa270_defconfig The “ make _defconfig ” command will create.config by the default symbol values from arch/ /configs/ _defconfig. Step 5: compile Linux kernel. % make The resulting zImage in arch/arm/boot is the compressed kernel image we want. 2014/10/21/ 16 6
7
Lab 5 Department of Computer Science and Information Engineering National Taiwan University The Linux kernel build system (Kbuild) includes support for a variety of configuration methods, the most commonly used method is: % make menuconfig Please install libncurses5-dev package in Ubuntu. Make sure your screen is large enough to display the configuration. 2014/10/21/ 16 7
8
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Many features and drivers are available as modules, and they are possible to choose whether to build features into the kernel. Please always build into the kernel, i.e.,, in our Labs. Once the kernel has been configured, you can quit the kernel configuration menu via Esc key or the Exit menu item. Choose “Yes” to save the new configuration into a new.config file. You can use “ ls -a ” to check the file. 2014/10/21/ 16 8 built-in module
9
Lab 5 Department of Computer Science and Information Engineering National Taiwan University The Creator XScale PXA270 board has 32MB flash and 64MB SDRAM. Flash memory address range: 0x00000000 to 0x02000000. SDRAM address range: 0xA0000000 to 0xA4000000. Recall that U-Boot has determined the location of kernel image. CONFIG_BOOTCOMMAND "run linux" CONFIG_LINUX bootm 80000 The locations and sizes of kernel image and root filesystem are also determined by Linux kernel (in arch/arm/mach-pxa/mach-creator- pxa270.c ). 2014/10/21/ 16 9
10
Lab 5 Department of Computer Science and Information Engineering National Taiwan University 2014/10/21/ 16 10 0xA0000000 0xA4000000 RAM U-Boot Flash 0x00000000 0x00040000 0x00080000 diag 0x00480000 0x01380000 Linux kernel 1 Root Filesystem 0x00020000 U-Boot parameters 0x02000000 0x01C00000 Linux kernel 2U-Boot 0xA3F80000
11
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Based on the memory layout, we can configure our Linux kernel. static struct mtd_partition creator_pxa270_partitions[] = {... },{ name: "Kernel", offset: 0x00080000, size: 0x00400000, // 4M mask_flags: MTD_WRITEABLE },{ name: "Filesystem", offset: 0x00480000, size: 0x00F00000, // 15M }... 2014/10/21/ 16 11
12
Lab 5 Department of Computer Science and Information Engineering National Taiwan University We use U-Boot as the bootloader on PXA270, we need to convert the OS kernel image vmlinux (which zImage is compressed by) to U-Boot bootable image ( uImage ). Step 1: get raw binary file. % arm-unknown-linux-gnu-objcopy -O binary -R.note -R.comment -S arch/arm/boot/compressed/vmlinux linux.bin Step 2: compress kernel image (optional). % gzip -9 linux.bin 2014/10/21/ 16 12
13
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Step 3: download mkimage.mkimage Step 4: add header. % chmod +x mkimage %./mkimage -A arm -O linux -T kernel -C gzip -a 0xa0008000 -e 0xa0008000 -n "CSL Lab5 Kernel" -d linux.bin.gz uImage If you skip step2, please use -C none and -d linux.bin. mkimage is in the tools folder of U-Boot source codes. You can see the mkimage usage by executing without arguments. The resulting uImage is the U-Boot image we want. 2014/10/21/ 16 13
14
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Please refer to Lab2 to copy new Linux kernel and root filesystem to flash. Step 1: download new 15M rootfs (root filesystem).rootfs Step 2: copy your uImage to flash. Step 3: copy new rootfs to flash. (take about 7 minutes) Step 4: reset PXA270, now you can see your own Linux kernel is booted (the message “CSL Lab5 Kernel”). Please use “ df -h ” to check the size of filesystem. 2014/10/21/ 16 14
15
Lab 5 Department of Computer Science and Information Engineering National Taiwan University However, the driver of the network card on PXA270 does not be configured in default Linux configuration. Please try to configure the driver and build it into your kernel. Please use “ ifconfig eth0 ” to check that your network card works. 2014/10/21/ 16 15
16
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Show that you can use “ tftp ” on your Linux kernel which has a 15M filesystem. Please hand in your lab report to the FTP. Server: 140.112.90.174 Username: csl2014 Password: csl2014HomeWork Directory: lab5 Please use this format for filename: “G# Ver#”, where G# is your group id and Ver# is revision version number. E.g., G1 Ver2 2014/10/21/ 16 16
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.