Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the builddeb script so linux-image upgrades work correctly #4508

Merged
merged 1 commit into from
Nov 30, 2022
Merged

Fix the builddeb script so linux-image upgrades work correctly #4508

merged 1 commit into from
Nov 30, 2022

Conversation

SteeManMI
Copy link
Contributor

Fix the builddeb script so linux-image upgrades work correctly
on fat /boot partitions.

Currently the postinst file that is created has the following contents:
...
ln -sf vmlinuz-6.0.10-meson64 /boot/Image 2> /dev/null || mv /boot/vmlinuz-6.0.10-meson64 /boot/Image
touch /boot/.next

mkimage -A arm64 -O linux -T kernel -C none -a 0x1080000 -e 0x1080000 -n "Linux" -d /boot/vmlinuz-6.0.10-meson64 /boot/uImage > /dev/null 2>&1
exit 0
...

In the first line on a fat filesystem the mv command leaves the system without a file named 'vmlinuz...'. The following mkimage command is looking for the vmlinuz... file that is no longer there and fails.
This fix changes the 'mv' to a 'cp' so that the files in the directory are the same regardless of the type of partition (i.e. the softlink in the ext4 case leaves both objects and the fat case now leaves both objects as well, at the cost of disk space)

With this fix the amlogic tv box builds can now upgrade to the latest community build kernels without errors.

Changes to be committed:
modified: packages/armbian/builddeb

Description

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.

  • Local build and tested on both an s905w and s905x2 based amlogic TV box
  • Test B

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

on fat /boot partitions

 Changes to be committed:
	modified:   packages/armbian/builddeb
@The-going The-going added the Bugfix Pull request is fixing a bug label Nov 30, 2022
@The-going
Copy link
Contributor

  • Local build and tested on both an s905w and s905x2 based amlogic TV box

The assembly was successful! There is no doubt about it, but a few questions remain.

Where is the partition for /boot located?
If this is a 16Mb chip, there may not be enough free space (orangepipc2).

Which version of u-boot is installed?

@SteeManMI
Copy link
Contributor Author

SteeManMI commented Nov 30, 2022

Where is the partition for /boot located?

aml-sxxx-box.tvb
BOOTSIZE="512"
BOOTFS_TYPE="fat"

If this is a 16Mb chip, there may not be enough free space (orangepipc2).

This is true, but kernel upgrades on these boxes are also currently broken as the mkimage call is generating an error

Which version of u-boot is installed?

The amlogic tv box install procedure uses the native installed android boot loader to then chainload one of three uboot executables that are shipped as part of this build (depending on cpu type -s905, s905x, s905x2). Those chainloaded uboots are currently at 2020-10.

@The-going
Copy link
Contributor

modified: packages/armbian/builddeb

I haven't looked at this script for a long time.
It requires small changes. Checking the version if greater than 5.19.

I tested images with different file systems and a separate /boot partition on September 11, 2022 and found no errors.
All the images and the full set of packages for them are in my warehouse. I performed an autopsy.
In the kernel package, the postinst script contains:

#!/bin/bash

set -e

# Pass maintainer script parameters to hook scripts
export DEB_MAINT_PARAMS="$*"

# Tell initramfs builder whether it's wanted
export INITRD=Yes

test -d /etc/kernel/postinst.d && run-parts --arg="5.19.8-sunxi64" --arg="/boot/vmlinuz-5.19.8-sunxi64" /etc/kernel/postinst.d

ln -sf vmlinuz-5.19.8-sunxi64 /boot/Image 2> /dev/null || mv /boot/vmlinuz-5.19.8-sunxi64 /boot/Image
touch /boot/.next
exit 0

But the partition with vfat /boot contains the following:

armbianboot> ls
armbianEnv.txt                  config-5.19.8-sunxi64      System.map-5.19.8-sunxi64
armbian_first_run.txt.template  dtb                        uInitrd
boot.bmp                        dtb-5.19.8-sunxi64         vmlinuz-5.19.8-sunxi64
boot.cmd                        Image
boot.scr                        initrd.img-5.19.8-sunxi64

I can't believe my eyes.
There should be a move, but in fact I see copying.
That's why the error was not detected.

We can safely merge this extraction request.

@The-going The-going merged commit 3b8e37f into armbian:master Nov 30, 2022
@SteeManMI SteeManMI deleted the fix-builddeb branch November 30, 2022 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Pull request is fixing a bug
Development

Successfully merging this pull request may close these issues.

3 participants