just bought stm32 nucleo, learning Cortex-M. But my final target is Cortex-A, i am more interesting in general-OS than rtos.
Category: Kernel
libelf example can print out bytes in sections
newlib linker script summary for you own executable
After i build my newlib by “../newlib-2.1.0/configure –target=$TARGET –prefix=$PREFIX”, except the libc.a and crt0.o, i got these linker scripts. I am still thinking which one i should use for my own executables in my OS. elf_i386.x Default linker script, for normal executables elf_i386.xbn Script for -N: mix text and data on same page; don’t align […]
YEAH, page tables is ok now
After 100 times of failure, i finally loaded a exe into an independent address space (independent page tables and LDT). I meet all kind of failures: wrong page directory, wrong page table, wrong virtual address mapping, wrong code selector, wrong LDT, etc…
A guide to how the FreeBSD kernel manages the IA32 processors in Protected Mode
Download : A guide to how the FreeBSD kernel manages the IA32 processors in Protected Mode
Kernel can load up all segments to correct v-addr and p-addr now
Kernel can load up all segments to correct v-addr and p-addr now
ported libelf
finally ported libel to my os, my linker script won’t warn me I crossed the kernel boundary. So libelf’s variables becoming exist in a memory area that they shouldn’t be there.
handling exception 7
the easiest way to handle exception 7 is to execute clts then iret. My kernel was crashed because it generated a exception 0x7.
libelf include issue
When you meet this: Just comment out the following line in /toolchain/include/libelf/sys_elf.h When I build the libelf in mac and in linux, the output sys_elf.h is different, in mac, the above line is not exist, so my OS is able to compile. Peter.
I should look at this
I should look at this printf -> _fstat -> _sbrk -> write
libelf.h has bug, it includes a missing header file
I cross compile the libel 0.8.13 on my ubuntu 12.04lts. I used the below command to configure it. The compile process is success and installed it correct. But inside the include/libelf/sys_elf.h, it includes a missing header file (elf.h). Just comment it out, and it will works.
Adding file to newlib’s sys folder and make it compile
Adding file to newlib’s sys folder and make it compile, you need to modify the Makefile.in, see below
newlib sys/*.h will not be copied to output directory
All the .h file in the sys directory will be included when compiling the files in your sys/XXX. They (sys/*.h) will not be copied to the output directoy, that mean they are just used for compile only.
How to use PFSBuilder
How to use PFSBuilder This tutorial work in windows/linux/mac Step 1) Download the jar https://www.dropbox.com/s/do0ygc4z9dbxlwx/PFSBuilder-20140619.jar Step 2) make sure you have java in your PC Compress directory into PFS image Step 1) Make sure PFSBuilder.jar is in your current directory Step 2) Create a folder call “input” and put some files and directories in there Step […]
Connect Peter-file-system to linux or mac
After spent 3 days to play the FUSE and macFUSE, i finally connected Peter-file-system (https://code.google.com/p/pfsbuilder) to my mac/linux machine. It is quite simple and straightforward, I write a FUSE program that create a JVM and load my PFS stub (writhed in Java), every FUSE function calls will route to the stub and manipulates the PFS […]
newlib’s reentrant system calls will map to non-reentrant by default
newlib’s reentrant system calls will map to non-reentrant by default. The reentrant version of open() can be found in newlib-2.1.0/newlib/libc/reent/openr.c As you can see, it will call _open which is defined in newlib-2.1.0/newlib/libgloss/libnosys/open.c . So if you don’t write your reentrant functions, it will jump to non-reentrant by default. For OS developer want to implement […]
linker script offset seems crazy
linker script offset seems crazy, take a look the following two pictures
Lowest 7 levels of /lib, /bin, /usr/bin, /usr/lib
No recursive /bin /lib /usr/bin /usr/lib
Dev target 2013/02
1) port peter-bochs to qemu 2) finish new lib stub open() 3) make the libc layer fully working 4) Pass all PKU exams