1 / 46

The 4 th Linux Seminar Firmware in Linux

The 4 th Linux Seminar Firmware in Linux. http://alpha.secsm.org. Mar 26, 2000 ssmLUG Byungsoo Jung. What ’ s the Firmware?. BIOS Low Level, Loading the OS kernel. Monitor Program As a part of BIOS mainboard debuging OS Kernel Monolithic in Linux Currently micro kernel.

zarek
Download Presentation

The 4 th Linux Seminar Firmware in Linux

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The 4th Linux SeminarFirmware in Linux http://alpha.secsm.org Mar 26, 2000 ssmLUG Byungsoo Jung

  2. What’s the Firmware? • BIOS • Low Level, Loading the OS kernel. • Monitor Program • As a part of BIOS • mainboard debuging • OS Kernel • Monolithic in Linux • Currently micro kernel

  3. Developing Tools • GAS와 Binutils • GNU Assembler and Binary utilities • NASM • Free Assembler for i86 • GCC • GNU C compiler • I386,Alpha,PowerPC,MIPS,ARM,M68K

  4. Simple GAS source code • Get the Assembly source code from C source code • % gcc –S hello.c • Compile with GAS • % as –o hello.o hello.S • Get the executabable file with GCC • % gcc –o hello hello.o

  5. .file "hello.c" .version "01.01" gcc2_compiled.: .section .rodata .LC0: .string "Hello World!\n" .text .align 4 .globl main .type main,@function main: pushl %ebp movl %esp,%ebp pushl $.LC0 call printf addl $4,%esp .L1: leave ret .Lfe1: .size main,.Lfe1-main

  6. Simple GAS example # # File : hello.S # Author : ByungsooJung # Date : Aug 8, 1999 # .data # section declaration msg: .string "Hello, world!" # our dear string msgend: .equ len, msgend - msg # length of our dear string .text # section declaration # we must export the entry point to the ELF linker or .global _start # loader. They conventionally recognize _start as their # entry point. Use ld -e hello to override the default.

  7. _start: # write our string to stdout movl$4, %eax# system call number (sys_write) movl$1, %ebx# first argument: file handle (stdout) movl$msg, %ecx# second argument: pointer to message to write movl$len, %edx# third argument: message length int $0x80 # INT 80h # and exit movl$1,%eax# system call number (sys_exit) xorl%ebx,%ebx# first syscallargument: exit code int $0x80 # INT 80h

  8. Making CrossGCC • Patch packages for the CrossGCC • Configure for CrossGCC • Make CrossGCC with Makefile • Installing CrossGCC

  9. CrossGCC for ARM • Binutils for ARM • # tar zxvf binutils-2.9.5.0.24.tar.gz • # cd bintutils-2.9. 5.0.24 • # export CC=/usr/bin/gcc • # configure –target=arm-linux • # make • # make install

  10. CrossGCC for ARM • GCC for ARM • # export CC=/usr/bin/gcc • # tar zxvf gcc-core-2.95.1.tar.gz • # cd gcc-core-2.95.1 • # gzip –d gcc-2.95-diff-990730.gz • # patch –p0 < gcc-2.95-diff-990730 • # configure –target=arm-linux • # make • # make install

  11. BIOS : Alpha MILO and OpenBIOS • Alpha MILO • Introduction on the Alpha MILO • OpenBIOS Project • Overview on the OpenBIOS Project

  12. II. Monitor Program : PROM for MIPS • PROM Monitor Program : PROM • Serial Monitoring and Program Downloading • Ethernet Monitoring and Program Downloading

  13. III. Embedded Linux Kernel : ELKS • Embedded Linux Kernel : ELKS • Introduction on ELKS • ELKS Kernel Structure • ELKS Device Driver

  14. I. BIOS Alpha MILO와 OpenBIOS ssmLUG Byungsoo Jung http://alpha.secsm.org

  15. Alpha MILO

  16. Alpha MILO’s History • At 1993, Jim Paradis in Alpha Migration Tools Group had a project Linux porting on Alpha AXP • At 1994, John Hall, senior manager, gave the Jensen to Linus Torvals • At 1994, Dave Rusling made MILO bootloader for Alpha • Now, Jay Easterbrook porting XFree86 to the Alpha Linux

  17. What’s the MILO? • MILO’s function • PALcode • Memory Setup code • Video Code • Linux kernel code • File System support (ext2, fat, iso9660) • User interface code • Kernel interface code • NVRAM code

  18. MILO’s structure • Two part • System indepent part : MILO • Most System dependt part : PALcode • Code • MILo core : about 24,000 lines • PALcode : about 1,1000 lines • X86 emulation : about 1,6000 lines • Etc : about 40,000 lines

  19. Alpha’s history • At 1988, Dick Sites and Rich Witek had a project designing Alpha Architecture • They predicted it would be a 64bit world in the future • They created Alpha architecture in the long peorid more than 10 years

  20. PALcode’s history • New Architecture -> New Instruction? • They solved this problem with PALcode. • PALcode is like software emulation • FX32 : x86 emulator • Freeport Express : sparc emulator

  21. PALcode’s structure • Power-Up Initialization • Memory management control • Interuppt and exception control • Privileged instructions • VAX and x86 instruction emulation

  22. Making PALcode

  23. PALcode’s Image

  24. MILO’s image

  25. MILO Loading • Loading MILO from System firmware • Windows NT ARC Firmware • SRM Console • Loading MILO from Debug monitor • Loading MILo from Flash

  26. OpenBIOS

  27. OpenBIOS Project • OpenBIOS Project : x86 BIOS for PC • http://www.freiburg.linux.de/openbios • OpenFirmware Project : commertial • http://www.openfirmware.org • GNU BIOS Project : On emerging • http://www.niklas.ekstrom.com/gnubios • Linux BIOS Project : BIOS + Linux Kernel • http://www.acl.lanl.gov/linuxbios • GRUB Project : Multi-boot • http://www.uruk.org/grub • NILO Project : Network Lilo • http://nilo.sourceforge.net

  28. OpenBIOS’s structure : similar to the OpenFimware OpenFirmware’s Structure

  29. Initial state of i386 in boot

  30. How to boot in i386? • At Reset • CS : 0xFFFF F000h • EIP : 0x0000 FFF0h • Absolut physical address • CS:EIP : 0xFFFF FFF0h • ROM BIOS intial routine

  31. Startup code in OpenBIOS SEGMENT .text BITS 16 ; entry point into startup code - the bootstrap will vector ; here with a near JMPgenerated by the builder. This ; label must be in the top 64K of linear memory. global _main _main: jmpstartup sig: db0xde, 0xad, 0xbe, 0xef startup: movbx, cs movds, bx xor bx, bx; es:bx== 0000:0000 moves, bx movfs, ax ; Might contain BISTresult movgs, dx ; CPU model/rev info CPU_TEST PORT_80 0x01

  32. Application of OpenBIOS • Free i386 PC BIOS • Finally no commertial software in PC! • No trivial job for DOS 1.0 and fast booting • Linux Cluster • Linux BIOS project in Bewolf project in NANL(Los Alamos National Laboratory)

  33. II. Monitor Program PMON for MIPS ssmLUG Byungsoo Jung http://alpha.secsm.org

  34. PMON for MIPS

  35. Introduction to the PMON • Made by Phil Bunce for MIPS PROM monitor program • Support the LSI logic MIPS CPU • Support the serial and ethernet • Source code available • http://www.carmel.com/pmon

  36. PMON’s environment • PMON : the general debug monitor • Require about 300KB memory • Support serial and ethernet • SerialICE-1A : with control board • Same as PMON’s function • Require about 1KB memory • SerialICE-1B : no control board • Same as PMON’s function • Support only Windows 9x/NT

  37. PMON’s directory • imon : source code for SerialICE • pmon : source code for PMON • mon : main source code for PMON and SerialICE • lib : C runtime library for PMON and SerialICE • bsps : the drivers and kernels that are need for SerialICE-1. • include : the include files used by this package • examples : example programs for execution under PMON and the SerialICE • tools : tools that are executed on the host

  38. PMON’s usage • Ethernet port • Set the host ip in /etc/hosts as 210.118.74.129 beta • PMON> set etheraddr 08:00:69:03:00:00 • # arp –s beta 08:00:69:03:00:00 • PMON> set hostport ethernet • PMON> load • % tftp beta • tftp> put bubble.bin • tftp> quit • PMON> g • RS232 serial port • % tip –19200 hadwire • % set hostport tty0 • PMON> set dlecho off • PMON> set dlproto none • PMON> load –c “cat bubble.bin” • PMON> g

  39. III. Embedded Linux Kernel ELKS ssmLUG Byungsoo Jung http://alpha.secsm.org

  40. ELKS

  41. Commertial Embedded Linux • Lineo • Embedix • PowerPC, x86 • Close relation with Motorolla • FSMLabs + Synergy • Real Time Linux • VME, CompactPCI • PowerPC, M68K • Transmeta • Crusoe (x86 emulation) • Linux Tobals

  42. ELKS Kernel • Embedded Linux Kernel • 512KB ROM and 1MB RAM • Now, only 16bit x86

  43. ELKS’s Structure • Kernel • i86 8086 boot code in i86 directory • File system • minix: MINIX file system • elksfs: ELKS file system • romfs : ROM file system • Device Driver • serial : serial device driver • parallel : parallel device driver • network : ethernet device driver

  44. ELKS’s directory • 1. arch/ • 2. kernel/ • 3. fs/ • 4. lib/ • 5. scripts/ • 6. include/ • 7. modules/ • 8. Documentation/ • 9. init/ • 10. net/

  45. booting of ELKS • ROM BIOS • Move the first sector to the 0x7c00 in memory • arch/i86/bootsect.S • Move itself to the 0x90000and jump it. • arch/i86/boot/setup.S • System initialize

  46. Thanks a lot!

More Related