DynAMOS is distributed with examples of kernel updates in source code form for Linux 2.4. The source code can be compiled and prepared to be applied as an update. The updated functionality can be loaded in the kernel and activated using the DynAMOS framework. The following examples demonstrate how the collection of tools offered by DynAMOS are used together from start to finish in dynamically applying a kernel update.
The general format of running these examples is shown in Figure 5-1.
Figure 5-1. Running the example updates.
# DynAMOS must run with administrator privileges. bash$ su - Password: bash# # Start the framework bash# /etc/init.d/dynamos start # Check if everything started correctly bash# dmesg -c # Build an example's source bash# cd /usr/share/doc/dynamos/examples/get_pid bash# make # Load the example's module bash# insmod final_dynreplace_file.o # Activate the update bash# ./activate.sh # Verify things work bash# dmesg -c bash# cat /dev/dynamos # Deactivate the update bash# ./deactivate.sh # Verify the update is not effective bash# dmesg -c bash# cat /dev/dynamos # Unload the example's module bash# rmmod final_dynreplace_file # Stop the framework bash# /etc/init.d/dynamos stop # Check if everything stopped correctly bash# dmesg -c
get_pid() is the Linux process allocation routine. It returns the next available process id that can be used by a newly created process. When applied, this update will report in the kernel logs on process creation the id of the process that calls get_pid() and the pid it returns, as shown in Figure 5-2.