If your embedded system running Linux does not have enough memory, you can enable swap to get more memory. However if your platform does not have MMU (Memory Management Unit) as is the case for Sigma Designs EM8620 series, it won’t support swap, so forget it. If your platform does have MMU, as is the case for many newer platforms such as Sigma Designs SMP8630, SMP8640 and SMP8650 series, you can enable swap support. First you’ll have to make sure swap support is enabled in your kernel:
1 2 |
CONFIG_SWAP=y CONFIG_SWAP_PREFETCH=y |
and swapon/swapoff is enabled in busybox. So for example if you have an IDE harddisk with the second partition configured as swap. (Use fdisk to create a partition and mkswap /dev/hda2 to initialize the partition), you can enable the swap as follows:
1 |
swapon /dev/hda2 |
If you get out-of-memory killer kernel error, you can change the “swapiness” to avoid oom-killer to kick in.
1 |
echo 0 > /proc/sys/vm/mapped |
[…]