Message ID | a1b80802d391a98e88646e3f49815f23702ae237.1513520257.git.chunkeey@gmail.com |
---|---|
State | Accepted |
Delegated to: | Álvaro Fernández |
Headers | show |
Series | [LEDE-DEV,1/4] brcm2708: convert to metadata | expand |
Applied, thanks! El 17/12/2017 a las 15:18, Christian Lamparter escribió: > This patch converts all the raspberrypi images to utilize > the common metadata-based image verification. > > Note: the CM1 and CM3 currently use the same "rpi-cm" > boardname. > > Signed-off-by: Christian Lamparter <chunkeey@gmail.com> > --- > .../linux/brcm2708/base-files/lib/upgrade/platform.sh | 17 ++--------------- > target/linux/brcm2708/image/Makefile | 7 +++++-- > 2 files changed, 7 insertions(+), 17 deletions(-) > > diff --git a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh > index b7613b446d..5b8e1e15b3 100644 > --- a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh > +++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh > @@ -1,20 +1,7 @@ > -get_magic_at() { > - local file="$1" > - local pos="$2" > - get_image "$file" | dd bs=1 count=2 skip="$pos" 2>/dev/null | hexdump -v -n 2 -e '1/1 "%02x"' > -} > +REQUIRE_IMAGE_METADATA=1 > > platform_check_image() { > - local file="$1" > - local magic > - > - magic=$(get_magic_at "$file" 510) > - [ "$magic" != "55aa" ] && { > - echo "Failed to verify MBR boot signature." > - return 1 > - } > - > - return 0; > + return 0 > } > > platform_do_upgrade() { > diff --git a/target/linux/brcm2708/image/Makefile b/target/linux/brcm2708/image/Makefile > index 7909c6d814..41730b6803 100644 > --- a/target/linux/brcm2708/image/Makefile > +++ b/target/linux/brcm2708/image/Makefile > @@ -50,13 +50,14 @@ define Device/Default > FILESYSTEMS := ext4 > KERNEL := kernel-bin | kernel-img > KERNEL_IMG := kernel.img > - IMAGES := sdcard.img > - IMAGE/sdcard.img := boot-img | sdcard-img > + IMAGES := sdcard.img.gz > + IMAGE/sdcard.img.gz := boot-img | sdcard-img | gzip | append-metadata > endef > > define Device/rpi > DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW > DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-0-w > + SUPPORTED_DEVICES := rpi-b rpi-b-plus rpi-cm rpi-zero-w > endef > ifeq ($(SUBTARGET),bcm2708) > TARGET_DEVICES += rpi > @@ -65,6 +66,7 @@ endif > define Device/rpi-2 > DEVICE_TITLE := Raspberry Pi 2B/3B/3CM > DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-cm3 > + SUPPORTED_DEVICES := rpi-2-b rpi-3-b rpi-cm > endef > ifeq ($(SUBTARGET),bcm2709) > TARGET_DEVICES += rpi-2 > @@ -74,6 +76,7 @@ define Device/rpi-3 > KERNEL_IMG := kernel8.img > DEVICE_TITLE := Raspberry Pi 3B (64 bit) > DEVICE_DTS := broadcom/bcm2710-rpi-3-b > + SUPPORTED_DEVICES := rpi-3-b > endef > ifeq ($(SUBTARGET),bcm2710) > TARGET_DEVICES += rpi-3
diff --git a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh index b7613b446d..5b8e1e15b3 100644 --- a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh +++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh @@ -1,20 +1,7 @@ -get_magic_at() { - local file="$1" - local pos="$2" - get_image "$file" | dd bs=1 count=2 skip="$pos" 2>/dev/null | hexdump -v -n 2 -e '1/1 "%02x"' -} +REQUIRE_IMAGE_METADATA=1 platform_check_image() { - local file="$1" - local magic - - magic=$(get_magic_at "$file" 510) - [ "$magic" != "55aa" ] && { - echo "Failed to verify MBR boot signature." - return 1 - } - - return 0; + return 0 } platform_do_upgrade() { diff --git a/target/linux/brcm2708/image/Makefile b/target/linux/brcm2708/image/Makefile index 7909c6d814..41730b6803 100644 --- a/target/linux/brcm2708/image/Makefile +++ b/target/linux/brcm2708/image/Makefile @@ -50,13 +50,14 @@ define Device/Default FILESYSTEMS := ext4 KERNEL := kernel-bin | kernel-img KERNEL_IMG := kernel.img - IMAGES := sdcard.img - IMAGE/sdcard.img := boot-img | sdcard-img + IMAGES := sdcard.img.gz + IMAGE/sdcard.img.gz := boot-img | sdcard-img | gzip | append-metadata endef define Device/rpi DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-0-w + SUPPORTED_DEVICES := rpi-b rpi-b-plus rpi-cm rpi-zero-w endef ifeq ($(SUBTARGET),bcm2708) TARGET_DEVICES += rpi @@ -65,6 +66,7 @@ endif define Device/rpi-2 DEVICE_TITLE := Raspberry Pi 2B/3B/3CM DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-cm3 + SUPPORTED_DEVICES := rpi-2-b rpi-3-b rpi-cm endef ifeq ($(SUBTARGET),bcm2709) TARGET_DEVICES += rpi-2 @@ -74,6 +76,7 @@ define Device/rpi-3 KERNEL_IMG := kernel8.img DEVICE_TITLE := Raspberry Pi 3B (64 bit) DEVICE_DTS := broadcom/bcm2710-rpi-3-b + SUPPORTED_DEVICES := rpi-3-b endef ifeq ($(SUBTARGET),bcm2710) TARGET_DEVICES += rpi-3
This patch converts all the raspberrypi images to utilize the common metadata-based image verification. Note: the CM1 and CM3 currently use the same "rpi-cm" boardname. Signed-off-by: Christian Lamparter <chunkeey@gmail.com> --- .../linux/brcm2708/base-files/lib/upgrade/platform.sh | 17 ++--------------- target/linux/brcm2708/image/Makefile | 7 +++++-- 2 files changed, 7 insertions(+), 17 deletions(-)