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

Switch to using directly piboot instead of u-boot #86

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 8 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ define stage_package
endef

# XXX: move classic to use new "$kernel:ref" syntax too and remove the "device-trees" rule
classic: firmware uboot device-trees boot-script config-classic no-kernel-refs-gadget
classic: firmware device-trees config-classic no-kernel-refs-gadget

core: firmware uboot boot-script config-core gadget
core: firmware config-core gadget

firmware: multiverse $(DESTDIR)/boot-assets
# XXX: This deliberately does NOT use $(KERNEL_FLAVOR); not until we've
Expand Down Expand Up @@ -81,43 +81,13 @@ multiverse:
-o Dir::Etc::sourceparts=$(SOURCES_D_MULTIVERSE) \
-o APT::Architecture=$(ARCH) 2>/dev/null

uboot: $(DESTDIR)/boot-assets
$(call stage_package,u-boot-rpi)
for platform_path in $(STAGEDIR)/usr/lib/u-boot/*; do \
cp -a $$platform_path/u-boot.bin \
$(DESTDIR)/boot-assets/uboot_$${platform_path##*/}.bin; \
done

boot-script: $(DESTDIR)/boot-assets
$(call stage_package,flash-kernel)
# NOTE: the bootscr.rpi* below is deliberate; older flash-kernels have
# separate bootscr.rpi? files for different pis, while newer have a
# single generic bootscr.rpi file
for kvers in $(STAGEDIR)/lib/modules/*; do \
sed \
-e "s/@@KERNEL_VERSION@@/$${kvers##*/}/g" \
-e "s/@@LINUX_KERNEL_CMDLINE@@/quiet splash/g" \
-e "s/@@LINUX_KERNEL_CMDLINE_DEFAULTS@@//g" \
-e "s/@@UBOOT_ENV_EXTRA@@//g" \
-e "s/@@UBOOT_PREBOOT_EXTRA@@//g" \
$(STAGEDIR)/etc/flash-kernel/bootscript/bootscr.rpi* \
> $(STAGEDIR)/bootscr.rpi; \
done
mkimage -A $(MKIMAGE_ARCH) -O linux -T script -C none -n "boot script" \
-d $(STAGEDIR)/bootscr.rpi $(DESTDIR)/boot-assets/boot.scr

config-core: $(DESTDIR)/boot-assets
# TODO:UC20: currently we use an empty uboot.conf as a landmark for the new
# uboot style where there is no uboot.env installed onto the root
# of the partition and instead the boot.scr is used. this may
# change for the final release
touch $(DESTDIR)/uboot.conf
# the boot.sel file is currently installed onto ubuntu-boot from the gadget
# but that will probably change soon so that snapd installs it instead
# it is empty now, but snapd will write vars to it
mkenvimage -r -s 4096 -o $(DESTDIR)/boot.sel - < /dev/null
cp -a configs/core/config.txt.$(ARCH) $(DESTDIR)/boot-assets/config.txt
cp -a configs/core/cmdline.txt $(DESTDIR)/boot-assets/cmdline.txt
# The empty piboot.conf tells snapd this to use the piboot bootloader
touch $(DESTDIR)/piboot.conf
cp -a configs/core/config.txt.$(ARCH) $(DESTDIR)/config.txt
sed -i 's/^kernel=.*/kernel=kernel.img/' $(DESTDIR)/config.txt
printf '\ninitramfs initrd.img followkernel\nos_prefix=\n' >> $(DESTDIR)/config.txt
Copy link
Contributor

Choose a reason for hiding this comment

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

This appears to leave "os_prefix=" without a value. I assume that needs an update?

Copy link
Member Author

Choose a reason for hiding this comment

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

config.txt will be modified in the snap prepare-image step with the right os_prefix - note that the value cannot be known before that as initially it points to the install system.

cp -a configs/core/cmdline.txt $(DESTDIR)/cmdline.txt

config-classic: $(DESTDIR)/boot-assets
cp -a configs/classic/*.txt $(DESTDIR)/boot-assets/
Expand Down
10 changes: 5 additions & 5 deletions gadget.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
volumes:
pi:
schema: mbr
bootloader: u-boot
bootloader: piboot
structure:
- name: ubuntu-seed
role: system-seed
Expand All @@ -15,16 +15,16 @@ volumes:
target: /overlays
- source: boot-assets/
target: /
- source: cmdline.txt
target: /
- source: config.txt
target: /
- name: ubuntu-boot
role: system-boot
filesystem: vfat
type: 0C
# whats the appropriate size?
size: 750M
content:
# TODO:UC20: install the boot.sel via snapd instead of via the gadget
- source: boot.sel
target: uboot/ubuntu/boot.sel
# NOTE: ubuntu-save is optional for unencrypted devices like the pi, so
# this structure can be dropped in favor of a different partition for
# users who wish to instead use a different partition, since with MBR we
Expand Down
8 changes: 4 additions & 4 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ parts:
# as otherwise its just safer to use the build environment - it offers
# much more flexibility.
if [ "$SNAPCRAFT_ARCH_TRIPLET" = "x86_64-linux-gnu" ] || [ -z "$SNAPCRAFT_ARCH_TRIPLET" ]; then
OPTIONAL_ARGS="SOURCES_HOST=\"./helpers/cross-sources.list\" SOURCES_D_HOST=\"./helpers\""
OPTIONAL_ARGS="SERIES_HOST=\"focal\" SOURCES_HOST=\"./helpers/cross-sources.list\" SOURCES_D_HOST=\"./helpers\""
fi
make -C $SNAPCRAFT_PART_SRC core \
DESTDIR=${SNAPCRAFT_PART_INSTALL} \
ARCH="$(dpkg-architecture -t $BUILD_ARCH_TRIPLET -q DEB_HOST_ARCH)" \
${OPTIONAL_ARGS:-}
prime:
- boot-assets/*
- uboot.conf
- boot.sel
- piboot.conf
- cmdline.txt
- config.txt
build-packages:
- u-boot-tools
- lsb-release
- dpkg-dev
- make
Expand Down