Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: mb300sd on January 22, 2017, 08:08:21 PM
-
Here's a trick I found that cut the time from power on to my application starting from 10+ sec to 4 secs. Maybe it'll be useful to some others. I'm using the pi as a bridge/translator between my engine control unit and transmission controller, so startup time is critical.
I removed everything from onboot.lst except the modules for the CAN controller.
can-4.4.39-piCore_v7+_local.tcz
Then I still want openssh and several other things to load, so I delay load them in bootlocal.sh
#!/bin/sh
# Configure can bus
echo 500000 > /sys/class/net/can0/can_bittiming/bitrate
ifconfig can0 up
#ip link set can0 up type can bitrate 500000
echo 500000 > /sys/class/net/can1/can_bittiming/bitrate
ifconfig can1 up
#ip link set can1 up type can bitrate 500000
# Start CAN bridge
/opt/car_can/car_can&
# Load RTC
su tc -c "/usr/bin/ondemand -e rtc-4.4.39-piCore_v7+.tcz"
# Load modules
/sbin/modprobe i2c-dev
/sbin/modprobe vcan
# Openssh is slow to load, do it later.
su tc -c "/usr/bin/ondemand -e openssh.tcz"
# Start openssh daemon
/usr/local/etc/init.d/openssh start
# Set CPU frequency governor to ondemand (default is performance)
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# Load other tczs
su tc -c "/usr/bin/ondemand -e iproute2.tcz"
su tc -c "/usr/bin/ondemand -e nano.tcz"
# Mount boot partition
/bin/mount /dev/mmcblk0p1 /mnt/mmcblk0p1
Might I suggest a postboot.lst function to do this in a cleaner way?
-
Hi!
I'm kind of amazed that you're using the ondemand command in bootlocal.sh, not that I would tell you not to,
though. But I wonder what would be the cleaner way.
-
Well, clean is probably out the window for me now.
I figured out how to remaster the image, and gained a second by inserting the CAN modules and my exe into it. I think I might be able to run my code from /etc/init.d/rcS before tinycore even loads.
If that works, everything else can go back to normal, loading after my stuff is already running.
-
mb300sd,
it would be great if you can share your way of remastering image... This is something that I also want to do, however, there are no any guide how to do this. Your help would be greatly appreciated!
-
I pretty much followed this. http://wiki.tinycorelinux.net/wiki:remastering Skip down to this part.
mkdir /tmp/extract
cd /tmp/extract
zcat /tmp/core.gz | sudo cpio -i -H newc -d
core.gz is 8.1.5v7.gz file from mmcblk0p1.
-
Here some tips on making it faster to boot for embedded systems.
http://free-electrons.com/doc/training/boot-time/boot-time-slides.pdf
-
I think you could also compile your own busybox with bootchartd support.
To make some fine graphics chart of the boot process.
To easily verify what taking time.
I don't have Bela busybox config file to do it.
But i think, if you ask gently he give it to you.