-
Notifications
You must be signed in to change notification settings - Fork 26
NTP server
The UDOO standard image comes with ntpd installed. To synchronise the time of Android once, run
su
/system/xbin/ntpd -n -p 0.pool.ntp.org -p 1.pool.ntp.org -p 2.pool.ntp.org -p 3.pool.ntp.org
If other NTP servers will be used, remove the entries -p X.pool.ntp.org
in the command above and add -p [LOCAL_NTP_SERVER]
where LOCAL_NTP_SERVER is the address of your local NTP server.
To synchronise time indefinitely, the Android RAM-disk must be updated. This involves the large number of steps below.
First, download mkbootimg
and boot-extract
.
The Android debug bridge adb
, boot-extract
and mkbootimg
are assumed to be on the path of your machine; if not, use their full paths instead of the command names in the calls below
# read the boot image on the Udoo Neo
adb -d shell
su
mkdir /data/transfer
dd if=/dev/block/mmcblk0p1 of=/data/transfer/boot_old.img
chmod a+rwx /data/transfer
chmod a+r /data/transfer/boot_old.img
exit
exit
# pull the bootdisk onto a host system (running Linux or MacOSX) and extract ramdisk and kernel from it
adb -d pull /data/transfer/boot_old.img
mkdir tmp
cd tmp
boot-extract ../boot_old.img
# unzip and unpack the ramdisk into a subdirectory
gunzip ramdisk.cpio.gz
mkdir files
cd files
cpio -id < ../ramdisk.cpio
Now modify init.rc
as desired (replacing the IP address after -p
):
echo $'\nservice ntpd /system/xbin/ntpd -n -p aa.bb.cc.dd\n class main' >> init.rc
Then repackage and zip the ramdisk
find . | cpio -H newc --owner 0:0 -ov > ../ramdisk.cpio
cd ..
gzip ramdisk.cpio
# combine the ramdisk and the kernel into a complete boot image again
# the arguments for mkbootimg are copied from the output of boot-extract (see sample below), with hexadecimal addresses converted into decimal offsets, relative to base address 0
#
mkbootimg --base 0 --kernel zImage --ramdisk ramdisk.cpio.gz --pagesize 2048 --kernel_offset 2223013888 --ramdisk_offset 2239758336 --second_offset 2238709760 --tags_offset 2222981376 --cmdline 'console=ttymxc0,115200 init=/init vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=128M androidboot.selinux=disabled androidboot.dm_verity=disabled no_console_suspend uart_from_osc clk_ignore_unused' -o boot_new.img
# transfer the new boot image to the Udoo Neo and write it to the boot partition
adb -d push boot_new.img /data/transfer/boot_new.img
adb -d shell
su
dd if=/data/transfer/boot_new.img of=/dev/block/mmcblk0p1
# cleanup on the Udoo Neo
rm /data/transfer/boot_old.img
rm /data/transfer/boot_new.img
rmdir /data/transfer
sync
exit
exit
Now reboot the Udoo Neo, automatically using the new boot image. If booting fails, it's still possible to write back the old boot image by connecting the microSD-card of the Udoo Neo to the host system and running a command similar to the following there:
dd if=boot_old.img of=/dev/....
where /dev/....
needs to be replaced by the correct partition name on the specific host system, e.g. /dev/sdb1
.
Sample output of boot-extract:
argc 2 optind 1
Boot header
flash page size 2048
kernel size 0x570648
kernel load addr 0x84808000
ramdisk size 0xde632
ramdisk load addr 0x85800000
second size 0xb566
second load addr 0x85700000
tags addr 0x84800100
product name ''
kernel cmdline 'console=ttymxc0,115200 init=/init vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=128M androidboot.selinux=disabled
androidboot.dm_verity=disabled no_console_suspend uart_from_osc clk_ignore_unused'
These notes are based on a set of slides.
If you are using adb
over wifi, remove all -d
from adb
commands. Before applying this wiki, please verify what devices are connected to your adb
server using adb devices
.
If booting from the boot_old.img
as well as form the boot_new.img
are failing, you can always download the current UDOO Android distribution from the UDOO website and follow this wiki to install it.