Expose boot eMMC partitions and mark them as bootable
Can be used to install for example Tow-Boot from a host PC
This commit is contained in:
parent
8f296e08a4
commit
2ae4b2e471
|
@ -1,6 +1,7 @@
|
|||
/*.img
|
||||
/*.apk
|
||||
/initramfs/bin/busybox
|
||||
/initramfs/bin/mmc
|
||||
/initramfs-*
|
||||
/build
|
||||
/dtbs
|
||||
|
@ -10,6 +11,7 @@
|
|||
/src/linux-librem5
|
||||
/src/linux-sdm845
|
||||
/src/busybox
|
||||
/src/mmc-utils
|
||||
/src/u-boot
|
||||
/src/u-boot-pocketpc
|
||||
/src/u-boot-librem5
|
||||
|
|
15
Makefile
15
Makefile
|
@ -1,3 +1,4 @@
|
|||
CC = aarch64-linux-gnu-gcc
|
||||
CROSS_FLAGS = ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
|
||||
CROSS_FLAGS_BOOT = CROSS_COMPILE=aarch64-linux-gnu-
|
||||
|
||||
|
@ -119,12 +120,18 @@ initramfs/bin/busybox: src/busybox src/busybox_config
|
|||
@cp src/busybox_config build/busybox/.config
|
||||
@$(MAKE) -C src/busybox O=../../build/busybox $(CROSS_FLAGS)
|
||||
@cp build/busybox/busybox initramfs/bin/busybox
|
||||
|
||||
initramfs/bin/mmc-utils: src/mmc-utils
|
||||
@echo "MAKE $@"
|
||||
@mkdir -p build/mmc-utils
|
||||
@$(MAKE) -C src/mmc-utils O=../../build/mmc-utils CFLAGS="-Wno-error -static" CC=$(CC)
|
||||
@cp src/mmc-utils/mmc initramfs/bin/mmc
|
||||
|
||||
splash/%.ppm.gz: splash/%.ppm
|
||||
@echo "GZ $@"
|
||||
@gzip < $< > $@
|
||||
|
||||
initramfs-%.cpio: initramfs/bin/busybox initramfs/init initramfs/init_functions.sh splash/%.ppm.gz splash/%-error.ppm.gz
|
||||
initramfs-%.cpio: initramfs/bin/busybox initramfs/bin/mmc-utils initramfs/init initramfs/init_functions.sh splash/%.ppm.gz splash/%-error.ppm.gz
|
||||
@echo "CPIO $@"
|
||||
@rm -rf initramfs-$*
|
||||
@cp -r initramfs initramfs-$*
|
||||
|
@ -309,6 +316,12 @@ src/busybox:
|
|||
@wget https://www.busybox.net/downloads/busybox-1.32.0.tar.bz2
|
||||
@tar -xf busybox-1.32.0.tar.bz2 --strip-components 1 -C src/busybox
|
||||
|
||||
src/mmc-utils:
|
||||
@echo "WGET mmc-utils"
|
||||
@mkdir src/mmc-utils
|
||||
@wget https://git.kernel.org/pub/scm/utils/mmc/mmc-utils.git/snapshot/mmc-utils-0eea71e4f22a837ed59e607743767df2d038825e.tar.gz
|
||||
@tar -xf mmc-utils-0eea71e4f22a837ed59e607743767df2d038825e.tar.gz --strip-components 1 -C src/mmc-utils
|
||||
|
||||
.PHONY: clean cleanfast purism-librem5
|
||||
|
||||
purism-librem5: initramfs-purism-librem5.gz kernel-librem5.gz u-boot-librem5.bin src/purism-librem5.txt dtbs/librem5/imx8mq-librem5-r2.dtb
|
||||
|
|
|
@ -46,6 +46,10 @@ The dependencies are:
|
|||
- aarch64-linux-gnu- toolchain
|
||||
- u-boot tools
|
||||
- mtools
|
||||
- swig
|
||||
- dtc
|
||||
- cpio
|
||||
- bc
|
||||
|
||||
Additional dependencies for the Purism Librem 5:
|
||||
- arm-none-eabi- toolchain
|
||||
|
@ -72,5 +76,6 @@ Generates an image for every supported platform in parallel
|
|||
- [Busybox](https://busybox.net) - which is [GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).
|
||||
- [postmarketOS](https://postmarketos.org) scripts - which is [GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).
|
||||
- [Pine64's kernel fork](https://gitlab.com/pine64-org/linux) - which is [GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).
|
||||
- [U-Boot](https://github.com/u-boot/u-boot) - which has [multiple licenses](https://github.com/u-boot/u-boot/tree/master/Licenses)
|
||||
- [U-Boot](https://github.com/u-boot/u-boot) - which has [multiple licenses](https://github.com/u-boot/u-boot/tree/master/Licenses).
|
||||
- [mmc-utils](https://www.kernel.org/doc/html/latest/driver-api/mmc/mmc-tools.html) - which is [GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).
|
||||
|
||||
|
|
|
@ -58,10 +58,27 @@ setup_usb_configfs() {
|
|||
echo $EMMC > $CONFIGFS/g1/functions/"$usb_mass_storage_function"/lun.0/file
|
||||
echo $SD > $CONFIGFS/g1/functions/"$usb_mass_storage_function"/lun.1/file
|
||||
|
||||
if [ -n "$EMMC_BOOT" ]; then
|
||||
echo "$EMMC_BOOT" > $CONFIGFS/g1/functions/"$usb_mass_storage_function"/lun.2/file
|
||||
fi
|
||||
|
||||
# Rename the mass storage device
|
||||
echo "JumpDrive eMMC" > $CONFIGFS/g1/functions/"$usb_mass_storage_function"/lun.0/inquiry_string
|
||||
echo "JumpDrive microSD" > $CONFIGFS/g1/functions/"$usb_mass_storage_function"/lun.1/inquiry_string
|
||||
|
||||
if [ -n "$EMMC_BOOT" ]; then
|
||||
echo "JumpDrive eMMC Boot" > $CONFIGFS/g1/functions/"$usb_mass_storage_function"/lun.2/inquiry_string
|
||||
|
||||
# Make sure the boot partitions are rw
|
||||
for f in /sys/block/mmcblk*boot*/force_ro; do
|
||||
echo 0 > "$f"
|
||||
done
|
||||
|
||||
# Mark the boot partitions as bootable
|
||||
mmc bootbus set single_hs x1 x4 "$EMMC_BOOT"
|
||||
mmc bootpart enable 1 1 "$EMMC_BOOT"
|
||||
fi
|
||||
|
||||
# Link the rndis/mass_storage instance to the configuration
|
||||
ln -s $CONFIGFS/g1/functions/"$usb_rndis_function" $CONFIGFS/g1/configs/c.1 \
|
||||
|| echo " Couldn't symlink $usb_rndis_function"
|
||||
|
|
|
@ -2,6 +2,7 @@ PLATFORM=pine64-pinephone
|
|||
MANUFACTURER=Pine64
|
||||
PRODUCT=PinePhone
|
||||
EMMC=/dev/mmcblk2
|
||||
EMMC_BOOT=/dev/mmcblk2boot1
|
||||
SD=/dev/mmcblk0
|
||||
LED=red\:indicator
|
||||
TRIGGER=mmc2
|
||||
|
|
Loading…
Reference in New Issue