A virtual machine with Debian 8.x i386 was used to build the kernel and to prepare the sd ard image for the IOT2000.
sudo apt-get install debootstrap build-essential binutils git gawk chrpath kernel-package fakeroot libncurses5-dev parted
mkdir ~/dev cd ~/dev git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Download 'bsp_sources_and_docs_for_intel_quark_v1.1.0.zip' from here and unzip to '~/dev/quark_patchset'
cd ~/dev git clone https://github.com/siemens/meta-iot2000.git mkdir ~/dev/iot2000-patchset/ cp ~/dev/meta-iot2000/meta-iot2000-bsp/recipes-kernel/linux/files/* ~/dev/iot2000-patchset
cd ~/dev/linux-stable/ git reset --hard 531ec28f9f26f78797124b9efcf2138b89794a1e git am ~/dev/quark_patchset/*.patch
Some whitespace warnings appear but that is okay.
This has to be done manuelly because patch is not 100% compatible with the kernel version. See patches in ~/dev/iot2000-patchset.
The kernel config from Intel Quark patchset can be seen in
~/dev/linux-stable/meta/cfg/kernel-cache/bsp/quark/quark.cfg
You may also have a look at the examples folder, I have uploaded the kernel config which was used for the kernel on the sd card image.
++
in drivers/gpio/Kconfig
Add UIO dependency to GPIO_SCH
config GPIO_SCH
depends on UIO
++
++
in include/linux/serial_core.h
Add the following field in struct uart_port
int (*rs485_config)(struct uart_port *, struct serial_rs485 *rs485);
++
cd ~/dev/linux-stable/ fakeroot make-kpkg --cross-compile - --arch i386 --initrd --revision 1 kernel_image modules_image
This may take a while depending on your hardware.
dd of=~/dev/iot2000.img bs=1 count=0 seek=1G sudo losetup -f ~/dev/iot2000.img sudo parted /dev/loop0 mktable gpt sudo parted /dev/loop0 mkpart primary fat32 1 100MB sudo parted /dev/loop0 mkpart primary ext3 100MB 1000MB sudo parted /dev/loop0 set 1 boot on sudo parted /dev/loop0 set 2 msftdata on sudo partx -a /dev/loop0 sudo mkfs.vfat -F 16 -I /dev/loop0p1 sudo mkfs.ext3 /dev/loop0p2
mkdir ~/dev/sd_root sudo mount /dev/loop0p2 ~/dev/sd_root sudo debootstrap --arch i386 wheezy ~/dev/sd_root http://http.debian.net/debian
sudo mount --bind /dev ~/dev/sd_root/dev/ sudo mount --bind /dev/shm ~/dev/sd_root/dev/shm sudo mount --bind /dev/pts ~/dev/sd_root/dev/pts sudo mount --bind /proc ~/dev/sd_root/proc sudo mount -t sysfs /sys ~/dev/sd_root/sys
sudo cp ~/dev/*.deb ~/dev/sd_root/opt/
sudo chroot ~/dev/sd_root/ aptitude install locales dpkg-reconfigure locales localedef -i de_DE -c -f UTF-8 en_US.UTF-8
apt-get install sudo locales ntp openssh-server initramfs-tools net-tools bash-completion apt-get install efibootmgr firmware-linux-free gettext-base gnu-fdisk grub-common grub-efi-ia32 grub-efi-ia32-bin grub2-common lockfile-progs os-prober parted ucf zerofree
Add the following lines to file /etc/modules
pch_udc g_serial
Add the following lines to file /etc/inittab
GS0:23:respawn:/sbin/getty -L 115200 ttyGS0 vt100 T1:23:respawn:/sbin/getty -L 115200 ttyS1 vt100
and comment the following lines in file /etc/inittab
#1:2345:respawn:/sbin/getty 38400 tty1 #2:23:respawn:/sbin/getty 38400 tty2 #3:23:respawn:/sbin/getty 38400 tty3 #4:23:respawn:/sbin/getty 38400 tty4 #5:23:respawn:/sbin/getty 38400 tty5 #6:23:respawn:/sbin/getty 38400 tty6
passwd adduser user addgroup user sudo
visudo
Change the following line:
%sudo ALL=(ALL:ALL) ALL => %sudo ALL=(ALL) NOPASSWD:ALL
Add the following line in file /etc/hostname
iot2000
Add the following line in file /etc/hosts
127.0.0.1 localhost iot2000 ::1 localhost ip6-localhost ip6-loopback iot2000
Add the following lines in file /etc/network/interfaces
auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet dhcp
dpkg -i /opt/*.deb
for i in `/usr/bin/find /lib -type f -name \*pthread\*so`; do cp ${i} ${i}.bak; sed -i "s/\xf0\x0f\xb1\x8b/\x90\x0f\xb1\x8b/g" ${i}; done
A valid grub configuration can be seen in examples folder. Copy the example config to /boot/grub/grub.cfg or prepare the configuration on your own.
/usr/lib/grub/i386-efi/grub-install
exit
Copy efi loader to first partition of sd card image.
mkdir ~/dev/sd_boot sudo mount /dev/loop0p1 ~/dev/sd_boot sudo mkdir -p ~/dev/sd_boot/EFI/BOOT sudo cp ~/dev/sd_root/boot/grub/boot.efi ~/dev/sd_boot/EFI/BOOT/BOOTIA32.EFI
sudo killall ntpd sudo umount ~/dev/sd_root/dev/pts ~/dev/sd_root/dev/shm ~/dev/sd_root/dev ~/dev/sd_root/proc ~/dev/sd_root/sys ~/dev/sd_root ~/dev/sd_boot sudo losetup -d /dev/loop0
Now the image is ready and can be used.
sudo dd bs=4M if=~/dev/iot2000.img of=/dev/sdx <check sd card path here>