My SD card image can be downloaded here.
Please use the upper SD card slot at the Wandboard:
Installed/used software
from LFS:
acl 2.2.53, attr 2.4.48, autoconf 2.69, automake 1.16.1, bash 4.4.18, bc
1.07.1, binutils 2.31.1, bison 3.0.5, bzip2 1.0.6, check 0.12.0, coreutils
8.30, DejaGNU 1.6.1, diffutils 3.6, eudev 3.2.5, e2fsprogs 1.44.3, libelf 0.173, expat 2.2.6, expect 5.45.4, file 5.34, findutils 4.6.0, flex 2.6.4,
gawk 4.2.1, gcc 8.2.0, GDBM 1.17, gettext 0.19.8.1, glibc 2.28, GMP 6.1.2, gperf 3.1, grep
3.1, groff 1.22.3, gzip 1.9, iana-etc 2.30, inetutils 1.9.4, intltool
0.51.0, IPRoute2 4.18.0, kbd 2.0.4, kmod 25, less 530, LFS-bootscripts
20180820, libcap 2.25, libffi 3.2.1, libpipeline 1.5.0, libtool 2.4.6, linux headers
4.18.5, m4 1.4.18, make 4.2.1, man-DB 2.8.4, man-pages 4.16, meson
0.47.1, MPC 1.1.0, MPFR 4.0.1, ninja 1.8.2, ncurses 6.1, OpenSSL 1.1.0i, patch 2.7.6, perl
5.28, pkg-config 0.29.2, procps-ng 3.3.15, psmisc 23.1, python 3.7.0,
readline 7.0, sed 4.5, shadow 4.6, sysklogd 1.5.1, sysvinit 2.90, tar
1.30, tcl 8.6.8, texinfo 6.5, util-linux 2.32.1, vim 8.1, XML::Parser 2.44, xz 5.2.4, zlib 1.2.11
additional software:
cpio 2.12, curl 7.61.1, dhcpcd 7.0.8, gcc 8.2.0 (with enabled languages c,c++,fortran,go,objc,obj-c++),
git 2.18.0, htop 2.2.0, iptables 1.8.0, joe 4.6, libidn2 2.0.5, libnl 3.4, libtasn1 4.13, libtirpc 1.1.4, libunistring 0.9.10,
lsof 4.91, lynx 2.8.9rel1, make-ca 0.9, nano 3.0.20, openssh 7.8p1, p11-kit 0.23.14, pcre 8.42, pcre2 10.31, python 2.7.15,
rpcbind 1.2.5, screen 4.6.2, six 1.11, slang 2.3.2, sntp and ntpdate from ntp 4.2.8p12, time 1.9, traceroute 2.1.0, tree 1.7.0,
wget 1.19.5, which 2.21, wireless tools 29, wpa_supplicant 2.6, net-tools-cvs_20101030 (and from there additional
ifconfig because this knows IPv6), uboot (via git checkout, see below), linux kernel 4.18.8 with Wandboard patches (see below)
cat > ~/.bashrc << "EOF" set +h umask 022 LFS=/mnt/lfs LC_ALL=POSIX LFS_TGT=armv7l-lfs-linux-gnueabihf PATH=/tools/bin:/bin:/usr/bin export LFS LC_ALL LFS_TGT PATH EOFAt two points the LFS book says you must patch gcc. Since LFS is more for i386/x86-64 the patch in the book doesn't take care about arm. So here are the correct commands (chapter 5.5.1 GCC-8.2.0 - Pass 1 and chapter 5.10.1 GCC-8.2.0 - Pass 2):
for file in gcc/config/{linux,i386/linux{,64},arm/linux-eabi,arm/linux-elf}.h do cp -uv $file{,.orig} sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \ -e 's@/usr@/tools@g' $file.orig > $file echo ' #undef STANDARD_STARTFILE_PREFIX_1 #undef STANDARD_STARTFILE_PREFIX_2 #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/" #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file touch $file.orig done
Chapter 6.9.1 Glibc:
case $(uname -m) in i?86) GCC_INCDIR=/usr/lib/gcc/$(uname -m)-pc-linux-gnu/8.2.0/include ln -sfv ld-linux.so.2 /lib/ld-lsb.so.3 ;; x86_64) GCC_INCDIR=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64 ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3 ;; armv7l) GCC_INCDIR=/usr/lib/gcc/armv7l-unknown-linux-gnueabi/8.2.0/include ln -sfv ld-linux.so.3 /lib/ld-lsb.so.3 ;; esacChapter 6.10 Adjusting the Toolchain:
mv -v /tools/bin/{ld,ld-old} mv -v /tools/armv7l-unknown-linux-gnueabi/bin/{ld,ld-old} mv -v /tools/bin/{ld-new,ld} ln -sv /tools/bin/ld /tools/armv7l-unknown-linux-gnueabi/bin/ld
git clone https://github.com/u-boot/u-boot cd u-boot/ git checkout v2018.09-rc2 -b tmp wget -c https://rcn-ee.com/repos/git/u-boot-patches/v2018.09-rc2/0001-wandboard-uEnv.txt-bootz-n-fixes.patch patch -p1 < 0001-wandboard-uEnv.txt-bootz-n-fixes.patch make distclean make wandboard_defconfig makeYou should find now two files: SPL and u-boot.img. Assume your SD card is /dev/sdb, install U-Boot with this commands (as root):
dd if=/dev/zero of=/dev/sdb bs=1M count=10 dd if=SPL of=/dev/sdb seek=1 bs=1k dd if=u-boot.img of=/dev/sdb seek=69 bs=1kTo create a partition, use the program sfdisk (as root). You should use a newer version (=> 2.26):
sfdisk /dev/sdb <<-__EOF__ 1M,3G,L,* __EOF__
git clone https://github.com/RobertCNelson/armv7-multiplatform cd armv7-multiplatform/ git checkout origin/v4.18.x -b tmp ./build_kernel.shAt the end the kernel, modules and dtbs archive has been build. You get an overview, copy and paste it. Example:
'arch/arm/boot/zImage' -> '/sources/kernel2/armv7-multiplatform/deploy/4.18.8-armv7-x8.zImage' '.config' -> '/sources/kernel2/armv7-multiplatform/deploy/config-4.18.8-armv7-x8' -rwxr-xr-x 1 root root 6,5M 18. Jan 23:22 /sources/kernel2/armv7-multiplatform/deploy/4.18.8-armv7-x8.zImage ----------------------------- Building modules archive... Compressing 4.18.8-armv7-x8-modules.tar.gz... -rw-r--r-- 1 root root 20M 18. Jan 23:30 /sources/kernel2/armv7-multiplatform/deploy/4.18.8-armv7-x8-modules.tar.gz ----------------------------- Building dtbs archive... Compressing 4.18.8-armv7-x8-dtbs.tar.gz... -rw-r--r-- 1 root root 4,3M 18. Jan 23:30 /sources/kernel2/armv7-multiplatform/deploy/4.18.8-armv7-x8-dtbs.tar.gz ----------------------------- Script Complete eewiki.net: [user@localhost:~$ export kernel_version=4.18.8-armv7-x8]In this example the kernel version is 4.18.8-armv7-x8 Create /boot/uEnv.txt with this content:
uname_r=4.18.8-armv7-x8 cmdline=video=HDMI-A-1:1024x768@60euname_r is the kernel that U-Boot should load. The filename must start with vmlinuz, so copy and rename the kernel:
cp -v ./armv7-multiplatform/deploy/4.18.8-armv7-x8.zImage /boot/vmlinuz-4.18.8-armv7-x8Install the dtbs files:
mkdir -p /boot/dtbs/4.18.8-armv7-x8/ tar xfv ./armv7-multiplatform/deploy/4.18.8-armv7-x8-dtbs.tar.gz -C /boot/dtbs/4.18.8-armv7-x8/Install kernel modules (again: you might need to modify the path, take care that you don't destroy your host system /lib!):
tar xfv ./armv7-multiplatform/deploy/4.18.8-armv7-x8-modules.tar.gz -C /
uname_r=4.18.8-armv7-x8 cmdline=root=/dev/sda1 rw video=HDMI-A-1:1024x768@60e
Finally you must the tell the system that there is a DS1307 RTC. With my minimal LFS system from above, edit /etc/rc.d/init.d/settimeviantp and add the red lines:
case "$1" in start) echo "try to set time via DS1307" echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device sleep 3 /sbin/hwclock --rtc /dev/rtc1 --hctosys echo "Setting time via NTP from ptbtime1.ptb.de..." sleep 10 /usr/sbin/ntpdate -s ptbtime1.ptb.de sleep 1 ;;The echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device command is important. This tells the kernel that there is a DS1307 device. Of course the kernel needs to be compiled with I2C and DS1307 RTC support.
Run now /etc/rc.d/init.d/settimeviantp start
At dmesg you should see that the DS1307 recognized:
root@wandboard:~ # dmesg | grep ds1307 [ 12.591586] rtc-ds1307 0-0068: registered as rtc1 [ 12.597197] i2c i2c-0: new_device: Instantiated device ds1307 at 0x68The DS1307 is registered as rtc1, so we have to tell the hwclock command via parameter --rtc /dev/rtc1 that this should be used.
To set the time to the DS1307 RTC from the current kernel time which has been hopefully set via NTP, use:
root@wandboard:~ # hwclock --rtc /dev/rtc1 -wYou may want to create a crontab script that updates at least one time per day the time via NTP and sync to the DS1307.
If something doesn't work it is always good to check with I2C Tools. Does it see the DS1307?
root@wandboard:~ # i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --If you see instead of 68 only UU: you have set already the device via settimeviantp script (echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device)
Keep in mind: the Wandboard has two I2C busses, my wiring from above is on the first I2C bus, which is checked via the parameter -y 0
zurück zur Linuxübersicht
Letzte Aktualisierung dieser Seite: 21. September 2018