Git Product home page Git Product logo

mastering-embedded-linux-programming-third-edition's Introduction

Mastering Embedded Linux Programming – Third Edition

Mastering Embedded Linux Programming – Third Edition

This is the code repository for Mastering Embedded Linux Programming – Third Edition, published by Packt.

Create fast and reliable embedded solutions with Linux 5.4 and the Yocto Project 3.1 (Dunfell)

What is this book about?

Embedded Linux runs many of the devices we use every day. From smart TVs and Wi-Fi routers to test equipment and industrial controllers, all of them have Linux at their heart. The Linux OS is one of the foundational technologies comprising the core of the Internet of Things (IoT). This book starts by breaking down the fundamental elements that underpin all embedded Linux projects: the toolchain, the bootloader, the kernel, and the root filesystem. After that, you will learn how to create each of these elements from scratch and automate the process using Buildroot and the Yocto Project.

This book covers the following exciting features:

  • Use Buildroot and the Yocto Project to create embedded Linux systems
  • Troubleshoot BitBake build failures and streamline your Yocto development workflow
  • Update IoT devices securely in the field using Mender or balena
  • Prototype peripheral additions by reading schematics, modifying device trees, soldering breakout boards, and probing pins with a logic analyzer
  • Interact with hardware without having to write kernel device drivers

If you feel this book is for you, get your copy today!

Instructions and Navigations

All of the code is organized into folders. For example, Chapter02.

The code will look like the following:

if (test expression)
{
  Statement upon condition is true
}

Following is what you need for this book: If you’re a systems software engineer or system administrator who wants to learn Linux implementation on embedded devices, then this book is for you. Embedded systems engineers accustomed to programming for low-power microcontrollers can use this book to help make the leap to high-speed systems on chips that can run Linux. Anyone responsible for developing new hardware that needs to run Linux will also find this book useful. Basic working knowledge of the POSIX standard, C programming, and shell scripting is assumed.

With the following software and hardware list you can run all code examples present in the book (Chapter 1-21).

Software and Hardware List

Chapters Software/Hardware Required OS Required
3, 4, 5, 6, 9, 11, 12, 15, 21 BeagleBone Black Not Applicable
4, 6, 7, 10, 14, 19, 20 Raspberry Pi 4 Not Applicable
4, 5, 6 QEMU (32-bit arm) Linux (Any)
6, 7, 8, 10, 13, 19, 21 Yocto Project 3.1 (Dunfell) Compatible Linux Distribution
6, 12, 13, 14, 19, 20, 21 Buildroot 2020.02 LTS Linux (Any)
2, 3, 4, 5 Crosstool-NG 1.24.0 Linux (Any)
3, 9 U-Boot v2021.01 Linux (Any)
4 Linux Kernel 5.4 Linux (Any)

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Errata

Preface: In the Download Color Images section link https://static.packt-cdn.com/downloads/9781801071000_ColorImages.pdf should be https://static.packt-cdn.com/downloads/9781789530384_ColorImages.pdf

Page 26: The crosstool-ng-1.24.0 tag of crosstool-ng no longer builds because its expat-2.2.6 and isl-0.20 dependencies were relocated to different hosts. The simplest fix is to clone the latest version of the crosstool-ng source from the master branch of the Git repo.

$ git clone https://github.com/crosstool-ng/crosstool-ng.git
$ cd crosstool-ng
$ ./bootstrap
$ ./configure --prefix=${PWD}
$ make
$ make install

When crosstool-ng's maintainers tag a release after 1.24.0 readers can downgrade to that for stability.

Page 43: http://www.sqlite.org/2020/sqlite-autoconf-3330000.tar.gz may be no longer available. Replace it with an up-to-date source code URL from SQLite Download Page and adjust the subsequent tar and cd commands' arguments.

Page 44: The path where the SQLite header files are installed is wrong. Here is their correct location.

  • <sysroot>/usr/include: sqlite3.h, sqlite3ext.h: These are the header files.

Page 55: TI's x-loader code was integrated into upstream U-Boot back a long time ago. There should be no mention of it when discussing open source SPLs.

Page 67: "which would be sdb in the first example" should use sda instead.

Page 105: The link to the web page where you can download the prebuilt toolchain targeting AArch64 is broken. Here is a working link.

Page 107: The exercise on building a kernel for QEMU is missing a critical step where the versatile_defconfig is selected and a .config file is generated prior to compiling.

$ cd linux-stable
$ make ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabi- mrproper
$ make ARCH=arm versatile_defconfig
$ make -j4 ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabi- zImage
$ make -j4 ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabi- modules
$ make ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabi- dtbs

These commands are also captured in a build-linux-versatilepb.sh script under the Chapter04 directory.

Page 109: The exercise where we boot Linux for the first time on the BeagleBone Black is missing the serial baud rate from the kernel boot parameters. Before entering bootz 0x80200000 - 0x80f00000 at the U-Boot prompt enter the following command:

setenv bootargs console=ttyO0,115200

This command replaces the incomplete setenv bootargs console=ttyO0 command that was printed on that page of the book. The baud rate (115200 in this case) needs to match the setting used in the host terminal program (e.g. gtkterm, minicom, or screen) otherwise we won't see any messages after Starting the kernel ... in the serial console.

Some readers have remarked that the letter O in console=ttyO0 looks like a typo and asked if the console kernel boot parameter should instead be set to tty00 with two zeros. The answer is no, console=ttyO0 is in fact not a typo and console=tty00 is never a valid option. Nowadays, it is best to use console=ttyS0 with TI boards like the BeagleBone Black.

There are two kernel configuration options for the serial driver on the TI AM335x: either SERIAL_8250_OMAP or the generic SERIAL_8250. The OMAP driver is preferable because is supports additional features, but for a serial console it really makes no difference. In older versions of Linux, the OMAP driver was named ttyO using the letter O, but code was added in Linux 3.18 to handle both ttyS and ttyO.

Page 140: The U-Boot commands for loading the am335x-boneblack.dtb and uRamdisk files shoud be on separate lines:

fatload mmc 0:1 0x80f00000 am335x-boneblack.dtb
fatload mmc 0:1 0x81000000 uRamdisk

Page 156: The commands for mounting a root filesystem on QEMU and the BeagleBone Black using NFS are missing the v3 option from the nfsroot kernel boot parameter.

The QEMU start command should look like this:

QEMU_AUDIO_DRV=none \
qemu-system-arm -m 256M -nographic -M versatilepb -kernel ${KERNEL} -append "console=ttyAMA0,115200 root=/dev/nfs rw nfsroot=${HOST_IP}:${ROOTDIR},v3 ip=${TARGET_IP}" -dtb ${DTB} -net nic -net tap,ifname=tap0,script=no

The U-Boot commands should look like this:

setenv serverip <host IP>
setenv ipaddr <target IP>
setenv npath <path to staging directory>
setenv bootargs console=ttyO0,115200n8 root=/dev/nfs rw nfsroot=${serverip}:${npath},v3 ip=${ipaddr}
fatload mmc 0:1 0x80200000 zImage
fatload mmc 0:1 0x80f00000 am335x-boneblack.dtb
bootz 0x80200000 - 0x80f00000

Replace <host IP>, <target IP>, and <path to staging directory> with their actual values. Note that these same placeholder values also need to be updated in the run-qemu-nfsroot.sh and uEnv.txt scripts for Chapter05.

Page 554: To cross-compile the shared-mem-demo example program for Arm Cortex-A8 SoCs:

$ arm-cortex_a8-linux-gnueabihf-gcc shared-mem-demo.c -lrt -pthread \
-o shared-mem-demo

The command printed in the book generates an executable named arm-cortex_a8-linux-gnueabihf-gcc by mistake.

Related products

Get to Know the Authors

Frank Vasquez is a Staff Embedded Software Engineer at Element Energy. He has over a decade of experience designing and building embedded Linux systems. During that time, he has shipped numerous devices including a rackmount DSP audio server, a diver-held sonar camcorder, and a consumer IoT hotspot. Before his career as an embedded Linux engineer, Frank was a database kernel developer at IBM where he worked on Db2. He lives in Silicon Valley.

Chris Simmonds is a software consultant and trainer living in southern England. He has almost two decades of experience in designing and building open-source embedded systems. He is the founder and chief consultant at 2net Ltd, which provides professional training and mentoring services in embedded Linux, Linux device drivers, and Android platform development. He has trained engineers at many of the biggest companies in the embedded world, including ARM, Qualcomm, Intel, Ericsson, and General Dynamics. He is a frequent presenter at open source and embedded conferences, including the Embedded Linux Conference and Embedded World.

Other books by the authors

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781789530384

mastering-embedded-linux-programming-third-edition's People

Contributors

arunpackt avatar fvasquez avatar nithikpackt avatar packt-itservice avatar packtutkarshr avatar pawelszramowski avatar sarvesh-packt avatar shawnpdoherty avatar the-real-neil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mastering-embedded-linux-programming-third-edition's Issues

Chapter02: exports not consumed by Makefiles

If Chapter02/set-path-arm-cortex_a8-linux-gnueabihf does this...

PATH=${HOME}/x-tools/arm-cortex_a8-linux-gnueabihf/bin/:$PATH
export CROSS_COMPILE=arm-cortex_a8-linux-gnueabihf-
export ARCH=arm

...then why are those variables never consumed by any of the following Makefiles?

Indeed, because the CROSS_COMPILE prefix is never used, it is the host's CC that is invoked. Indeed, the README shows exactly that:

You should have two executables: hello-arm-shared and hello-arm-static

You should have two executables: hello-arm-shared and hello-arm-static
$ list-libs hello-arm-shared 
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libtest.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

$ list-libs hello-arm-static 
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

The book, by contrast, uses the prefixed commands like this:

$ arm-cortex_a8-linux-gnueabihf-gcc -static helloworld.c -o helloworld-static

Is this discrepancy intentional? What purpose, if any, does the set-path-arm-cortex_a8-linux-gnueabihf script serve here?

Chapter 7 : do_rootfs: The postinstall intercept hook 'update_font_cache' failed

can you help me with this issue

I am trying to build a yocto image for raspberrypi3 and i got this when typing bitbake rpi-test-image :

Loading cache: 100% |############################################| Time: 0:00:00

Loaded 3302 entries from dependency cache.

NOTE: Resolving any missing task queue dependencies



Build Configuration:

BB_VERSION = "1.46.0"

BUILD_SYS = "x86_64-linux"

NATIVELSBSTRING = "universal"

TARGET_SYS = "aarch64-poky-linux"

MACHINE = "raspberrypi3-64"

DISTRO = "poky"

DISTRO_VERSION = "3.1.28"

TUNE_FEATURES = "aarch64 cortexa53 crc"

TARGET_FPU = ""

meta

meta-poky

meta-yocto-bsp = "dunfell:f980ef9fec58217b4b743c0ee103d5957894676a"

meta-oe

meta-python

meta-networking

meta-multimedia = "dunfell:e42d1e758f9f08b98c0e8c6f0532316951bb276f"

meta-raspberrypi = "dunfell:2081e1bb9a44025db7297bfd5d024977d42191ed"



Initialising tasks: 100% |#######################################| Time: 0:00:04

Sstate summary: Wanted 3 Found 0 Missed 3 Current 1810 (0% match, 99% complete)

NOTE: Executing Tasks

ERROR: rpi-test-image-1.0-r0 do_rootfs: The postinstall intercept hook 'update_font_cache' failed, details in /home/sa3ed/yocto/test/build-rpi/tmp/work/raspberrypi3_64-poky-linux/rpi-test-image/1.0-r0/temp/log.do_rootfs

ERROR: Logfile of failure stored in: /home/sa3ed/yocto/test/build-rpi/tmp/work/raspberrypi3_64-poky-linux/rpi-test-image/1.0-r0/temp/log.do_rootfs.2996

ERROR: Task (/home/sa3ed/yocto/test/meta-raspberrypi/recipes-core/images/rpi-test-image.bb:do_rootfs) failed with exit code '1'

NOTE: Tasks Summary: Attempted 4609 tasks of which 4608 didn't need to be rerun and 1 failed.



Summary: 1 task failed:

/home/sa3ed/yocto/test/meta-raspberrypi/recipes-core/images/rpi-test-image.bb:do_rootfs

Summary: There was 1 ERROR message shown, returning a non-zero exit code.

Pag 29 - Error during Building a toochain for QEMU

Pag 29 - Error during Building a toochain for QEMU after the command:

bin/ct-ng build

[INFO ] Installing MPC for host: done in 8.79s (at 04:47)
[INFO ] =================================================================
[INFO ] Installing binutils for host
[EXTRA] Configuring binutils
[EXTRA] Building binutils
[ERROR] make[2]: *** [Makefile:7650: configure-ld] Error 1
[ERROR] make[2]: *** Waiting for unfinished jobs....
[ERROR] make[1]: *** [Makefile:1034: all] Error 2
[ERROR]
[ERROR] >>
[ERROR] >> Build failed in step 'Installing binutils for host'
[ERROR] >> called in step '(top-level)'
[ERROR] >>
[ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@377]
[ERROR] >> called from: do_binutils_backend[scripts/build/binutils/binutils.sh@214]
[ERROR] >> called from: do_binutils_for_host[scripts/build/binutils/binutils.sh@70]
[ERROR] >> called from: main[scripts/crosstool-NG.sh@708]
[ERROR] >>
[ERROR] >> For more info on this error, look at the file: 'build.log'
[ERROR] >> There is a list of known issues, some with workarounds, in:
[ERROR] >> https://crosstool-ng.github.io/docs/known-issues/
[ERROR] >>
[ERROR] >> If you feel this is a bug in crosstool-NG, report it at:
[ERROR] >> https://github.com/crosstool-ng/crosstool-ng/issues/
[ERROR] >>
[ERROR] >> Make sure your report includes all the information pertinent to this issue.
[ERROR] >> Read the bug reporting guidelines here:
[ERROR] >> http://crosstool-ng.github.io/support/
[ERROR]
[ERROR] (elapsed: 5:08.38)
[05:08] / make: *** [bin/ct-ng:261: build] Error 2

I'm using a real machine with 20.04 Desktop Ubuntu. I have tried on VMs also, and i had the same error.

Could anyone help me ?

Issue mounting rootfs via NFS

Thanks for creating this great book.
I have some improvement suggestions, but I am not sure whether this is a problem which only occurs on certain host machines.
I already created an issue here for this topic : PacktPublishing/Mastering-Embedded-Linux-Programming-Second-Edition#8 .

I had to adapt the commands to mount a rootfs from a NFS server for both QEMU and BBB.
For both cases, I had to append the option v3 to the nfsroot linux command line parameter.

The QEMU start command then looks like this

QEMU_AUDIO_DRV=none \
    qemu-system-arm -m 256M -nographic -M versatilepb -kernel
    ${KERNEL} -append "console=ttyAMA0,115200 root=/dev/nfs rw
    nfsroot=${HOST_IP}:${ROOTDIR},v3 ip=${TARGET_IP}" -dtb ${DTB} -net
    nic -net tap,ifname=tap0,script=no

On the BBB, I used DHCP, so the U-Boot command looked like this (assuming the host IP is known of course, can be found with ifconfig):

dhcp
setenv serverip <hostIp>
setenv npath <pathToRootfsOnHost>
setenv bootargs console=ttyO0,115200n8 root=/dev/nfs rw nfsroot=${serverip}:${npath},v3 ip=dhcp
fatload mmc 0:1 0x80200000 zImage
fatload mmc 0:1 0x80f00000 am335x-boneblack.dtb
bootz 0x80200000 - 0x80f00000

Also, after a change to etc/exports, I think the changes can be applied with the command

sudo exportfs -ra

and it should not be necessary to restart the nfs server

Trouble mounting rootfs using NFS on BBB

Hello, I'm at the section "Testing with the BeagleBone Black" on page 156 and my BeagleBone can't seem to connect to the NFS server. I'm sure that the server itself is working since I ran the previous QEMU test just fine. The added wrinkle here is that I'm using Windows 10 and the NFS server is running in WSL.

Here are the U-Boot commands I entered:

=> setenv serverip 192.168.1.1
=> setenv ipaddr 192.168.1.101
=> setenv npath /home/qsvui/projects/rootfs-bbb
=> setenv bootargs console=ttyO0,115200 root=/dev/nfs rw nfsroot=${serverip}:${npath},v3 ip=${ipaddr}
=> fatload mmc 0:1 0x80200000 zImage
9081344 bytes read in 584 ms (14.8 MiB/s)
=> fatload mmc 0:1 0x80f00000 am335x-boneblack.dtb
58300 bytes read in 6 ms (9.3 MiB/s)
=> bootz 0x80200000 - 0x80f00000
## Flattened Device Tree blob at 80f00000
   Booting using the fdt blob at 0x80f00000
   Loading Device Tree to 8ffee000, end 8ffff3bb ... OK

Note that I did insert the v3 as stated in the errata.

Here's the following kernel start messages:

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.4.50 (qsvui@gjaio-PC) (gcc version 8.5.0 (crosstool-NG 1.25.0)) #1 SMP Fri Oct 6 22:53:01 PDT 2023
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: TI AM335x BeagleBone Black
[    0.000000] Memory policy: Data cache writeback
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: UEFI not found.
[    0.000000] cma: Reserved 64 MiB at 0x9b800000
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] AM335X ES2.1 (sgx neon)
[    0.000000] percpu: Embedded 20 pages/cpu s49228 r8192 d24500 u81920
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 129540
[    0.000000] Kernel command line: console=ttyO0,115200 root=/dev/nfs rw nfsroot=192.168.1.1:/home/qsvui/projects/rootfs-bbb,v3 ip=192.168.1.101
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 429224K/522240K available (12288K kernel code, 1657K rwdata, 5204K rodata, 2048K init, 393K bss, 27480K reserved, 65536K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=16 to nr_cpu_ids=1.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] IRQ: Found an INTC at 0x(ptrval) (revision 5.0) with 128 interrupts
[    0.000000] random: get_random_bytes called from start_kernel+0x314/0x4b4 with crng_init=0
[    0.000000] OMAP clockevent source: timer2 at 24000000 Hz
[    0.000018] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000037] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000047] OMAP clocksource: timer1 at 24000000 Hz
[    0.006345] timer_probe: no matching timers found
[    0.006545] Console: colour dummy device 80x30
[    0.006574] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
[    0.006580] This ensures that you still see kernel messages. Please
[    0.006586] update your kernel commandline.
[    0.006627] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
[    0.089093] pid_max: default: 32768 minimum: 301
[    0.089273] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.089287] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.090022] CPU: Testing write buffer coherency: ok
[    0.090090] CPU0: Spectre v2: using BPIALL workaround
[    0.090455] CPU0: thread -1, cpu 0, socket -1, mpidr 0
[    0.091083] Setting up static identity map for 0x80300000 - 0x803000ac
[    0.093159] rcu: Hierarchical SRCU implementation.
[    0.097256] EFI services will not be available.
[    0.097437] smp: Bringing up secondary CPUs ...
[    0.097450] smp: Brought up 1 node, 1 CPU
[    0.097458] SMP: Total of 1 processors activated (996.14 BogoMIPS).
[    0.097466] CPU: All CPU(s) started in SVC mode.
[    0.098014] devtmpfs: initialized
[    0.108488] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    0.108799] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.108830] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[    0.112918] pinctrl core: initialized pinctrl subsystem
[    0.115365] DMI not present or invalid.
[    0.115898] NET: Registered protocol family 16
[    0.118310] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.146404] l3-aon-clkctrl:0000:0: failed to disable
[    0.150159] cpuidle: using governor menu
[    0.176993] No ATAGs?
[    0.177003] hw-breakpoint: debug architecture 0x4 unsupported.
[    0.185014] Serial: AMBA PL011 UART driver
[    0.207467] edma 49000000.edma: TI EDMA DMA engine driver
[    0.208571] AT91: Could not find identification node
[    0.212315] iommu: Default domain type: Translated 
[    0.212766] vgaarb: loaded
[    0.213781] SCSI subsystem initialized
[    0.214398] usbcore: registered new interface driver usbfs
[    0.214454] usbcore: registered new interface driver hub
[    0.214515] usbcore: registered new device driver usb
[    0.216223] pps_core: LinuxPPS API ver. 1 registered
[    0.216235] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    0.216257] PTP clock support registered
[    0.216474] EDAC MC: Ver: 3.0.0
[    0.220281] clocksource: Switched to clocksource timer1
[    0.711333] thermal_sys: Registered thermal governor 'step_wise'
[    0.711905] NET: Registered protocol family 2
[    0.712565] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.712595] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.712638] TCP bind hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.712696] TCP: Hash tables configured (established 4096 bind 4096)
[    0.712805] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.712828] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.712988] NET: Registered protocol family 1
[    0.713690] RPC: Registered named UNIX socket transport module.
[    0.713704] RPC: Registered udp transport module.
[    0.713710] RPC: Registered tcp transport module.
[    0.713716] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.713730] PCI: CLS 0 bytes, default 64
[    0.714926] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
[    0.716408] Initialise system trusted keyrings
[    0.716740] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[    0.724070] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.725070] NFS: Registering the id_resolver key type
[    0.725115] Key type id_resolver registered
[    0.725122] Key type id_legacy registered
[    0.725166] ntfs: driver 2.1.32 [Flags: R/O].
[    0.725839] Key type asymmetric registered
[    0.725852] Asymmetric key parser 'x509' registered
[    0.725910] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
[    0.725920] io scheduler mq-deadline registered
[    0.725928] io scheduler kyber registered
[    0.734873] OMAP GPIO hardware version 0.1
[    0.807018] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[    0.890358] Serial: 8250/16550 driver, 5 ports, IRQ sharing enabled
[    0.895382] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 29, base_baud = 3000000) is a 8250
[    1.518118] printk: console [ttyS0] enabled
[    1.524870] SuperH (H)SCI(F) driver initialized
[    1.531244] msm_serial: driver initialized
[    1.535692] STMicroelectronics ASC driver initialized
[    1.543215] STM32 USART driver initialized
[    1.549597] omap_rng 48310000.rng: Random Number Generator ver. 20
[    1.566415] random: fast init done
[    1.569950] random: crng init done
[    1.583688] brd: module loaded
[    1.594470] loop: module loaded
[    1.613722] libphy: Fixed MDIO Bus: probed
[    1.619003] CAN device driver interface
[    1.624769] bgmac_bcma: Broadcom 47xx GBit MAC driver loaded
[    1.632447] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    1.638308] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    1.644384] igb: Intel(R) Gigabit Ethernet Network Driver - version 5.6.0-k
[    1.651403] igb: Copyright (c) 2007-2014 Intel Corporation.
[    1.720291] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
[    1.728008] libphy: 4a101000.mdio: probed
[    1.733616] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
[    1.742981] cpsw 4a100000.ethernet: initialized cpsw ale version 1.4
[    1.749366] cpsw 4a100000.ethernet: ALE Table size 1024
[    1.754821] cpsw 4a100000.ethernet: Detected MACID = 64:8c:bb:f0:52:32
[    1.763396] pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver
[    1.771032] usbcore: registered new interface driver pegasus
[    1.776765] usbcore: registered new interface driver asix
[    1.782283] usbcore: registered new interface driver ax88179_178a
[    1.788432] usbcore: registered new interface driver cdc_ether
[    1.794362] usbcore: registered new interface driver smsc75xx
[    1.800171] usbcore: registered new interface driver smsc95xx
[    1.805992] usbcore: registered new interface driver net1080
[    1.811725] usbcore: registered new interface driver cdc_subset
[    1.817700] usbcore: registered new interface driver zaurus
[    1.823367] usbcore: registered new interface driver cdc_ncm
[    1.833296] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.839866] ehci-pci: EHCI PCI platform driver
[    1.844468] ehci-platform: EHCI generic platform driver
[    1.850120] ehci-orion: EHCI orion driver
[    1.854556] SPEAr-ehci: EHCI SPEAr driver
[    1.858855] ehci-st: EHCI STMicroelectronics driver
[    1.864081] ehci-exynos: EHCI EXYNOS driver
[    1.868523] ehci-atmel: EHCI Atmel driver
[    1.872848] tegra-ehci: Tegra EHCI driver
[    1.877145] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.883440] ohci-pci: OHCI PCI platform driver
[    1.887974] ohci-platform: OHCI generic platform driver
[    1.893628] SPEAr-ohci: OHCI SPEAr driver
[    1.897923] ohci-st: OHCI STMicroelectronics driver
[    1.903136] ohci-atmel: OHCI Atmel driver
[    1.908424] usbcore: registered new interface driver usb-storage
[    1.924144] i2c /dev entries driver
[    1.951332] sdhci: Secure Digital Host Controller Interface driver
[    1.957558] sdhci: Copyright(c) Pierre Ossman
[    1.964035] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
[    1.972866] omap_hsmmc 48060000.mmc: Got CD GPIO
[    2.029051] omap_hsmmc 47810000.mmc: RX DMA channel request failed
[    2.038398] Synopsys Designware Multimedia Card Interface Driver
[    2.047053] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.058860] ledtrig-cpu: registered to indicate activity on CPUs
[    2.067030] usbcore: registered new interface driver usbhid
[    2.072723] usbhid: USB HID core driver
[    2.083253] drop_monitor: Initializing network drop monitor service
[    2.090625] NET: Registered protocol family 10
[    2.096568] Segment Routing with IPv6
[    2.100427] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    2.107099] NET: Registered protocol family 17
[    2.111645] can: controller area network core (rev 20170425 abi 9)
[    2.117944] NET: Registered protocol family 29
[    2.122441] can: raw protocol (rev 20170425)
[    2.126730] can: broadcast manager protocol (rev 20170425 t)
[    2.132448] can: netlink gateway (rev 20190810) max_hops=1
[    2.138713] Key type dns_resolver registered
[    2.143260] ThumbEE CPU extension supported.
[    2.147568] Registering SWP/SWPB emulation handler
[    2.152423] omap_voltage_late_init: Voltage driver support not added
[    2.160557] Loading compiled-in X.509 certificates
[    2.185849] mmc0: host does not support reading read-only switch, assuming write-enable
[    2.196574] mmc0: new high speed SDHC card at address 5048
[    2.202951] mmcblk0: mmc0:5048 SK32G 29.7 GiB 
[    2.210691]  mmcblk0: p1 p2
[    2.231912] tps65217 0-0024: TPS65217 ID 0xe version 1.2
[    2.238311] at24 0-0050: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
[    2.245797] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[    2.270649] mmc1: new high speed MMC card at address 0001
[    2.276871] mmcblk1: mmc1:0001 MK2704 3.53 GiB 
[    2.281778] mmcblk1boot0: mmc1:0001 MK2704 partition 1 2.00 MiB
[    2.287976] mmcblk1boot1: mmc1:0001 MK2704 partition 2 2.00 MiB
[    2.294359] mmcblk1rpmb: mmc1:0001 MK2704 partition 3 512 KiB, chardev (235:0)
[    2.303545]  mmcblk1: p1
[    2.392955] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
[    2.399746] hctosys: unable to open rtc device (rtc0)
[    2.406391] cpsw 4a100000.ethernet: initializing cpsw version 1.12 (0)
[    2.511155] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)
[    5.680954] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
[    5.700302] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    5.730420] IP-Config: Guessing netmask 255.255.255.0
[    5.735497] IP-Config: Complete:
[    5.738740]      device=eth0, hwaddr=64:8c:bb:f0:52:32, ipaddr=192.168.1.101, mask=255.255.255.0, gw=255.255.255.255
[    5.749335]      host=192.168.1.101, domain=, nis-domain=(none)
[    5.755295]      bootserver=255.255.255.255, rootserver=192.168.1.1, rootpath=
[   41.440291] rpcbind: server 192.168.1.1 not responding, timed out

Note the last message saying the server is not responding.

My /etc/exports should be fine:

# /etc/exports: the access control list for filesystems which may be exported
#		to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
/home/qsvui/projects/rootfs-bbb *(rw,sync,no_subtree_check,no_root_squash)

Do you have any thoughts on what the issue might be?

RE: Rebuilding Ramdisk

Hello,

Please view my second question below. I am updating this error/issue to handle the below text instead of what was previously stated in this issue. Please forgive me.

Seth

`gen_initramfs_list.sh` command line errors

Hi. Referencing MELP, 3rd ed, Chapter 5, Creating a boot initramfs, page 143.

The paragraph starting with "The task of creating an initramfs device table from scratch is made easier..." cites using the script located in linux-stable/usr and to change the UID and GID to 0 and 0. However the command line example is in error and should read (if I understand correctly):

$ bash linux-stable/usr/gen_initramfs_list.sh -u 0 -g 0 rootfs > initramfs-device-table

And in the paragraph after, starting with "Using this script's -o option ..." it is unclear if the example command line should use the -o option? If so, the example command line should be modified how?

Thanks.

Unable to ssh in the QEMU VM

Hello:

Working through MELP, 3rd Ed.

In Chapter 7, page 218, after building and confirming the QEMU VM runs (using runqemu qemuarm64 nographic), I try to ssh into it by opening a new Terminal tab and enter ssh [email protected].

The connection attempt eventually fails on a time out.

Similarly down on page 219 at step 7, running devtool deploy-target bubblewrap [email protected] also fails with a connection time out.

Everything seems to be up and running as it should on the QEMU VM. Starting it and running through the startup console dump gives:

runqemu - INFO - If this is not intended, touch /tmp/qemu-tap-locks/tap0.skip to make runqemu skip tap0.
runqemu - INFO - Network configuration: ip=192.168.7.2::192.168.7.1:255.255.255.0::eth0:off:8.8.8.8 net.ifnames=0
runqemu - INFO - Running /home/resu/build-mine/tmp/work/x86_64-linux/qemu-helper-native/1.0/recipe-sysroot-native/usr/bin/qemu-system-aarch64 -device virtio-net-pci,netdev=net0,mac=52:54:00:12:34:02 -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 -drive id=disk0,file=/home/resu/build-mine/tmp/deploy/images/qemuarm64/core-image-full-cmdline-qemuarm64.rootfs-20240307222257.ext4,if=none,format=raw -device virtio-blk-pci,drive=disk0 -device qemu-xhci -device usb-tablet -device usb-kbd  -machine virt -cpu cortex-a57 -smp 4 -m 256 -serial mon:stdio -serial null -nographic -device virtio-gpu-pci -kernel /home/resu/build-mine/tmp/deploy/images/qemuarm64/Image -append 'root=/dev/vda rw  mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0::eth0:off:8.8.8.8 net.ifnames=0 console=ttyAMA0 console=hvc0 swiotlb=0 '

Linux version 6.5.13-yocto-standard (oe-user@oe-host) (aarch64-poky-linux-gcc (GCC) 13.2.0, GNU ld (GNU Binutils) 2.41.0.20231213) #1 SMP PREEMPT Thu Dec 14 16:41:39 UTC 2023


Kernel command line: root=/dev/vda rw  mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0::eth0:off:8.8.8.8 net.ifnames=0 console=ttyAMA0 console=hvc0 swiotlb=0 


IP-Config: Complete:
     device=eth0, hwaddr=52:54:00:12:34:02, ipaddr=192.168.7.2, mask=255.255.255.0, gw=192.168.7.1
     host=192.168.7.2, domain=, nis-domain=(none)
     bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath=
     nameserver0=8.8.8.8

INIT: Entering runlevel: 5
Configuring network interfaces... RTNETLINK answers: File exists
Starting OpenBSD Secure Shell server: sshd
done.

Running the ssh connect from the non-QEMU VM Terminal tab in verbose mode gives:

% ssh -vvv [email protected]
OpenSSH_9.2p1 Debian-2+deb12u2, OpenSSL 3.0.11 19 Sep 2023
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.7.2 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/resu/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/resu/.ssh/known_hosts2'
debug3: ssh_connect_direct: entering
debug1: Connecting to 192.168.7.2 [192.168.7.2] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10
debug1: connect to address 192.168.7.2 port 22: Connection timed out
ssh: connect to host 192.168.7.2 port 22: Connection timed out

Other commands executed from within the QEMU VM also seem to indicate that things are OK on the VM.
Examples:

root@qemuarm64:~# ps aux | grep sshd
root       266  0.0  1.6   8544  3752 ?        Ss   21:30   0:00 sshd: /usr/sbin/sshd [listener] 0 of 10-100 startups
root       378 30.0  0.5   2948  1280 ttyAMA0  S+   23:21   0:00 grep sshd

and

root@qemuarm64:~# netstat -plntu | grep ssh
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      266/sshd: /usr/sbin 
tcp6       0      0 :::22                   :::*                    LISTEN      266/sshd: /usr/sbin 

As well, I can telnet in to the VM itself by running (from within the VM): telnet localhost 22 which returns:

Connected to localhost
SSH-2.0-OpenSSH_9.5

So I think all is as it should be on the QEMU side of things?

FWIW, cannot seem to get to the Internet from the QUEM VM. Example, pinging 4.4.4.4 returns Destination Host Unreachable.

Just need the magic keystrokes or config info to get in from outside the VM.

Any hints?

Thanks.

Chapter02 Compile error using toolchain: cannot execute 'cc1'

Followed the book instructions in Chapter 2. Used the same version of cross tool-ng, but encountered several errors such as wget timeouts and binutils " namespace 'std' does not name a type" when I tried to build the toolchain for arm A8. So then I switched to the master branch as suggested by the solution on GitHub. After I switched to the master branch, the build process for both arm A8 and QEMU went through without error. However, when I tried to compile the hello world program with arm A8 toolchain, it throws an error:

arm-cortex_a8-linux-gnueabihf-gcc hello.c -o helloworld
arm-cortex_a8-linux-gnueabihf-gcc: fatal error: cannot execute 'cc1': execvp: No such file or directory
compilation terminated.

I found the cc1 in the libexec/gcc/arm../13.2.0 folder and added the folder to the PATH in ~/.bashrc as follows

export PATH="
~/x-tools/arm-cortex_a8-linux-gnueabihf/bin:\
~/x-tools/arm-cortex_a8-linux-gnueabihf/libexec/gcc/arm-cortex_a8-linux-gnueabihf/13.2.0\
:$PATH"

But still getting the same error.

Then I tried the toolchain for QEMU and it works. I got a helloworld output with arm properties.

I used the -v to check the setting for two gcc. The configuration for qemu shows:

Using built-in specs. COLLECT_GCC=arm-unknown-linux-gnueabi-gcc COLLECT_LTO_WRAPPER=/home/simonzhang/x-tools/arm-unknown-linux-gnueabi/libexec/gcc/arm-unknown-linux-gnueabi/13.2.0/lto-wrapper Target: arm-unknown-linux-gnueabi Configured with: /home/simonzhang/Desktop/crosstool/crosstool-ng/.build/arm-unknown-linux-gnueabi/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=arm-unknown-linux-gnueabi --prefix=/home/simonzhang/x-tools/arm-unknown-linux-gnueabi --exec_prefix=/home/simonzhang/x-tools/arm-unknown-linux-gnueabi --with-sysroot=/home/simonzhang/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot --enable-languages=c,c++ --with-float=soft --with-pkgversion='crosstool-NG 1.25.0.212_285915c' --disable-sjlj-exceptions --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libmpx --with-gmp=/home/simonzhang/Desktop/crosstool/crosstool-ng/.build/arm-unknown-linux-gnueabi/buildtools --with-mpfr=/home/simonzhang/Desktop/crosstool/crosstool-ng/.build/arm-unknown-linux-gnueabi/buildtools --with-mpc=/home/simonzhang/Desktop/crosstool/crosstool-ng/.build/arm-unknown-linux-gnueabi/buildtools --with-isl=/home/simonzhang/Desktop/crosstool/crosstool-ng/.build/arm-unknown-linux-gnueabi/buildtools --enable-lto --enable-threads=posix --enable-target-optspace --enable-plugin --enable-gold --disable-nls --disable-multilib --with-local-prefix=/home/simonzhang/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot --enable-long-long Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.2.0 (crosstool-NG 1.25.0.212_285915c)

The configuration for A8 shows:

Using built-in specs. COLLECT_GCC=arm-cortex_a8-linux-gnueabihf-gcc Target: arm-cortex_a8-linux-gnueabihf Configured with: /home/simonzhang/Desktop/crosstool/crosstool-ng/.build/arm-cortex_a8-linux-gnueabihf/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=arm-cortex_a8-linux-gnueabihf --prefix=/home/simonzhang/x-tools/arm-cortex_a8-linux-gnueabihf --exec_prefix=/home/simonzhang/x-tools/arm-cortex_a8-linux-gnueabihf --with-sysroot=/home/simonzhang/x-tools/arm-cortex_a8-linux-gnueabihf/arm-cortex_a8-linux-gnueabihf/sysroot --enable-languages=c,c++ --with-cpu=cortex-a8 --with-fpu=neon --with-float=hard --with-pkgversion='crosstool-NG 1.25.0.212_285915c' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libmpx --with-gmp=/home/simonzhang/Desktop/crosstool/crosstool-ng/.build/arm-cortex_a8-linux-gnueabihf/buildtools --with-mpfr=/home/simonzhang/Desktop/crosstool/crosstool-ng/.build/arm-cortex_a8-linux-gnueabihf/buildtools --with-mpc=/home/simonzhang/Desktop/crosstool/crosstool-ng/.build/arm-cortex_a8-linux-gnueabihf/buildtools --with-isl=/home/simonzhang/Desktop/crosstool/crosstool-ng/.build/arm-cortex_a8-linux-gnueabihf/buildtools --enable-lto --enable-threads=posix --enable-target-optspace --enable-plugin --enable-gold --disable-nls --disable-multilib --with-local-prefix=/home/simonzhang/x-tools/arm-cortex_a8-linux-gnueabihf/arm-cortex_a8-linux-gnueabihf/sysroot --enable-long-long Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.2.0 (crosstool-NG 1.25.0.212_285915c)

I checked and found that for qemu, the toolchain has a wrapper. And the A8 has the hf settings. Other than that, I don't see any differences.

BBB kernel build fail in chapter 4

Had a problem with building Linux kernel 5.4.50 or 5.4.254. always having problems with ahci.h macros.

linux/drivers/ata/libahci.c: In function 'ahci_led_store':
linux/include/linux/compiler_types.h:357:45: error: call to '__compiletime_assert_302' declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
357 | _compiletime_assert(condition, msg, _compiletime_assert, COUNTER)

After finding the solutions online, I found it was a known problem and already solved in newer versions of kernels when I checked. So to be able to successfully build the kernel, you need to either change the bits shifts to BIT() as instructed or just use a newer kernel.

The solution to the problem is documented here:
https://lore.kernel.org/lkml/[email protected]/

One note is that you need to change SATA_MOBILE_LPM_POLICY to AHCI_HFLAG_IS_MOBILE.

And its also discussed in detail here:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107405

Also what is not mentioned in the book is that when you build, a prompt would ask you the strategy of heap memory zeroing. I don't think it matters a lot and I just choose zeroing when allocating. It's just a tradeoff between performance and security. Maybe the author can give more insight or advice on this.

Chapter 7: FILES command line error

Howdy. Another error. MELP, 3rd Ed.

Page 219, at step 5 this line:

FILES_${PN} += "/usr/share/*"

is in error.

Should be:

FILES:${PN} += "/usr/share/*"

or to be more consistent (as per the Yocto manual):

FILES:${PN} += "${datadir}"

The devtool build bubblewrap command will fail otherwise.

Took me a bit to sort that one out.

What should be in the root filesystem? command line errors

Hi. Referencing MELP, 3rd ed, Chapter 5, What should be in the root filesystem?, page 133

The bottom part of the page shows a sequence of commands to copy the *.so* files into the ~/rootfs/bin directory. The commands as given are in error as they copy the target file to a file called ~/rootfs/lib instead of creating a copy of the file in the intended directory.

Had to:

  • start from ~/rootfs
  • create the lib directory
  • for each cp -a... line, replace lib with ./lib/, like:
cd ~/rootfs && mkdir ./lib/
$ cp -a $SYSROOT/lib/ld-linux-armhf.so.3 ./lib/
.
.
.

Above the "Tip" box there is also the line: "Repeat this procedure for each program." It's a bit unclear what this is referring. Does it mean to copy the files (from the set of commands preceding the statement) to the ~/rootfs/bin directory? If so we just did that so the statement is not needed?

Please note as well issue #71 also related to Chapter 5.

Thanks.

Error in Chapter 2 Page 28

I am getting following error in Chapter 2 page 28, while building tool chain for Beagle Bone Black:

bin/ct-ng build

EXTRA] Retrieving 'isl-0.22'
[ERROR] isl: download failed

Please help in fixing this error.
Thanks and best regards,

/crosstool-ng$ bin/ct-ng build
[INFO ] Performing some trivial sanity checks
[INFO ] Build started 20211030.041930
[INFO ] Building environment variables
[EXTRA] Preparing working directories
[EXTRA] Installing user-supplied crosstool-NG configuration
[EXTRA] =================================================================
[EXTRA] Dumping internal crosstool-NG configuration
[EXTRA] Building a toolchain for:
[EXTRA] build = x86_64-pc-linux-gnu
[EXTRA] host = x86_64-pc-linux-gnu
[EXTRA] target = arm-cortex_a8-linux-gnueabihf
[EXTRA] Dumping internal crosstool-NG configuration: done in 0.09s (at 00:02)
[INFO ] =================================================================
[INFO ] Retrieving needed toolchain components' tarballs
[EXTRA] Retrieving 'isl-0.22'
[ERROR] isl: download failed
[ERROR]
[ERROR] >>
[ERROR] >> Build failed in step 'Retrieving needed toolchain components' tarballs'
[ERROR] >> called in step '(top-level)'
[ERROR] >>
[ERROR] >> Error happened in: CT_Abort[scripts/functions@487]
[ERROR] >> called from: CT_DoFetch[scripts/functions@2125]
[ERROR] >> called from: CT_PackageRun[scripts/functions@2085]
[ERROR] >> called from: CT_Fetch[scripts/functions@2196]
[ERROR] >> called from: do_isl_get[scripts/build/companion_libs/121-isl.sh@16]
[ERROR] >> called from: do_companion_libs_get[scripts/build/companion_libs.sh@15]
[ERROR] >> called from: main[scripts/crosstool-NG.sh@647]
[ERROR] >>
[ERROR] >> For more info on this error, look at the file: 'build.log'
[ERROR] >> There is a list of known issues, some with workarounds, in:
[ERROR] >> https://crosstool-ng.github.io/docs/known-issues/
[ERROR] >>
[ERROR] >> If you feel this is a bug in crosstool-NG, report it at:
[ERROR] >> https://github.com/crosstool-ng/crosstool-ng/issues/
[ERROR] >>
[ERROR] >> Make sure your report includes all the information pertinent to this issue.
[ERROR] >> Read the bug reporting guidelines here:
[ERROR] >> http://crosstool-ng.github.io/support/
[ERROR]
[ERROR] (elapsed: 1:40.44)
[01:41] / bin/ct-ng:261: recipe for target 'build' failed
make: *** [build] Error 1
owner@owner-Lenovo-IdeaPad-S340-15APITouch:~/crosstool-ng$

RE: First off and Secondly

Hello,

Thank you for making this book. It is finally a good read. The more I learn, the more I can function with my own set of settings and standards. Outside of being grateful here...

  1. I have come across an error in u-boot while compiling with the crosstool-ng toolchain.
 make
scripts/kconfig/conf  --syncconfig Kconfig
  CFG     u-boot.cfg
  GEN     include/autoconf.mk
  GEN     include/autoconf.mk.dep
  CFG     spl/u-boot.cfg
  GEN     spl/include/autoconf.mk
  UPD     include/generated/timestamp_autogenerated.h
  ENVC    include/generated/env.txt
  ENVP    include/generated/env.in
  ENVT    include/generated/environment.h
  CC      lib/asm-offsets.s
cc1: error: bad value (‘generic-armv7-a’) for ‘-mtune=’ switch
cc1: note: valid arguments to ‘-mtune=’ switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake tigerlake cooperlake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm intel x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 btver1 btver2 generic native
make[1]: *** [scripts/Makefile.build:147: lib/asm-offsets.s] Error 1
make: *** [Makefile:1965: prepare0] Error 2

  1. I have tried numerous ways to get around it. Do you know if this still works for u-boot?

First: CROSS_COMPILE=/location/to/the/toolchain
Second: make am335x_evm_defconfig
Third: make

This is creating the issue from above. I am only on chapter 3 but the interesting book keeps trying to make me perform better at Linux. Send rations!

Chapter 5 - "Libraries for the root filesystem" missing files

I’m at a bit of an impasse in Chapter 5, Libraries for the root filesystem starting on page 132 (MELP third edition).

Mirroring what is in the book, running these commands and the returned results are:

$ cd ~/rootfs

$ arm-cortex_a8-linux-gnueabihf-readelf -a bin/busybox | grep "program interpreter"
[Requesting program interpreter: /lib/ld-linux-armhf.so.3]

$ arm-cortex_a8-linux-gnueabihf-readelf -a bin/busybox | grep "Shared library"
0x00000001 (NEEDED)                     Shared library: [libm.so.6]
0x00000001 (NEEDED)                     Shared library: [libresolv.so.2]
0x00000001 (NEEDED)                     Shared library: [libc.so.6]

First problem; I get three hits on (NEEDED) libraries where the book only shows two.

Now, at the top of page 133, after creating the shell variable, which in my case resolves to:

$ echo $SYSROOT
/home/xylo/x-tools/arm-cortex_a8-linux-gnueabihf/arm-cortex_a8-linux-gnueabihf/sysroot

And doing

$ ls -l lib/ld-linux-armhf.so.3
-rwxr-xr-x 1 xylo xylo 1178040 Feb 20 12:54 lib/ld-linux-armhf.so.3

Which is an issue as lib/ld-linux-armhf.so.3 is not a symbolic link.

Repeating for libc.so.6 and libm.so.6 I get:

$ ls -l lib/libm.so.6                             
-rwxr-xr-x 1 xylo xylo 1395800 Feb 20 12:54 lib/libm.so.6
$ ls -l lib/libc.so.6 
-rwxr-xr-x 1 xylo xylo 12001768 Feb 20 12:54 lib/libc.so.6

Which are also not symbolic links, but files.

Long way of saying that when copying the libraries and symlinks to the appropriate places, it fails as no links exist to be copied, as shown for example.

$ cp -a $SYSROOT/lib/ld-2.22.so lib
cp: cannot stat '/home/xylo/x-tools/arm-cortex_a8-linux-gnueabihf/arm-cortex_a8-linux-gnueabihf/sysroot/lib/ld-2.22.so': No such file or directory

Which is where I’m stuck as the balance of the Chapter assumes we're working with the *2.22.so files. As well, what to do about the third (NEEDED) library?

Suggestions to resolve would be very appreciated.

FWIW, rolling back to Chapter 2, page 28; I created the arm-cortex_a8-linux-gnueabihf cross compiler as per the instructions, but also in Operating System | Version of linux, changed that to 5.4.248 before doing $ bin/ct-ng build. I had earlier built the cross compile with the default for the linux version (6.something), but the result was the same.

Must say that the book is well done 👍!

Building a Root Filesystem - command line error

Hi. Referencing MELP, 3rd ed, Chapter 5, Building a Root Filesystem, page 140.

In the Booting the BeagleBone Black section,

When entering the U-Boot commands, there is the line
fatload mmc 0:1 0x80f00000 am335x-boneblack.dtb fatload mmc 0:1 0x81000000 uRamdisk

This is two commands and should be entered as:
fatload mmc 0:1 0x80f00000 am335x-boneblack.dtb
then
fatload mmc 0:1 0x81000000 uRamdisk

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.