dev.nlited.com

>>

Yocto From Scratch

<<<< prev
next >>>>

2015-12-22 04:08:40 chip Page 1475 📢 PUBLIC

Mon Dec 21 2015

I am following the tutorial on hackgnar.com to get started. Building "from scratch" using Yocto is a bit of a misnomer, as I will be creating almost nothing. Yocto is a build framework that allows me to mix and match projects written and published by others into a my own custom boot disk.


Mistake icon

I am documenting the entire process, including my mistakes. To skip over these steps, jump to to create the build machine, or Yocto Speed Run to jump straight into using Yocto.


First I need a build machine: Creating Vekolako

Then I need to create the builder account: Linux: Creating a New User

21:44> Now I have a usable chip profile, and I still have ubuntu in reserve in case the chip profile becomes unusable.

I create a yocto directory on the 80GB SSD that will hold my development environment.


vekolako: 1~> sudo mkdir /mnt/yocto 2~> sudo chown chip /mnt/yocto 3~> ln -s /mnt/yocto yocto 4~> cd yocto 5yocto>

Yocto Bootstrap

21:50> Back to the yocto tutorial...


vekolako: 105:49:29 yocto> sudo apt-get install -y gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath libsdl1.2-dev xterm curl 2lots of 404 not found errors 305:51:41 yocto> sudo apt-get update 405:52:24 yocto> sudo apt-get install -y gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath libsdl1.2-dev xterm curl 5much better 605:54:15 yocto> mkdir overo 705:55:21 yocto> cd overo 805:55:23 overo> curl -O http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo 905:56:34 overo> chmod a+x repo 1005:56:48 overo> sudo mv repo /usr/local/bin 1105:57:07 overo> repo init -u git://github.com/gumstix/Gumstix-YoctoProject-Repo.git 12GitHub won't let me fetch without an email address 13*** Please tell me who you are. 14 15Run 16 17 git config --global user.email "you@example.com" 18 git config --global user.name "Your Name" 19 20to set your account's default identity. 21Omit --global to set the identity only in this repository. 22 23fatal: empty ident name (for ) not allowed 2405:57:47 overo> git config --global user.email "chip.yocto@nlited.com" 2505:59:19 overo> git config --global user.name "Chip Doran" 2605:59:30 overo> repo init -u git://github.com/gumstix/Gumstix-YoctoProject-Repo.git 27repo has been initialized in /mnt/yocto/overo 2806:00:07 overo> repo sync 29Super-fast, 12MB/s 30Fetching projects: 100% (7/7), done. 31Syncing work tree: 100% (7/7), done. 32 3306:01:10 overo> export TEMPLATECONF=meta-gumstix-extras/conf 3406:02:16 overo> source ./poky/oe-init-build-env 35Let's make this monster earn its paycheck... 3606:02:28 build> export PARALLEL_MAKE="-j 32" 3706:03:21 build> bitbake -c fetchall gumstix-console-image 3806:13:15 build> bitbake gumstix-console-image 39NOTE: Started PRServer with DBfile: /mnt/yocto/overo/build/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 50864, PID: 19981 40Loading cache: 100% |############################################| ETA: 00:00:00 41Loaded 2836 entries from dependency cache. 42Parsing recipes: 100% |##########################################| Time: 00:00:01 43Parsing of 2300 .bb files complete (2297 cached, 3 parsed). 2838 targets, 150 skipped, 9 masked, 0 errors. 44NOTE: Resolving any missing task queue dependencies 45 46Build Configuration: 47BB_VERSION = "1.26.0" 48BUILD_SYS = "x86_64-linux" 49NATIVELSBSTRING = "Ubuntu-14.04" 50TARGET_SYS = "arm-poky-linux-gnueabi" 51MACHINE = "overo" 52DISTRO = "poky" 53DISTRO_VERSION = "1.8" 54TUNE_FEATURES = "arm armv7a vfp neon callconvention-hard cortexa8" 55TARGET_FPU = "vfp-neon" 56meta 57meta-yocto = "(nobranch):83aa565d93aacae484976562ef1ae8dbbb6b2bc0" 58meta-gnome 59meta-oe 60meta-xfce 61meta-systemd 62meta-networking 63meta-multimedia 64meta-python = "(nobranch):10d3c8f85280a0bf867a8e4f84bcda81c290d28e" 65meta-gumstix = "(nobranch):68e4b5771aef2d11fcf04bb8759fecd409de1ac3" 66meta-gumstix-extras = "(nobranch):0ee78d47ff3082000e9e087b1ec0d56df13457d9" 67meta-ros = "(nobranch):d465a23c0a96e651419d46b29ab7c0c3663da314" 68meta-ti = "(nobranch):03cb3ff15f3b8535ca409ce682f44ec1b81da0c3" 69meta-java = "(nobranch):66c97ae7461f4c1a13917131787bb76dc34e6b6f" 70 71NOTE: Preparing RunQueue 72NOTE: Executing SetScene Tasks 73NOTE: Executing RunQueue Tasks 74Currently 8 running tasks (591 of 3792): 750: gettext-native-0.19.4-r0 do_configure (pid 12869) 761: rpm-native-5.4.14-r0 do_configure (pid 8267) 772: perl-native-5.20.0-r0 do_configure (pid 23868) 783: linux-gumstix-3.18-r0 do_patch (pid 11711) 794: gcc-cross-initial-arm-4.9.2-r0 do_compile (pid 23125) 805: alsa-lib-native-1.0.28-r0 do_configure (pid 10089) 816: libxml2-native-2.9.2-r0 do_compile (pid 16940) 827: libpng-native-1.6.16-r0 do_compile (pid 24026) 83WARNING: /mnt/yocto/overo/build/tmp/work/all-poky-linux/volatile-binds/1.0-r0/volatile-binds-1.0 ('S') doesn't exist, please set 'S' to a proper value 84WARNING: /mnt/yocto/overo/build/tmp/work/overo-poky-linux-gnueabi/systemd-serialgetty/1.0-r5/systemd-serialgetty-1.0 ('S') doesn't exist, please set 'S' to a proper value 85WARNING: /mnt/yocto/overo/build/tmp/work/cortexa8hf-vfp-neon-poky-linux-gnueabi/nmon/13g-r2/nmon-13g ('S') doesn't exist, please set 'S' to a proper value 86WARNING: cpufrequtils-dev-008 was registered as shlib provider for libcpufreq.so.0, changing it to cpufrequtils-008 because it was built later 87WARNING: log_check: There is a warn message in the logfile 88WARNING: log_check: Matched keyword: [WARNING:] 89WARNING: log_check: WARNING: Staat_der_Nederlanden_Root_CA_-_G3.pem does not contain a certificate or CRL: skipping 90 91WARNING: log_check: There is a warn message in the logfile 92WARNING: log_check: Matched keyword: [WARNING:] 93WARNING: log_check: WARNING: USERTrust_RSA_Certification_Authority.pem does not contain a certificate or CRL: skipping 94 95WARNING: log_check: There is a warn message in the logfile 96WARNING: log_check: Matched keyword: [WARNING:] 97WARNING: log_check: WARNING: S-TRUST_Universal_Root_CA.pem does not contain a certificate or CRL: skipping 98 99WARNING: log_check: There is a warn message in the logfile 100WARNING: log_check: Matched keyword: [WARNING:] 101WARNING: log_check: WARNING: IdenTrust_Commercial_Root_CA_1.pem does not contain a certificate or CRL: skipping 102 103WARNING: log_check: There is a warn message in the logfile 104WARNING: log_check: Matched keyword: [WARNING:] 105WARNING: log_check: WARNING: Staat_der_Nederlanden_EV_Root_CA.pem does not contain a certificate or CRL: skipping 106 107WARNING: log_check: There is a warn message in the logfile 108WARNING: log_check: Matched keyword: [WARNING:] 109WARNING: log_check: WARNING: USERTrust_ECC_Certification_Authority.pem does not contain a certificate or CRL: skipping 110 111WARNING: log_check: There is a warn message in the logfile 112WARNING: log_check: Matched keyword: [WARNING:] 113WARNING: log_check: WARNING: GlobalSign_ECC_Root_CA_-_R5.pem does not contain a certificate or CRL: skipping 114 115WARNING: log_check: There is a warn message in the logfile 116WARNING: log_check: Matched keyword: [WARNING:] 117WARNING: log_check: WARNING: Entrust_Root_Certification_Authority_-_G2.pem does not contain a certificate or CRL: skipping 118 119WARNING: log_check: There is a warn message in the logfile 120WARNING: log_check: Matched keyword: [WARNING:] 121WARNING: log_check: WARNING: Entrust_Root_Certification_Authority_-_EC1.pem does not contain a certificate or CRL: skipping 122 123WARNING: log_check: There is a warn message in the logfile 124WARNING: log_check: Matched keyword: [WARNING:] 125WARNING: log_check: WARNING: GlobalSign_ECC_Root_CA_-_R4.pem does not contain a certificate or CRL: skipping 126 127WARNING: log_check: There is a warn message in the logfile 128WARNING: log_check: Matched keyword: [WARNING:] 129WARNING: log_check: WARNING: COMODO_RSA_Certification_Authority.pem does not contain a certificate or CRL: skipping 130 131WARNING: log_check: There is a warn message in the logfile 132WARNING: log_check: Matched keyword: [WARNING:] 133WARNING: log_check: WARNING: IdenTrust_Public_Sector_Root_CA_1.pem does not contain a certificate or CRL: skipping 134 135WARNING: log_check: There is a warn message in the logfile 136WARNING: log_check: Matched keyword: [WARNING:] 137WARNING: log_check: WARNING: CFCA_EV_ROOT.pem does not contain a certificate or CRL: skipping 138 139WARNING: log_check: There is a warn message in the logfile 140WARNING: log_check: Matched keyword: [WARNING:] 141WARNING: log_check: WARNING: The license listed Firmware-Marvell was not in the licenses collected for linux-firmware 142 143WARNING: log_check: There is a warn message in the logfile 144WARNING: log_check: Matched keyword: [WARNING:] 145WARNING: log_check: WARNING: The license listed Firmware-Marvell was not in the licenses collected for linux-firmware 146 147WARNING: log_check: There is a warn message in the logfile 148WARNING: log_check: Matched keyword: [WARNING:] 149WARNING: log_check: WARNING: The license listed Firmware-ti-connectivity was not in the licenses collected for linux-firmware 150 151WARNING: log_check: There is a warn message in the logfile 152WARNING: log_check: Matched keyword: [WARNING:] 153WARNING: log_check: WARNING: The license listed Firmware-ti-connectivity was not in the licenses collected for linux-firmware 154 155NOTE: Tasks Summary: Attempted 3792 tasks of which 512 didn't need to be rerun and all succeeded. 156 157Summary: There were 55 WARNING messages shown. 15807:19:15 build>

The downloads in the fetchall command were done in less than a minute, most of the time was spent compiling the build tools. It looks like my decision to go with AWS is paying off so far.

22:15> The initial build will take at least an hour, even on a super-computer. Time to take a break and let vekolako churn through the build.

22:16> It appears bitbake is limited to 8 build tasks.

23:19> The initial build completed in just over one hour, or about 1:15 if including the prefetch. The build used about 30GB of disk space.


vekolako: 107:43:20 overo> df -h 2Filesystem Size Used Avail Use% Mounted on 3/dev/xvda1 7.8G 1.4G 6.0G 19% / 4none 4.0K 0 4.0K 0% /sys/fs/cgroup 5udev 7.4G 12K 7.4G 1% /dev 6tmpfs 1.5G 352K 1.5G 1% /run 7none 5.0M 0 5.0M 0% /run/lock 8none 7.4G 0 7.4G 0% /run/shm 9none 100M 0 100M 0% /run/user 10/dev/xvdb 79G 29G 47G 38% /mnt

Now I need to move the boot image files down to my local computer.


vekolako: 107:21:28 build> cd tmp/deploy/images/overo 207:22:50 overo> pwd 3/mnt/yocto/overo/build/tmp/deploy/images/overo
VS12: 1Z:\Share\overo>pscp -load vekolako chip@54.153.11.107:/home/chip/yocto/overo/build/tmp/deploy/images/overo/MLO . 2MLO | 56 kB | 56.2 kB/s | ETA: 00:00:00 | 100%

I need to copy MLO (bootstrap 57KB), u-boot.img (bootloader 459KB), zImage (linux kernel 4.6MB), and gumstix-console-image-overo.tar.bz2 (rootfs 62MB). UBI (101MB) and UBIFS (100MB) versions of rootfs were also built. Downloading takes about 10 minutes.

Now I need to copy my mkcard.sh script from the Nirvana project and modify it to use the slightly different file names.

I started with nothing but an AWS account at 20:42 and built a complete build machine and boot disk in about 3 hours. Very good, if it works!

However, it is late and I am tired. It is best to finish this job in the morning when I am less likely to make mistakes and less apt to become frustrated if the boot disk doesn't work on the first try.

I don't want to leave vekolako running, as I am paying for each cpu cycle.
07:50:17 overo> sudo shutdown now
Although I can no longer connect to vekolako, the EC2 page still shows it as running. I guess I need to explicitly stop the instance from the EC2 control panel? Restarting the instance from the EC2 page takes about 30 seconds to appear as "running".

Mistake icon

YIPES! First I noticed that the instance restarted with a completely different IP address, then I found I had lost everything on the SSD drive! The /mnt directory is completely empty after the restart! Apparently the SSD is considered "ephemeral storage". My chip user configuration persisted, so the 8GB /dev/sda volume is persistent. Tomorrow I will need to do some research on exactly what vekolako provides, possibly create a new elastic volume for it, experiment with stopping the instance and restarting it, then rerun the yocto build. I really only lost about an hour of compute time.

Blog post giving an in-depth explanation of what is meant by "ephemeral storage". For instance, as they are a temporary storage, you should not rely on these disks to keep long-term data or even other data that you would not like to lose when a failure happens (i.e stop/start instance, failure on the underlying hardware, terminating instance), for these purposes please bear in mind that EBS/S3 or any other persistent storage will be your best choice.


I need to create a dedicated Elastic Block Store volume of 80GB, allocate an Elastic IP address (on the 172.31.X.X subnet), and attach them to vekolako. Then create a test file on the 80GB volume, stop the instance, restart it, and verify that the IP address doesn't change and that the test file survives. Then I can rebuild the yocto environment.


Dec 22 2015

While I was waiting for the rebuilt vekolako to build again, I modified the mknirvanacard.sh script mkboot and cooked a boot disk from the image I created last night. Miraculously, it booted up!
root@overo:~# uname -a Linux overo 3.18.18-custom #1 SMP Tue Dec 22 06:43:36 UTC 2015 armv7l GNU/Linux root@overo:~#

SUCCESS!



WebV7 (C)2018 nlited | Rendered by tikope in 46.782ms | 18.216.244.2