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

u-boot rework #2178

Merged
merged 6 commits into from
Nov 11, 2017
Merged

u-boot rework #2178

merged 6 commits into from
Nov 11, 2017

Conversation

lrusak
Copy link
Member

@lrusak lrusak commented Nov 3, 2017

I'm wanting to get this in before #2177
I'll rework #2129 after this gets in

This makes u-boot much simpler however there is still some work to go as there are different boot scripts available (boot.scr, extlinux.conf, etc) but this is a step in the right direction.

This allows for a device specific release script and mkimage script. This is the only way to make things generic enough to suit all different projects.

$PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/mkimage
$PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader/release

This PR moves all the heavy lifting to the new scripts/uboot_helper script. This script is designed to provide info for dtb, uboot config, uboot image, seek, blocksize and more. I think this is the best way forward rather than a bunch of #ifdefs

u-boot will be rebuilt each time UBOOT_SYSTEM is changed as a specific stamp for the u-boot package is created. if UBOOT_SYSTEM is the same u-boot will not be rebuilt.

This also doesn't install u-boot to the project tarball (if not defining UBOOT_SYSTEM) this is so we can have a tarball that can be used for all boards. u-boot will not be updated but the normal update will occur and the dtb files will be updated as well. If someone wants to update u-boot they just have to update using a newer device specific image.

@@ -223,7 +217,7 @@ makeinstall_target() {
if [ "$BOOTLOADER" = "u-boot" ]; then
mkdir -p $INSTALL/usr/share/bootloader
for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb; do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of copying all dtbs, name could be taken from scripts/uboot_helper. In some cases a lot of unrelated dtbs can be built. Is there any usecase when dtb is build but U-Boot is not used? RPi maybe?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least with imx6 only required dtbs were build: https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/imx6/options#L36
Seems similar situation for RPi/RPi2.
This functionality should work the same after rework.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter. This way is just fine as it will work for the "general" image. In the update.sh we can control which dtb is updated.


makeinstall_target() {
mkdir -p $INSTALL/usr/bin
cp -P $PKG_BUILD/dtc $INSTALL/usr/bin
}

PKG_MAKE_OPTS_HOST="dtc libfdt"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really a big fan of this style of intermingling variable assignments and function declarations... I'd be happier if the above assignment is moved immediately above that for PKG_MAKE_OPTS_TARGET.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@vpeter4
Copy link
Contributor

vpeter4 commented Nov 7, 2017

@lrusak: from jnettlet
here is a mainline u-boot for the mx6
https://github.com/SolidRun/u-boot/tree/master-mx6
next patchset is device-tree overlays

@lrusak
Copy link
Member Author

lrusak commented Nov 8, 2017

overall I'm really happy with this and we should use this as a base to improve upon

@jernejsk
Copy link
Member

jernejsk commented Nov 8, 2017

What needs to be done to remove WIP status?

@lrusak
Copy link
Member Author

lrusak commented Nov 8, 2017

@jernejsk I imagine this will break Odroid_C2. I need to fix that up first

@lrusak
Copy link
Member Author

lrusak commented Nov 9, 2017

@Raybuntu can you test this on Odroid_C2?

@Ray-future
Copy link
Contributor

@lrusak sure I will test it tomorrow morning.

fi
cp -a $(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dts/meson64_odroidc2.dtb $RELEASE_DIR/3rdparty/bootloader
cp -a $(get_build_dir $BOOTLOADER)/u-boot.bin $RELEASE_DIR/3rdparty/bootloader
cp -a $PROJECT_DIR/$PROJECT/bootloader/boot.ini $RELEASE_DIR/3rdparty/bootloader
Copy link
Contributor

@Ray-future Ray-future Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lrusak projects/Odroid_C2/bootloader/update.sh is not copied to the tar you might want to include it here.
EDIT: Sorry wrong place. It's not copied to the image of course.

@lrusak
Copy link
Member Author

lrusak commented Nov 10, 2017

@Raybuntu I added extra commits. I think it's ready to go if you say it's all good for odroid_c2. Then I can squash

Copy link
Contributor

@Ray-future Ray-future left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with tar updates and freshly flashed.
No issues so far.

@lrusak
Copy link
Member Author

lrusak commented Nov 10, 2017

rebased and force pushed. Ready to go 👍

@Kwiboo
Copy link
Member

Kwiboo commented Nov 10, 2017

@lrusak I think this may break a few things on Rockchip, why is UBOOT_SYSTEM enforced? On Rockchip there is a need for more then just different u-boot config, it needs different kernel patches, systemd service files and mali driver per device.

@lrusak
Copy link
Member Author

lrusak commented Nov 10, 2017

UBOOT_SYSTEM is only needed when building an image. For making a regular update tar you do not need it.

Unfortunately if the device needs more than just a different bootloader it should be built in a different build dir for the time being. There isn't much we can do about that. (See RPi, slice situation)

@@ -223,7 +217,7 @@ makeinstall_target() {
if [ "$BOOTLOADER" = "u-boot" ]; then
mkdir -p $INSTALL/usr/share/bootloader
for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb; do
cp $dtb $INSTALL/usr/share/bootloader 2>/dev/null || :
cp -v $dtb $INSTALL/usr/share/bootloader
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will break builds on platforms where dtb files are located in subfolders

cp: cannot stat 'arch/arm64/boot/dts/*.dtb': No such file or directory
Makefile:12: recipe for target 'image' failed
make: *** [image] Error 1

Suggest something like:

for dtb in arch/$TARGET_KERNEL_ARCH/boot/dts/*.dtb arch/$TARGET_KERNEL_ARCH/boot/dts/*/*.dtb; do
  if [ -f $dtb ]; then
    cp -v $dtb $INSTALL/usr/share/bootloader
  fi
done

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

@lrusak
Copy link
Member Author

lrusak commented Nov 10, 2017

amended to use extlinux.conf

@Kwiboo
Copy link
Member

Kwiboo commented Nov 10, 2017

@lrusak Thanks for updating this, it is now Rockchip ready 👍

@lrusak
Copy link
Member Author

lrusak commented Nov 11, 2017

squashed and forced pushed. Someone wanna do the honors?

@jernejsk jernejsk merged commit 72db171 into LibreELEC:master Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants