cancel
Showing results for 
Search instead for 
Did you mean: 

STPC Linux and WinCE.net loaders available for free - full source code

thierry239955_st
Associate II
Posted on August 08, 2005 at 07:48

STPC Linux and WinCE.net loaders available for free - full source code

11 REPLIES 11
thierry239955_st
Associate II
Posted on February 11, 2003 at 07:16

A Linux and a WinCE.net loader have been integrate into the new STPC Software Development Kit including the full source code.

You can find it in the list of STPC delivrables under the name of STPC Software Development Kit v1.0.

Feel free to test and give your comment on this forum.

asaf
Associate II
Posted on February 16, 2003 at 08:05

Hello,

I have tested the package with Linux and it is working fine.

However I could not find ''kernel'' script file in the package

I want to create my own linux kernel.

How can I find kernel script file (The script converts the kernel file to vmlinux.bin.gz file)

Can you recommand of a linux the be loaded from a Flash ?

Thank you

thierry239955_st
Associate II
Posted on February 17, 2003 at 09:10

asaf,

The script is in the project directory:

project/loader/kernel

Find here the contend of the script:

#!/bin/bash

if test -z ''$1'' ; then

echo ''Usage: kernel ''

else

objcopy -O binary -R .note -R .comment -S $1 $1.bin

gzip -f -9 $1.bin

fi

To store a complete Linux in flash, the most common (and usefull) way is to use the Memory Technology Device (MTD) feature available in 2.4.x kernels. You have an option concerning MTD in the Linux kernel configuration. This allow you to store a complete linux file system in flash. The linux file system can be the one you want, from a full distribution to the example you have in the STPC-DK. The only limitation is the size of your flash.

You can find more informations about MTD here:

http://www.linux-mtd.infradead.org/

Both MTD tools and the flash file system are complex to configure and it will be difficult if you don't have any experience in this area.

There is compagnies which provide complete solution like Lineo (www.lineo.com), Tuxia for TV oriented application (www.tuxia.com) and MontaVista (www.mvista.com). It is also common to find local design house specialize in embedded linux.

Hope all this can help you

[ This message was edited by: Farfalla on 17-02-2003 13:42 ]
asaf
Associate II
Posted on February 17, 2003 at 13:46

Hi,

Thank you your answer

you recommand to use MTD in order to store a complete linux file system in flash

I found another idea that was implemented on single board computer:

Their conecpt is

1)load linux kernel using loadlin

2)Than linux kernel takes over

3)load the RAM disk from the EPROM

4)switch the root file system to the RAM disk

They used a special function on the board (SSD - solid state disk) to load dos and than used linux to run linux kernel since their bios did't not support loading linux directly from EPROM

I want to load linux kernel from the EPROM using ''SWSTREAM_inputFromMemory'' function and than to repeat step 2-3

(booting from RAM disk using an image that is store on the flash)

Do you think it is possible ?

Can you reffer me to someone / article who can help me with the procedure ?

My main problem is how to mount root to the ramdisk not using loadlin commands

Thanks again

Asaf
thierry239955_st
Associate II
Posted on February 21, 2003 at 13:44

Asaf,

You are right. It is another way to boot, which consume more memory but less flash (if you compress the RAM disk in flash)

I suggest to load the file system in ram uses the same way as the kernel: SWSTREAM_inputFromMemory and SWUNZIP_Process to a location which doesn't overlap with both the kernel and the loader.

Then you need to give to the kernel the location of your RAM disk.

There is a macro in lnxload.h:

LDRLNXLOAD_SET_PARAM_INITRD(header, start, size)

to give the location and the size of your RAM disk. I did never try but it should work. I think it replace the initrd parameter in the kernel command line. You can also try with the command line.

To build the file system to put in your flash, the procedure should be:

1 - create a file with the size of your file system:

dd if=/dev/zero of=filesys.bin bs=1k count=16000

this will create a 16Mb file filesys.bin.

2 - make your file look like a block device uses a loop back device:

losetup /dev/loop0 filesys.bin

Your file will be associated to the block device /dev/loop0. If /dev/loop0 is already in use, you can use any other loop back device /dev/loop?

3 - format your file as ext2fs:

mk2fs /dev/loop0

4 - mount your new file system:

mount /dev/loop0 /mnt

You can then copy all the files you want into /mnt and this files will be copied into filesys.bin, now seen as a file system.

When you have finish, you can unmount and suppress the link with /dev/loop0:

umount /mnt

losetup -d /dev/loop0

Your filesys.bin is ready to be load in your flash. You need to compress it with gzip first if you use SWUNZIP_process to load it.

Some bootable CD use this method to boot. Maybe you can find informations on internet about that, in particular on the way to configure a RAM disk uses initrd kernel command line.

I have never tested. I would be interested to have more informations if you succeed.

Farfalla

asaf
Associate II
Posted on February 24, 2003 at 12:24

Thank you for your last answer

We are building an ISA card for the flash.

However I could not build my own kernel using the kernel script

My kernel works fine using ''Linux kernel loader'' (loadlin, Linux boot disk etc.)

But when I convert the (uncompressed) kernel image 'vmlinux' to a binary file (using kernel script) and compressed it using gzip.

Power GDK loader decompressed it successfully (the rs232 monitor reports of a correct kernel size) but it seems like it could not run it seems it is endlessly decompressed it and try to run it again and again.

I tried to use Linux Red Hat 8.0 and 7.2; I am downloading Red Hat 7.3

I will attach my own kernel to this file hope it can help.( Note is the original kernel file! not a st loader binary file ,but compressed )

I will also be thank full if you can send me the original kernel that was used in the power GDK so I can test it with the kernel script my self.

Please help me with this problem it seems like one of my last obstacle to boot Linux from flash.

________________

Attachments :

vmlinux.gz : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htuo&d=%2Fa%2F0X0000000aag%2FnsjCb2_fU3yfWQUSj1JyH22sj8vvuaESIUkemDRvicM&asPdf=false
thierry239955_st
Associate II
Posted on February 26, 2003 at 14:43

OK. I could send you my own kernel. Maybe the full source code, if not to big, so you could re-use and modify it.

I'm unfortunatly travelling this week and won't be able to access my platform before next week.

Hope you could wait a bit for this.

Farfalla

asaf
Associate II
Posted on March 03, 2003 at 06:14

I will be happy go get your kernel source code

thierry239955_st
Associate II
Posted on March 04, 2003 at 15:25

Hello asaf,

I have just rebuild one kernel 2.4.20 form scratch and it is working fine on my platform with the loader given as example in the STPC-DK (in fact I don't know exactly where I have put my previous kernel source code

). I have attached the vmlinux file before to use the 'kernel' script, the file directly generated by the kernel compilation.

I will describe you the exact procedure I have followed to build this kernel. You could try to reproduce:

1 - download the linux-2.4.tar.bz2 file from www.kernel.org. It correspond to the full source code (F) of the kernel 2.4.

2 - create the linux link and uncompress the kernel files:

rm /usr/src/linux (if linux link already exist)

mkdir /usr/src/linux-2.4.20

ln -s /usr/src/linux-2.4.20 /usr/src/linux

cd /usr/src

tar -xjvf linux-2.4.tar.bz2

3 - Modify the kernel config to support 486:

cd /usr/src/linux

make menuconfig

Then I have modified this two options in 'Processor type and features':

Processor family = 486

Symmetric multi-processing support = off

I have used default configuration for the rest of the kernel. I think it should work with multi-processing enable but I already experimented problem of compilation with this option.

4 - Build the kernel

make dep

make

(you can also do 'make bzImage' but 'make' is enough to build the vmlinux)

5 - Create the vmlinux.bin.gz file with kernel script:

cd /.../stpckit

./kernel /usr/src/linux/vmlinux

Then I have download my new kernel to the partition number 0x21 in my hard disk with dd command and it is working perfect.

Hope all this will help.

[ This message was edited by: Farfalla on 04-03-2003 19:56 ]