Updating image of Beaglebone black

I am busy with two part process; first is quick fix to keep our production line running but patching and rebuilding 3.8.13 image to enable flashing to newer eMMC devices, the second is to bring product to more current version.

I am drawing a blank on how I originally created my BBB image after building the kernel, I don’t recall using the script file and am battling finding any relevant links.

Files generated by build are:

-rw-rw-r-- 1 vagrant vagrant    37713 Jan 12 22:37 3.8.13-bone80a-dtbs.tar.gz
-rw-rw-r-- 1 vagrant vagrant  1259472 Jan 12 22:37 3.8.13-bone80a-firmware.tar.gz
-rw-rw-r-- 1 vagrant vagrant 12029365 Jan 12 22:37 3.8.13-bone80a-modules.tar.gz
-rwxrwxr-x 1 vagrant vagrant  5551080 Jan 12 22:37 3.8.13-bone80a.zImage
-rw-rw-r-- 1 vagrant vagrant   110269 Jan 12 22:37 config-3.8.13-bone80a

First prize would be to update the SD card I use to flash the beaglebone, else I guess I could use build-deb, copy deb file to BBB with older kernel and update using the deb and recreate my flasher sd card.

Suggestions appreciated.

build_deb doesn’t work and is failing with several error messages similar to

ERROR: ld.so: object 'libfakeroot-sysv.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.

I ran ./build_deb after running ./build_kernel and tools/rebuild.sh

Referring to Debian: Getting Started with the BeagleBone Black - Linux Guides - Engineering and Component Solution Forum - TechForum │ Digi-Key I see mention made of copying Kernel image (.zImage), device tree binaries (.dtbs) and modules (*-modules) to sd card.

What does one do with the (*-firmware) files?

And is command below, sufficient to setup which image to load? I seem to recall there was a lower level instruction required.

sudo sh -c "echo 'uname_r=${kernel_version}' >> /media/rootfs/boot/uEnv.txt"

“./build_deb.sh” does a full rebuild, just run “./tools/rebuild_deb.sh” does the same thing as "
tools/rebuild.sh"

Welcome to ancient software where host running (32bit or 64bit) and the cross gcc is the other…
Just ignore all 1000+ of those. :wink:

Regards,

Ignore…

depends…

Look at your boot log of existing devices… Where does it load zImage (or even uImage) or something else from?

Next run “lsblk” on your device, so we can see the partition layout…

Then we can help give you hints where to install everything…

Today we have a standard location that’s been going many years… the 3.8.x era we had a lot of movement to fix things…

Regards,

Thanks, will give it a try: I broke my git tree trying to sync :frowning: so am rebuilding now, but here’s output of startup log:

MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
Using default environment

Net:   <ethaddr> not set. Validating first E-fuse MAC
cpsw
Hit any key to stop autoboot:  0 
gpio: pin 53 (gpio 53) value is 1
Card did not respond to voltage select!
Card did not respond to voltage select!
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
switch to partitions #0, OK
mmc1(part 0) is current device
gpio: pin 54 (gpio 54) value is 1
Checking for: /uEnv.txt ...
Checking for: /boot.scr ...
Checking for: /boot/boot.scr ...
Checking for: /boot/uEnv.txt ...
gpio: pin 55 (gpio 55) value is 1
1734 bytes read in 19 ms (88.9 KiB/s)
Loaded environment from /boot/uEnv.txt
Checking if uname_r is set in /boot/uEnv.txt...
gpio: pin 56 (gpio 56) value is 1
Running uname_boot ...
loading /boot/vmlinuz-3.8.13-bone68b ...
5507296 bytes read in 323 ms (16.3 MiB/s)
loading /boot/dtbs/3.8.13-bone68b/am335x-boneblack.dtb ...
26098 bytes read in 22 ms (1.1 MiB/s)
loading /boot/initrd.img-3.8.13-bone68b ...
2843062 bytes read in 175 ms (15.5 MiB/s)
debug: [console=ttyO0,115200n8 capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN root=UUID=328ee82b-3e01-47b0-afdb-fada88f8fa3c ro rootfstype=ext4 rootwait fixrtc quiet init=/lib/systemd/systemd] ...
debug: [bootz 0x82000000 0x88080000:2b61b6 0x88000000] ...
Kernel image @ 0x82000000 [ 0x000000 - 0x5408e0 ]
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Ramdisk to 8fd49000, end 8ffff1b6 ... OK
   Loading Device Tree to 8fd3f000, end 8fd485f1 ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.353658] omap2_mbox_probe: platform not supported
[    0.510418] tps65217-bl tps65217-bl: no platform data provided
[    0.573654] bone-capemgr bone_capemgr.9: slot #0: No cape found
[    0.610755] bone-capemgr bone_capemgr.9: slot #1: No cape found
[    0.647864] bone-capemgr bone_capemgr.9: slot #2: No cape found
[    0.684973] bone-capemgr bone_capemgr.9: slot #3: No cape found
[    0.703576] omap_hsmmc mmc.5: of_parse_phandle_with_args of 'reset' failed
[    0.765322] pinctrl-single 44e10800.pinmux: pin 44e10854 already requested by 44e10800.pinmux; cannot claim for gpio-leds.8
[    0.777023] pinctrl-single 44e10800.pinmux: pin-21 (gpio-leds.8) status -22
[    0.784312] pinctrl-single 44e10800.pinmux: could not request pin 21 on device pinctrl-single
Loading, please wait...
systemd-fsck[197]: rootfs: clean, 88402/227584 files, 504435/909056 blocks

Debian GNU/Linux 7

BeagleBoard.org Debian Image 2015-03-08                                 

Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian

Biocharger (tm) Advanced Biotechnologies LLC

Support: http://biocharger.com
biochargerng login: [   11.968951] libphy: PHY 4a101000.mdio:01 not found
[   11.974022] net eth0: phy 4a101000.mdio:01 not found on slave 1

Perfect, your image is new enough…

Just use “./build_deb.sh” or “./tools/rebuild_deb.sh” and copy the linux-image*.deb from ./deploy/ and just install it on the board with “sudo dpkg -i linux-image*.deb”

Debian GNU/Linux 7

BeagleBoard.org Debian Image 2015-03-08

Hold on thou… There is a bug in wheezy…

# disable "uniform compression" for wheezy package
dpkg_for_wheezy () {
	# only disable for 3.8.13 kernels
#	kernel_base=$(echo ${kernel_tag} | awk -F'-' '{print $1}')
#	if [ "x${kernel_base}" != "x3.8.13" ] ; then
#		return
#	fi
	# only disable for dpkg 1.19.0 or newer
	dpkg_version_current=$(dpkg-query -f='${Version}' --show dpkg)
	dpkg_version_uniform_compression="1.19.0"
	dpkg --compare-versions $dpkg_version_current ge $dpkg_version_uniform_compression
	if [ $? -eq "0" ] ; then
		sed -i "s/dpkg --build/dpkg-deb --build --no-uniform-compression/" ${DIR}/KERNEL/scripts/package/builddeb
	fi
}

Pushed: Commits · RobertCNelson/bb-kernel · GitHub

open: scripts/git.sh

and un-comment this function

dpkg_for_wheezy

Another user had to disable advanced *.deb option’s that Wheezy’s dpkg doesn’t understand…

Regards,

Can I comment out dpkg_for_wheezy after running build_kernel (or build_deb) or after commenting it out must I re-run build_deb?

So I wasn’t using am33x-v3.8 although did try it but don’t recall offhand what the issue was. I have been using tag 3.8.13-bone68 as that is what my original build was and I wanted to keep changes to a minimum (as this was meant to be a quick fix).

Am I correct in assuming that am33x-v3.8 is the latest iteration for 3.8.xx - ie could be 3.8.xx-boneYY

Just patch this file:

voodoo@hestia:/opt/github/bb.org/yakbuild/KERNEL$ git diff scripts/package/builddeb
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 172be740..c42c4821 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -31,7 +31,7 @@ create_package() {
 
        # Create the package
        dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}" -p$pname -P"$pdir"
-       dpkg --build "$pdir" ..
+       dpkg-deb --build --no-uniform-compression "$pdir" ..
 }
 
 set_debarch() {

Regards,

Correct, that was the intention. :wink:

1 Like

I also found an old script I had created. Looks like I transfer output of build to BBB and then ran script below - risk as it’s very specific to the BBB layout.

As mentioned I have been working with 3.8.13-bone68 tag which is STILL building… but will try the am33x-v3.8 which I recall failing but will try and the .deb route does sound the best

#!/bin/sh
#script to be run from insertable SD card to update linux kernel to bone68a patched kernel.

KERNEL_UTS="3.8.13-bone68b"
valid_kernel="3.8.13-bone68a"

#DIR=$PWD
DIR='/media/runner'
LCD='/dev/tty0'

unset current_kernel
current_kernel=$(grep uname_r /boot/uEnv.txt | grep -v '#' | awk -F"=" '{print $2}' || true)

broadcast () {
	if [ "x${message}" != "x" ] ; then
		echo "${message}"
	    echo "${message}" > $LCD || true
    fi
}

message="Current Kernel $current_kernel";broadcast

if [ $current_kernel != $valid_kernel ]; then
        message="Invalid Kernel found, exiting...";broadcast
        exit 1
fi

mmc_write_rootfs () {
	message="Installing ${KERNEL_UTS}-modules.tar.gz";broadcast

	if [ -d "/lib/modules/${KERNEL_UTS}" ] ; then
		sudo rm -rf "/lib/modules/${KERNEL_UTS}" || true
	fi

	sudo tar xf "${DIR}/deploy/${KERNEL_UTS}-modules.tar.gz" -C "/"
	sync

	if [ -f "${DIR}/deploy/config-${KERNEL_UTS}" ] ; then
		if [ -f "/boot/config-${KERNEL_UTS}" ] ; then
			sudo rm -f "/boot/config-${KERNEL_UTS}" || true
		fi
		sudo cp -v "${DIR}/deploy/config-${KERNEL_UTS}" "/boot/config-${KERNEL_UTS}"
		sync
	fi
	message="update initramfs";broadcast
	sudo update-initramfs -ck ${KERNEL_UTS}
	message="info: [${KERNEL_UTS}] now installed...";broadcast
}

mmc_write_boot_uname () {
	message="Installing ${KERNEL_UTS}";broadcast

	if [ -f "${location}/vmlinuz-${KERNEL_UTS}_bak" ] ; then
		sudo rm -f "${location}/vmlinuz-${KERNEL_UTS}_bak" || true
	fi

	if [ -f "${location}/vmlinuz-${KERNEL_UTS}" ] ; then
		sudo mv "${location}/vmlinuz-${KERNEL_UTS}" "${location}/vmlinuz-${KERNEL_UTS}_bak"
	fi

	sudo cp -v "${DIR}/deploy/${KERNEL_UTS}.zImage" "${location}/vmlinuz-${KERNEL_UTS}"

	if [ -f "${location}/initrd.img-${KERNEL_UTS}" ] ; then
		sudo rm -rf "${location}/initrd.img-${KERNEL_UTS}" || true
	fi

	if [ -f "${DIR}/deploy/${KERNEL_UTS}-dtbs.tar.gz" ] ; then
		if [ -d "${location}/dtbs/${KERNEL_UTS}_bak/" ] ; then
			sudo rm -rf "${location}/dtbs/${KERNEL_UTS}_bak/" || true
		fi

		if [ -d "${location}/dtbs/${KERNEL_UTS}/" ] ; then
			sudo mv "${location}/dtbs/${KERNEL_UTS}/" "${location}/dtbs/${KERNEL_UTS}_bak/" || true
		fi

		sudo mkdir -p "${location}/dtbs/${KERNEL_UTS}/"

		message="Installing ${KERNEL_UTS}-dtbs.tar.gz to ${location}/dtbs/${KERNEL_UTS}";broadcast
		sudo tar xf "${DIR}/deploy/${KERNEL_UTS}-dtbs.tar.gz" -C "${location}/dtbs/${KERNEL_UTS}/"
		sync
	fi

	unset older_kernel
	older_kernel=$(grep uname_r "${location}/uEnv.txt" | grep -v '#' | awk -F"=" '{print $2}' || true)

	if [ ! "x${older_kernel}" = "x" ] ; then
		if [ ! "x${older_kernel}" = "x${KERNEL_UTS}" ] ; then
			sudo sed -i -e 's:uname_r='${older_kernel}':uname_r='${KERNEL_UTS}':g' "${location}/uEnv.txt"
		fi
		message="info: /boot/uEnv.txt: `grep uname_r ${location}/uEnv.txt`";broadcast
	fi
}

if [ -f "/boot/uEnv.txt" ] ; then
	location="/boot/"
	mmc_write_boot_uname
	location=""
	mmc_write_rootfs
	sync
else
	message="ERROR, /boot/uEnv.txt not found!";broadcast
	exit 1
fi

That looks fine, to install…

For your current 3.8.13-bone68 tag, these are the two patches you need:

Regards,

Gotcha. thanks!

Another question. for am33x-v3.8 branch how does one prevent downloading of toolchain and linux-stable.git? I must be doing something wrong as each time I run build_kernel it downloads linux src as well as toolchain (I am rerunning as my rebuild.sh failed after my patch and I want to catch logs).

I thought in setting CC and LINUX_GIT in system.sh should be sufficient to prevent download and rather use these static files.

Looking at scripts/git.sh it appears that LINUX_GIT can be full path to folder containing downloaded linux source.

I have settings in system.sh as:

CC=/vagrant/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin/arm-linux-gnueabihf-
###OPTIONAL:

###OPTIONAL: LINUX_GIT: specify location of locally cloned git tree.
#
#LINUX_GIT=/home/user/linux-stable/
LINUX_GIT=/vagrant/linux-src/

Directory listing of /vagrant is:

vagrant@vagrant-ubuntu-trusty-64:~$ ls -l /vagrant

drwxr-xr-x 1 vagrant vagrant 4096 Sep 21  2016 gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux
drwxrwxr-x 1 vagrant vagrant 4096 Jan 14 18:16 linux-src

It would be nice to resolve this with my slow connection these downloads take forever.

Really, it’s the 3.8.x branch, it was EOL’ed years ago…

If space is an issue, just use yakbuild, it does a very shallow git clone on the specfic tag, (set in recipe.sh)

voodoo@debian-vm-repo:~$ git clone https://github.com/RobertCNelson/yakbuild
Cloning into 'yakbuild'...
remote: Enumerating objects: 534, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 534 (delta 22), reused 23 (delta 12), pack-reused 496
Receiving objects: 100% (534/534), 105.08 KiB | 1.05 MiB/s, done.
Resolving deltas: 100% (422/422), done.
voodoo@debian-vm-repo:~$ cd yakbuild/
voodoo@debian-vm-repo:~/yakbuild$ cp recipe.sh.v3.8.x.sample recipe.sh
voodoo@debian-vm-repo:~/yakbuild$ cat recipe.sh | grep tag
kernel_tag="3.8.13-bone86"
voodoo@debian-vm-repo:~/yakbuild$ ./build_kernel.sh 
voodoo@debian-vm-repo:~/yakbuild$ du -sh ./*
8.0K	./build_deb.sh
8.0K	./build_kernel.sh
4.0K	./deploy
692M	./KERNEL
4.0K	./LICENSE
32K	./patches
4.0K	./patch.sh
4.0K	./readme.md
4.0K	./recipe.sh
4.0K	./recipe.sh.sample
4.0K	./recipe.sh.v3.14.x.sample
4.0K	./recipe.sh.v3.8.x.sample
4.0K	./recipe.sh.v4.14.x.sample
4.0K	./recipe.sh.v4.19.x.sample
4.0K	./recipe.sh.v4.1.x.sample
4.0K	./recipe.sh.v4.4.x.sample
4.0K	./recipe.sh.v4.9.x.sample
40K	./repo_maintenance
44K	./scripts
4.0K	./system.sh
4.0K	./system.sh.sample
60K	./tools
4.0K	./version.sh

Regards,