decrease boot time
Hi Folks!
I am trying to improve boot time of my linux system on my motorola i.MX system as much as possible. Therefore I tried to omit the copying and decompressing the linux kernel image ba using XIP, but the code runs slower in the (slower) flash and boot time increased.
I wonder how to make use of sync burst mode with u-boot in conjunction eith linux. Today I switched on CFG_CMD_CACHE (I use u-boot-1.1.1) but I wonder if u-boot knows that it should cache the area above 0x10000000.
Hm... I think the way the linux kernel starts itself is not making use of any implementation of burst mode of the flash device. It copies a small amount of bytes and decompresses them.
Could it be possible to make use of burst mode by copying the compressed image into RAM by u-boot (i.e. bursting) and start the kernel in RAM then? The decompressing and copying would be faster then...
How do I disable serial support in u-boot? My u-boot is currently 60k big, in my opinion a simple bootloader which does something like memsetup and starting kernel afterwards should not be much bigger than 10k. Or is that wrong?
I tried to disable serial support but several functions in common/ (serial_get* for example) are calling functions in cpu/arm920t/imx_serial.c. Do I have to "#ifdef" any occurences of these functions?
REgards, Konsti
Signature · 2 lines
GPG KeyID EF62FCEF Fingerprint: 13C9 B16B 9844 EC15 CC2E A080 1E69 3FDA EF62 FCEF
Quoted 7 lines · Konstantin Kletschke
Hi Folks!
I am trying to improve boot time of my linux system on my motorola i.MX system as much as possible. Therefore I tried to omit the copying and decompressing the linux kernel image ba using XIP, but the code runs slower in the (slower) flash and boot time increased.
Where are your bottlenecks? What is your target boot time?
Quoted 11 lines
I wonder how to make use of sync burst mode with u-boot in conjunction eith linux. Today I switched on
CFG_CMD_CACHE(I use u-boot-1.1.1) but I wonder if u-boot knows that it should cache the area above0x10000000.Hm... I think the way the linux kernel starts itself is not making use of any implementation of burst mode of the flash device. It copies a small amount of bytes and decompresses them.
Could it be possible to make use of burst mode by copying the compressed image into RAM by u-boot (i.e. bursting) and start the kernel in RAM then? The decompressing and copying would be faster then...
Another option would be to modify the linux boot routine for your purposes. Look in arch/arm/boot/head.S and arch/arm/boot/misc.c at decompress_kernel(). At this point the caches are on, so you don't need to worry about instruction fetch time for the decompress routine.
You could copy do the copy before the call to decompress_kernel().
(Not exactly standard; but an option)
However, since the cache is enabled at this point, won't your chip perform a burst read to fill each dcache line regardless of the fact that you'll be reading only one byte at a time? (I may be talking out of my butt here; I'm not familiar with the i.MX chips)
Quoted 5 lines
How do I disable serial support in u-boot? My u-boot is currently 60k big, in my opinion a simple bootloader which does something like memsetup and starting kernel afterwards should not be much bigger than 10k. Or is that wrong?
If all you want is to setup SDRAM and jump into the kernel then u-boot is overkill. It is all the support for loading images and debugging that makes u-boot useful. Plus, u-boot handles passing information about the board and boot parameters to the kernel.
If boot time is that critical, you specify the boot parameters in the kernel .config and write an assembly boot routine that only initialized SDRAM, initializes registers to a sane state and jumps to the kernel. That could probably be done in one assembler routine at <1K.
Of course, you would lose any ability to load new code on the board without a debugger. It all depends on what features you need. :-)
Question: Why do you want to disable serial support? To reduce boot time, to reduce space, or some other reason? If it's space, is it safe to assume that you've got a 'boot loader' flash device with a small first (~16k)? If it is to reduce time; is serial output really making a significant difference in the boot time? I would suspect initialization activities would be chewing up a larger percentage of the time.
Cheers,
g.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line · Konstantin Kletschke
Am 2005-02-11 16:28 -0700 schrieb Grant Likely:
Please make sure that you include the mailing list when you reply to me.
Quoted 6 lines
Quoted 2 lines
Where are your bottlenecks? What is your target boot time?
I think the bottlenecks are the copying routines of kernel and u-boot. I need to enable full caching and burst support to make this as fast as possible. The Flash device is only 16Bit wide.
You think? If possible; I would get some hard numbers on your boot sequence and find out for sure. You could use a serial protocol analyser to attach timestamps to the boot logs. Make sure you're optimizing the right things.
Quoted 8 lines
Quoted 7 lines
Another option would be to modify the linux boot routine for your purposes. Look in
arch/arm/boot/head.Sandarch/arm/boot/misc.catdecompress_kernel(). At this point the caches are on, so you don't need to worry about instruction fetch time for the decompress routine.
You could copy do the copy before the call todecompress_kernel().
(Not exactly standard; but an option)
Quoted 8 lines
When the ICache and DCache is switched on at this time already there can hardly be any improvement done. I thought the cache is switched on after relocating into the RAM. But does the kernel instruct the MMU and Cache to cache the Flash Adress area above
0x10000000?
In my opinion both have to be told to do and I do this in my Flash mtd map file via ioremap.cached AFAIK.
In u-boot I can switch on the MMU and cache also, is this simply working by enabling the two CONFIG defines?
I cannot comment on u-boot and the cache, but in the kernel the cache is turned on before decompression. Look in arch/arm/boot/compressed/head.S. You will see a branch to cache_on at line 287 before decompress_kernel at line 310. (2.6.10) According to the comment on line 422 the page tables are setup for wherever the compressed image is; including if it is in FLASH.
Quoted 7 lines
Quoted 4 lines
If all you want is to setup SDRAM and jump into the kernel then u-boot is overkill. It is all the support for loading images and debugging that makes u-boot useful. Plus, u-boot handles passing information about the board and boot parameters to the kernel.
I agree fully. But for now our customer is upset about the 3 seconds to boot prompt and we promised him to boot in one second.
To u-boot prompt or to linux prompt?
Quoted 9 lines
Of course it would be better in this case to choose another bootloader for that purpose, but I need this stuff running yesterday, so I thought stripping here and there a bit is done in a shorter time...
Quoted 2 lines
If boot time is that critical, you specify the boot parameters in the kernel .config and write an assembly boot routine that only
Brrr. I am chicken-hearted to do that, I probably will need a week or so to implement such a thing.
Well; get out your machete and hack away at u-boot mercilessly; but it shouldn't be necessary. Find out exactly where your bottle necks are and target those areas.
Quoted 10 lines
Quoted 3 lines
Question: Why do you want to disable serial support? To reduce boot time, to reduce space, or some other reason? If it's space, is it
I want to reduce space (less copying time).
Quoted 2 lines
safe to assume that you've got a 'boot loader' flash device with a small first (~16k)?
What do you mean by that?
I mean that some flash devices have some small sectors at the beginning specifically to hold the boot loader. If you were trying to save space I wondered if you were trying to fit into a small sector. This is often done when FLASH space is at an extreme premium.
Quoted 10 lines
Quoted 5 lines
If it is to reduce time; is serial output really
making a significant difference in the boot time? I would suspect initialization activities would be chewing up a larger percentage of the time.Well, I tried the console parameter "quiet" of linux to figure out how exepensive in time the console output really is. Booting lastst 2.8s instead of 3.1s than. So it is not much, but a bit, since initialing of the serial stuff would be omitted.
Linux can spew a lot of log messages; I suspect your time difference would be more bounded by the baud rate of the port rather than the serial device driver itself. U-boot on the other had is quite a bit quieter. Disabling serial will not gain you much. You could simply replace some or all of the strings with empty quotes in the u-boot source but I'd be surprised if it was worth it.
Can you bump up your baud rate?
Quoted 5 lines · In message <[email protected]> you wrote:
You think? If possible; I would get some hard numbers on your boot sequence and find out for sure. You could use a serial protocol analyser to attach timestamps to the boot logs. Make sure you're optimizing the right things.
You can do this even without hardware support. Attached below is a trivial expect script which you can use to pipe the output of your terminal program into to get it timestamped. this is not perfect (as it timestamps on the _eond_ of each line), but does it's job in 95% of all cases. See the comment in the script for ow to use it.
Quoted 2 lines
Quoted 2 lines
In u-boot I can switch on the MMU and cache also, is this simply working by enabling the two CONFIG defines?
Nothing is ever "simply working". You have to understand what you are doing. Reading the README helps.
Quoted 2 lines
I cannot comment on u-boot and the cache, but in the kernel the cache is turned on before decompression. Look in
U-Boot always turns on the instruction cache; the conditions for using the data cache are processor dependent - always off on some systems (8xx) or always on on others (like 8240 for example).
Quoted 2 lines
Quoted 2 lines
I agree fully. But for now our customer is upset about the 3 seconds to boot prompt and we promised him to boot in one second.
It is wise to first measure what you can get before making such promises :-)
Quoted 4 lines
Quoted 4 lines
Well, I tried the console parameter "quiet" of linux to figure out how exepensive in time the console output really is. Booting lastst 2.8s instead of 3.1s than. So it is not much, but a bit, since initialing of the serial stuff would be omitted.
This depends on the baud rate, of course. 0.1 ... 0.2 seconds is what I see, too - for 115200 bps.
BTW - did you consider XIP??
It's off topic here (like most of this ;-) but for the sake of
completeness: see also
http://tree.celinuxforum.org/CelfPubWiki/BootupTimeWorkingGroup
and
http://tree.celinuxforum.org/CelfPubWiki/TechConference2005Docs?action=AttachFile&do=get&target=BTWG-Discussion-Plenary2005.pdf
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Life sucks, but it's better than the alternative." - Peter da Silva
Am 2005-02-12 23:30 +0100 schrieb Wolfgang Denk:
Quoted 5 lines
You can do this even without hardware support. Attached below is a trivial expect script which you can use to pipe the output of your terminal program into to get it timestamped. this is not perfect (as it timestamps on the _eond_ of each line), but does it's job in 95% of all cases. See the comment in the script for ow to use it.
This idea was mentioned by Grant also, thanks for that, I did not have such a idea :) Did you forgot the attachement?
Quoted 2 lines
Nothing is ever "simply working". You have to understand what you are doing. Reading the README helps.
:) I will read it again.
Quoted 2 lines
It is wise to first measure what you can get before making such promises :-)
Yes, I agree, I will try the script thing tomorrow.
Quoted 2 lines
This depends on the baud rate, of course. 0.1 ... 0.2 seconds is what I see, too - for 115200 bps.
ok
Quoted 1 line
BTW - did you consider XIP??
Staring a XIP Kernel lasts longer on my board, I don't know exactly why. I have the strange feeling my system does not full bursting. I see the ADV signal after every ~6 BCLKs and there should be exactly 15 more BCLKs to see, where the system should really burst. I think the CPU cancels each burst after the first valid read Datum.
Thanks for the links, I will read this stuff today.
Konsti
Signature · 2 lines
GPG KeyID EF62FCEF Fingerprint: 13C9 B16B 9844 EC15 CC2E A080 1E69 3FDA EF62 FCEF
Heureka! You know what?
The intel K? flash devices have a flag to change polarity of the WAIT signal, which was wrong!
Now I have reasonable signals on the scope!
Am 2005-02-12 23:30 +0100 schrieb Wolfgang Denk:
Quoted 1 line
BTW - did you consider XIP??
Also XIP would save ~400ms know, decompressing and copying is not done and the kernel runs fast enough from flash now!
I am trying to enable xip now.
Regards, Konsti
Signature · 2 lines
GPG KeyID EF62FCEF Fingerprint: 13C9 B16B 9844 EC15 CC2E A080 1E69 3FDA EF62 FCEF
Am 2005-02-12 14:02 -0700 schrieb Grant Likely:
Quoted 2 lines
Please make sure that you include the mailing list when you reply to me.
Oh sorry! I messed up List-Reply and simple Reply again in mutt. Normally I only reply to the mailing list itself :/
Quoted 4 lines
You think? If possible; I would get some hard numbers on your boot sequence and find out for sure. You could use a serial protocol analyser to attach timestamps to the boot logs. Make sure you're optimizing the right things.
Yes, its time now to measure all steps of the boot process exactly. The serial analyzer idea is quite good. Why isn't it mine :)
Quoted 4 lines
arch/arm/boot/compressed/head.S. You will see a branch tocache_onat line 287 beforedecompress_kernelat line 310. (2.6.10) According to the comment on line 422 the page tables are setup for wherever the compressed image is; including if it is in FLASH.
Yes I see. But I don't understand the assembler code really yet. Do you
mean "add r0, r3, r2, lsl #2" by line 422, where addresses above0x10040000 (there my kernel lives) are added to cacheable area?
Quoted 1 line
To u-boot prompt or to linux prompt?
To linux prompt. I heard from a sony demo where an ARM9 based system starts video encoding one second after power up. I asked in linux-arm-kernel last year and some guy mentioned that. So I thought I could reach the prompt also in one second :/
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
safe to assume that you've got a 'boot loader' flash device with a small first (~16k)?
What do you mean by that?
I mean that some flash devices have some small sectors at the beginning specifically to hold the boot loader. If you were trying to save space I wondered if you were trying to fit into a small sector. This is often done when FLASH space is at an extreme premium.
No I have intel 28F128K3 sync burst Flash which contains even sized 128kB sectors only.
Quoted 3 lines
Linux can spew a lot of log messages; I suspect your time difference would be more bounded by the baud rate of the port rather than the serial device driver itself. U-boot on the other had is quite a bit
T thought also and measured and my result is the same.
Quoted 1 line
Can you bump up your baud rate?
It is at 115200 now, I could bump it but I don't think it will to significant time saving due to the above reasons...
Konsti
Signature · 2 lines
GPG KeyID EF62FCEF Fingerprint: 13C9 B16B 9844 EC15 CC2E A080 1E69 3FDA EF62 FCEF
Quoted 10 lines · Konstantin Kletschke
Am 2005-02-12 14:02 -0700 schrieb Grant Likely:
Quoted 4 lines
arch/arm/boot/compressed/head.S. You will see a branch tocache_onat line 287 beforedecompress_kernelat line 310. (2.6.10) According to the comment on line 422 the page tables are setup for wherever the compressed image is; including if it is in FLASH.Yes I see. But I don't understand the assembler code really yet. Do you
mean "add r0, r3, r2, lsl #2" by line 422, where addresses above0x10040000(there my kernel lives) are added to cacheable area?
Sorry; I meant line 412. That block of code adds a cache mapping to where the PC is currently running. This means that the compressed image is cached. Note: this cache enable is for uncompressing the kernel; the caches are reconfigured inside the kernel itself.
Quoted 6 lines
Quoted 4 lines
Linux can spew a lot of log messages; I suspect your time difference would be more bounded by the baud rate of the port rather than the serial device driver itself. U-boot on the other had is quite a bit
T thought also and measured and my result is the same.
???
Cheers,
g.
Quoted 4 lines · In message <[email protected]> you wrote:
I am trying to improve boot time of my linux system on my motorola i.MX system as much as possible. Therefore I tried to omit the copying and decompressing the linux kernel image ba using XIP, but the code runs
Are you sure that this is where you spend a significant part of your boot time? I guess you did run some analysis on which steps of the boot procedure take how long etc.???
Quoted 1 line
I wonder how to make use of sync burst mode with u-boot in conjunction
What makes you think that this would solve a problem?
Quoted 4 lines
How do I disable serial support in u-boot? My u-boot is currently 60k big, in my opinion a simple bootloader which does something like memsetup and starting kernel afterwards should not be much bigger than 10k. Or is that wrong?
Your assumption may be of for "a simple bootloader", but then U-Boot is not such a beast.
Also, which problem do you try to solve? Boot time? Image size?
What makes you think that disabling the serial console would solve either of these problems? [If these actually are problems.]
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de There is a time in the tides of men, Which, taken at its flood, leads on to success. On the other hand, don't count on it. - T. K. Lawson