User Tools

Site Tools


odroid_kernel_operations

This is an old revision of the document!


Update the kernel

Download the kernel update code from mdrfr and run the script:

wget http://builder.mdrjr.net/tools/kernel-update.sh
chmod +x kernel-update.sh
sudo ./kernel-update.sh

Reboot the Odroid:

reboot

Kernel Source

get the kernel source from the github. You need to run the command straight after updating the kernel so the kernel and the source match:

wget https://github.com/hardkernel/linux/archive/odroid-3.8.y.zip

Configuring, Compiling and Installing the Kernel

Update the software repositories:

yum update

Install the following software

yum install -y gcc gcc-c++ make openssl-devel newt-devel ncurses-devel 
libtermcap-devel libxml2-devel perl curl curl-devel lzop
zlib-devel unixODBC-devel libtool 

Unzip the Kernel Source then configure it:

unzip odroid-3.8.y.zip
cd linux-odroid-3.8.y
cp arch/arm/configs/odroidu_defconfig ~/linux-odroid-3.8.y/.config

To enable OSS sound card support and the correct /dev drivers, we need to re-compile the kernel with certain options.

make menuconfig

Scroll down the list and go to Device Drivers, then Sound card support.

You will be presented with the first screen on the right, set the ALSA option to a module (press <M>).

Press [ENTER]. Then enable all the OSS modules you see to make your screen look like the second image.

When you exit to the first screen, you will see a an option for Preclaim OSS device numbers. Make sure this is selected with a [*].

Take notice of the Kernel version at the top of the screen

Exit out then save the configuration.

Then build the kernel:

make
make modules
make modules_install
make zImage

Now install the kernel:

mv /boot/uboot/zImage /boot/uboot/zImage.prev
mv arch/arm/boot/zImage /boot/uboot/zImage

Now reboot

reboot

If all is good, it will reboot back into a login prompt.

Creating Kernel Scripts

Create the scripts needed to compile software.

make scripts

Installing a watchdog

As all my embedded thingy's are supposed to run unattended without any user interaction, possibly for months, it is probabily a good idea to install a watchdog in the kernel.

The watchdog will reboot the droid (and pi) if the watchdog file is not written to for a period of time.

Install the watchdog

go back into the kernel compile folder and make the menu:

make menuconfig
  • Scroll down the list to Device Drivers, press [Enter],
  • then down to Watchdog Timer Support.
  • Press the space bar to enable it with a *.
  • Then press [Enter] to go into the sub menu.
  • Press the space bar on Disable watchdog shutdown on close, and
  • Software watchdog

Exit back out of the menu.

Make the Kernel as described above and install the new zImage.

Reboot

Keep the watchdog alive

In order to stop the watchdog from rebooting the Odroid, we need to write a simple program to 'ping' the watchdog device so it knows the device is still alive. That program then needs to be run at boot:

nano ~/watchdog.c

Enter the following into nano: <codee> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h>

int main(void) {

int fd = open("/dev/watchdog", O_WRONLY);
int ret = 0;
if (fd == -1) {
	perror("watchdog");
	exit(EXIT_FAILURE);
}
while (1) {
	ret = write(fd, "\0", 1);
	if (ret != 1) {
		ret = -1;
		break;
	}
	sleep(10);
}
close(fd);
return ret;

} </code>

Save the file, then we have to compile it:

gcc watchdog.c -o watchdog

Now that the program has been compiled, we need to install it into the crontab so it will run at power up.

crontab -e

Enter the following into a new crontab line:

@reboot /root/watchdog >/dev/null &

By doing all this, the watchdog is hard coded to the kernel and cannot be uninstalled by accident. The only way to remove the watchdog is to re-compile the kernel without it.

This should mean the odroid is unstoppable on a hill-top or similar place.

You can now go onto building the

odroid_kernel_operations.1536850417.txt.gz · Last modified: 2018/09/14 00:53 by vk3smb