layerscape: Change to combined rootfs on sd images

At this moment layerscape images are ext4 only. It causes problem with
save changes durring sysupgrade and make "firstboot" and failsafe mode
useless.

This patch changes sd-card images to squashfs + f2fs combined images.
To make place, for saving config, kernel space ar now ext4 partition
with fit kernel.

This method of image generation is similar to rest of OpenWrt sd-card
targets.

Reviewed-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
[reword README, reword DEVICE_COMPAT_MESSAGE, keep original indent]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Pawel Dembicki 2020-08-24 14:29:32 +02:00 committed by Adrian Schmutzler
parent c51f8030b6
commit a254279a6c
17 changed files with 168 additions and 192 deletions

View File

@ -1,8 +1,8 @@
fdtaddr=0x8f000000 fdtaddr=0x8f000000
loadaddr=0x81000000 loadaddr=0x81000000
fdt_high=0xffffffffffffffff fdt_high=0x8fffffff
initrd_high=0xffffffffffffffff initrd_high=0xffffffffffffffff
sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;pfe stop;run sd_boot bootcmd=echo starting openwrt ...;pfe stop;run sd_boot
bootdelay=3 bootdelay=3

View File

@ -1,8 +1,8 @@
fdtaddr=0x8f000000 fdtaddr=0x8f000000
loadaddr=0x81000000 loadaddr=0x81000000
fdt_high=0xffffffff fdt_high=0x8fffffff
initrd_high=0xffffffff initrd_high=0xffffffff
sd_boot=mmc read ${fdtaddr} 7800 800;mmc read ${loadaddr} 8000 8000;bootm ${loadaddr} - ${fdtaddr} sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;run sd_boot bootcmd=echo starting openwrt ...;run sd_boot
bootdelay=3 bootdelay=3

View File

@ -1,8 +1,8 @@
fdtaddr=0x8f000000 fdtaddr=0x8f000000
loadaddr=0x81000000 loadaddr=0x81000000
fdt_high=0xffffffff fdt_high=0x8fffffff
initrd_high=0xffffffff initrd_high=0xffffffff
sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 cma=64M@0x0-0xb0000000 bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;run sd_boot bootcmd=echo starting openwrt ...;run sd_boot
bootdelay=3 bootdelay=3

View File

@ -1,9 +1,9 @@
fdtaddr=0x8f000000 fdtaddr=0x8f000000
loadaddr=0x81000000 loadaddr=0x81000000
fdt_high=0xffffffffffffffff fdt_high=0x8fffffff
initrd_high=0xffffffffffffffff initrd_high=0xffffffffffffffff
hwconfig=fsl_ddr:bank_intlv=auto hwconfig=fsl_ddr:bank_intlv=auto
sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;run sd_boot bootcmd=echo starting openwrt ...;run sd_boot
bootdelay=3 bootdelay=3

View File

@ -1,9 +1,9 @@
fdtaddr=0x8f000000 fdtaddr=0x8f000000
loadaddr=0x81000000 loadaddr=0x81000000
fdt_high=0xffffffffffffffff fdt_high=0x8fffffff
initrd_high=0xffffffffffffffff initrd_high=0xffffffffffffffff
hwconfig=fsl_ddr:bank_intlv=auto hwconfig=fsl_ddr:bank_intlv=auto
sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;run sd_boot bootcmd=echo starting openwrt ...;run sd_boot
bootdelay=3 bootdelay=3

View File

@ -4,7 +4,7 @@ fdt_high=0xa0000000
initrd_high=0xffffffffffffffff initrd_high=0xffffffffffffffff
hwconfig=fsl_ddr:bank_intlv=auto hwconfig=fsl_ddr:bank_intlv=auto
mc_init=mmc read 80000000 5000 1800;mmc read 80300000 7000 800;fsl_mc start mc 80000000 80300000;mmc read 80400000 6800 800;fsl_mc apply dpl 80400000 mc_init=mmc read 80000000 5000 1800;mmc read 80300000 7000 800;fsl_mc start mc 80000000 80300000;mmc read 80400000 6800 800;fsl_mc apply dpl 80400000
sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;run mc_init;run sd_boot bootcmd=echo starting openwrt ...;run mc_init;run sd_boot
bootdelay=3 bootdelay=3

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
BOARD:=layerscape BOARD:=layerscape
BOARDNAME:=NXP Layerscape BOARDNAME:=NXP Layerscape
KERNEL_PATCHVER:=5.4 KERNEL_PATCHVER:=5.4
FEATURES:=squashfs nand usb pcie gpio fpu ubifs ext4 FEATURES:=squashfs nand usb pcie gpio fpu ubifs ext4 rootfs-part boot-part
SUBTARGETS:=armv8_64b armv7 SUBTARGETS:=armv8_64b armv7
define Target/Description define Target/Description
@ -19,6 +19,6 @@ endef
include $(INCLUDE_DIR)/target.mk include $(INCLUDE_DIR)/target.mk
DEFAULT_PACKAGES += kmod-usb3 kmod-usb-dwc3 kmod-usb-storage \ DEFAULT_PACKAGES += kmod-usb3 kmod-usb-dwc3 kmod-usb-storage \
partx-utils mkf2fs e2fsprogs partx-utils
$(eval $(call BuildTarget)) $(eval $(call BuildTarget))

View File

@ -39,13 +39,14 @@ $ ./scripts/feeds install -a
* Final firmware/image * Final firmware/image
Path: bin/targets/layerscape/<subtarget>/ Path: bin/targets/layerscape/<subtarget>/
Firmware for flash: openwrt-layerscape-<subtarget>-<device>-<rootfs>-firmware.bin Firmware for flash: openwrt-layerscape-<subtarget>-<device>-<rootfs>-firmware.bin
Image for SD card: openwrt-layerscape-<subtarget>-<device>-<rootfs>-sdcard.img Image for SD card: openwrt-layerscape-<subtarget>-<device>-<rootfs>-sdcard.img.gz
Sysupgrade images: openwrt-layerscape-<subtarget>-<device>-<rootfs>-sysupgrade.bin
3. Program NOR/QSPI flash or SD card 3. Program NOR/QSPI flash or SD card
------------------------------------ ------------------------------------
The firmware.bin or sdcard.img is an all-in-one image including all things for The firmware.bin or sdcard.img (after extract from gz) is an all-in-one image including all
OpenWrt staring up. (except LS1012AFRWY. Refer to 3.3.) things for OpenWrt staring up. (except LS1012AFRWY. Refer to 3.3.)
If you want to install all things into flash, please use firmware.bin. If you want to install all things into flash, please use firmware.bin.
If you want to install all things into SD card, please use sdcard.img. If you want to install all things into SD card, please use sdcard.img.
@ -53,7 +54,7 @@ If you want to install all things into SD card, please use sdcard.img.
--------------------------------- ---------------------------------
sdcard.img could be programmed to SD card in either u-boot environment sdcard.img could be programmed to SD card in either u-boot environment
or linux environment. After programming, configure the board to boot or linux environment. After programming, configure the board to boot
from SD card. from SD card. (sdcard.img images are gz-iped to save space. Please extract them first.)
* u-boot environment * u-boot environment

View File

@ -242,6 +242,9 @@ CONFIG_EVENT_TRACING=y
CONFIG_EXT4_FS=y CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y CONFIG_EXT4_FS_SECURITY=y
CONFIG_F2FS_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_STAT_FS=y
CONFIG_FAILOVER=y CONFIG_FAILOVER=y
CONFIG_FAT_FS=y CONFIG_FAT_FS=y
# CONFIG_FEC is not set # CONFIG_FEC is not set

View File

@ -266,6 +266,9 @@ CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y CONFIG_EXT4_FS_SECURITY=y
CONFIG_EXTCON=y CONFIG_EXTCON=y
CONFIG_EXTCON_USB_GPIO=y CONFIG_EXTCON_USB_GPIO=y
CONFIG_F2FS_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_STAT_FS=y
CONFIG_FAILOVER=y CONFIG_FAILOVER=y
CONFIG_FANOTIFY=y CONFIG_FANOTIFY=y
CONFIG_FAT_FS=y CONFIG_FAT_FS=y

View File

@ -5,11 +5,17 @@
. /lib/functions.sh . /lib/functions.sh
case "$(board_name)" in case "$(board_name)" in
fsl,ls1012a-frwy-sdboot | \
fsl,ls1012a-rdb | \ fsl,ls1012a-rdb | \
fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr | \ fsl,ls1021a-twr | \
fsl,ls1021a-twr-sdboot | \
fsl,ls1043a-rdb | \ fsl,ls1043a-rdb | \
fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-rdb | \ fsl,ls1046a-rdb | \
fsl,ls1046a-rdb-sdboot | \
fsl,ls1088a-rdb | \ fsl,ls1088a-rdb | \
fsl,ls1088a-rdb-sdboot | \
fsl,ls2088a-rdb) fsl,ls2088a-rdb)
uci set system.@system[0].compat_version="2.0" uci set system.@system[0].compat_version="2.0"
uci commit system uci commit system

View File

@ -0,0 +1,26 @@
. /lib/functions.sh
. /lib/upgrade/common.sh
BOOTPART=/dev/mmcblk0p1
move_config() {
local board=$(board_name)
case "$board" in
fsl,ls1012a-frwy-sdboot | \
fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr-sdboot | \
fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-rdb-sdboot | \
fsl,ls1088a-rdb-sdboot)
if [ -b $BOOTPART ]; then
mkdir -p /boot
mount -t ext4 -o rw,noatime $BOOTPART /boot 2>&1
[ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
umount /boot
fi
;;
esac
}
boot_hook_add preinit_mount_root move_config

View File

@ -8,88 +8,28 @@ RAMFS_COPY_DATA="/etc/fw_env.config /var/lock/fw_printenv.lock"
REQUIRE_IMAGE_METADATA=1 REQUIRE_IMAGE_METADATA=1
platform_check_image_sdboot() {
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev 0 || {
echo "Unable to determine upgrade device"
return 1
}
# get partitions table from boot device
get_partitions "/dev/$diskdev" bootdisk
# get partitions table from sysupgrade.bin
dd if="$1" of=/tmp/image.bs bs=512b count=1 > /dev/null 2>&1
sync
get_partitions /tmp/image.bs image
# compare tables
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image
if [ -n "$diff" ]; then
echo "Partition layout has changed. Full image will be written."
ask_bool 0 "Abort" && exit 1
return 0
fi
}
platform_do_upgrade_sdboot() { platform_do_upgrade_sdboot() {
local diskdev partdev diff local diskdev partdev parttype=ext4
local tar_file="$1"
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/}
export_bootdevice && export_partdevice diskdev 0 || { export_bootdevice && export_partdevice diskdev 0 || {
echo "Unable to determine upgrade device" echo "Unable to determine upgrade device"
return 1 return 1
} }
if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then if export_partdevice partdev 1; then
# get partitions table from boot device mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt 2>&1
get_partitions "/dev/$diskdev" bootdisk echo "Writing kernel..."
tar xf $tar_file ${board_dir}/kernel -O > /mnt/fitImage
# get partitions table from sysupgrade.bin umount /mnt
dd if="$1" of=/tmp/image.bs bs=512b count=1 > /dev/null 2>&1
sync
get_partitions /tmp/image.bs image
# compare tables
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
else
diff=1
fi fi
if [ -n "$diff" ]; then echo "Erasing rootfs..."
dd if="$1" of="/dev/$diskdev" bs=1024 count=4 > /dev/null 2>&1 dd if=/dev/zero of=/dev/mmcblk0p2 bs=1M > /dev/null 2>&1
echo "Writing image to /dev/$diskdev..." echo "Writing rootfs..."
dd if="$1" of="/dev/$diskdev" bs=1024 skip=15360 seek=15360 > /dev/null 2>&1 tar xf $tar_file ${board_dir}/root -O | dd of=/dev/mmcblk0p2 bs=512k > /dev/null 2>&1
sync
# Separate removal and addtion is necessary; otherwise, partition 1
# will be missing if it overlaps with the old partition 2
partx -d - "/dev/$diskdev"
partx -a - "/dev/$diskdev"
return 0
fi
# write dtb
echo "Writing dtb to /dev/$diskdev..."
dd if="$1" of="/dev/$diskdev" bs=1024 skip=15360 seek=15360 count=1024 > /dev/null 2>&1
# write kernel image
echo "Writing kernel to /dev/$diskdev..."
dd if="$1" of="/dev/$diskdev" bs=1024 skip=16384 seek=16384 count=16384 > /dev/null 2>&1
sync
# iterate over each partition from the image and write it to the boot disk
while read part start size; do
if export_partdevice partdev $part; then
echo "Writing image to /dev/$partdev..."
dd if="$1" of="/dev/$partdev" bs=512 skip="$start" count="$size" > /dev/null 2>&1
sync
else
echo "Unable to find partition $part device, skipped."
fi
done < /tmp/partmap.image
} }
platform_do_upgrade_traverse_nandubi() { platform_do_upgrade_traverse_nandubi() {
@ -119,6 +59,7 @@ platform_copy_config_sdboot() {
if export_partdevice partdev 1; then if export_partdevice partdev 1; then
mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt 2>&1 mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt 2>&1
echo "Saving config backup..."
cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
umount /mnt umount /mnt
fi fi
@ -128,6 +69,7 @@ platform_copy_config() {
case "$board" in case "$board" in
fsl,ls1012a-frwy-sdboot | \ fsl,ls1012a-frwy-sdboot | \
fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr-sdboot | \ fsl,ls1021a-twr-sdboot | \
fsl,ls1043a-rdb-sdboot | \ fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-rdb-sdboot | \ fsl,ls1046a-rdb-sdboot | \
@ -146,20 +88,18 @@ platform_check_image() {
return $? return $?
;; ;;
fsl,ls1012a-frdm | \ fsl,ls1012a-frdm | \
fsl,ls1012a-rdb | \
fsl,ls1021a-twr | \
fsl,ls1043a-rdb | \
fsl,ls1046a-rdb | \
fsl,ls1088a-rdb | \
fsl,ls2088a-rdb)
return 0
;;
fsl,ls1012a-frwy-sdboot | \ fsl,ls1012a-frwy-sdboot | \
fsl,ls1012a-rdb | \
fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr | \
fsl,ls1021a-twr-sdboot | \ fsl,ls1021a-twr-sdboot | \
fsl,ls1043a-rdb | \
fsl,ls1043a-rdb-sdboot | \ fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-rdb | \
fsl,ls1046a-rdb-sdboot | \ fsl,ls1046a-rdb-sdboot | \
fsl,ls1088a-rdb-sdboot) fsl,ls1088a-rdb | \
platform_check_image_sdboot "$1" fsl,ls1088a-rdb-sdboot | \
fsl,ls2088a-rdb)
return 0 return 0
;; ;;
*) *)
@ -192,6 +132,7 @@ platform_do_upgrade() {
default_do_upgrade "$1" default_do_upgrade "$1"
;; ;;
fsl,ls1012a-frwy-sdboot | \ fsl,ls1012a-frwy-sdboot | \
fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr-sdboot | \ fsl,ls1021a-twr-sdboot | \
fsl,ls1043a-rdb-sdboot | \ fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-rdb-sdboot | \ fsl,ls1046a-rdb-sdboot | \

View File

@ -7,13 +7,22 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk include $(INCLUDE_DIR)/image.mk
LS_SD_KERNELPART_SIZE = 40
LS_SD_KERNELPART_OFFSET = 16
LS_SD_ROOTFSPART_OFFSET = 64 LS_SD_ROOTFSPART_OFFSET = 64
LS_SD_IMAGE_SIZE = $(shell echo $$((($(LS_SD_ROOTFSPART_OFFSET) + \ LS_SD_IMAGE_SIZE = $(shell echo $$((($(LS_SD_ROOTFSPART_OFFSET) + \
$(CONFIG_TARGET_ROOTFS_PARTSIZE)) * 1024 * 1024))) $(CONFIG_TARGET_ROOTFS_PARTSIZE)))))
# The limitation of flash sysupgrade.bin is 1MB dtb + 16MB kernel + 32MB rootfs # The limitation of flash sysupgrade.bin is 1MB dtb + 16MB kernel + 32MB rootfs
LS_SYSUPGRADE_IMAGE_SIZE = 49m LS_SYSUPGRADE_IMAGE_SIZE = 49m
define Image/Prepare
# Build .dtb for all boards we may run on
$(foreach dts,$(DEVICE_DTS_LIST),
$(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTS_DIR)/$(dts).dtb)
)
endef
define Build/ls-clean define Build/ls-clean
rm -f $@ rm -f $@
endef endef
@ -23,12 +32,21 @@ define Build/ls-append
endef endef
define Build/ls-append-dtb define Build/ls-append-dtb
$(call Image/BuildDTB,$(DTS_DIR)/$(1).dts,$(DTS_DIR)/$(1).dtb)
dd if=$(DTS_DIR)/$(1).dtb >> $@ dd if=$(DTS_DIR)/$(1).dtb >> $@
endef endef
define Build/ls-append-kernel
mkdir -p $@.tmp && \
cp $(IMAGE_KERNEL) $@.tmp/fitImage && \
make_ext4fs -J -L kernel -l "$(LS_SD_KERNELPART_SIZE)M" "$@.kernel.part" "$@.tmp" && \
dd if=$@.kernel.part >> $@ && \
rm -rf $@.tmp && \
rm -f $@.kernel.part
endef
define Build/ls-append-sdhead define Build/ls-append-sdhead
./gen_sdcard_head_img.sh $(STAGING_DIR_IMAGE)/$(1)-sdcard-head.img \ ./gen_sdcard_head_img.sh $(STAGING_DIR_IMAGE)/$(1)-sdcard-head.img \
$(LS_SD_KERNELPART_OFFSET) $(LS_SD_KERNELPART_SIZE) \
$(LS_SD_ROOTFSPART_OFFSET) $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(LS_SD_ROOTFSPART_OFFSET) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
dd if=$(STAGING_DIR_IMAGE)/$(1)-sdcard-head.img >> $@ dd if=$(STAGING_DIR_IMAGE)/$(1)-sdcard-head.img >> $@
endef endef
@ -53,6 +71,12 @@ define Device/fix-sysupgrade
After that, You can use "sysupgrade -F". After that, You can use "sysupgrade -F".
endef endef
define Device/rework-sdcard-images
DEVICE_COMPAT_VERSION := 2.0
DEVICE_COMPAT_MESSAGE := SD-card images were changed to squashfs + ext4 overlay combined images. \
It is required to flash the entire sd-card again and manually copy config.
endef
include $(SUBTARGET).mk include $(SUBTARGET).mk
$(eval $(call BuildImage)) $(eval $(call BuildImage))

View File

@ -40,50 +40,40 @@ endef
TARGET_DEVICES += fsl_ls1021a-twr TARGET_DEVICES += fsl_ls1021a-twr
define Device/fsl_ls1021a-twr-sdboot define Device/fsl_ls1021a-twr-sdboot
$(Device/rework-sdcard-images)
DEVICE_VENDOR := NXP DEVICE_VENDOR := NXP
DEVICE_MODEL := TWR-LS1021A DEVICE_MODEL := TWR-LS1021A
DEVICE_VARIANT := SD Card Boot DEVICE_VARIANT := SD Card Boot
DEVICE_DTS := ls1021a-twr DEVICE_DTS := ls1021a-twr
FILESYSTEMS := ext4 KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
IMAGES := sdcard.img sysupgrade.bin IMAGES := sdcard.img.gz sysupgrade.bin
IMAGE/sdcard.img := \ IMAGE/sdcard.img.gz := \
ls-clean | \ ls-clean | \
ls-append-sdhead $(1) | pad-to 4K | \ ls-append-sdhead $(1) | pad-to 4K | \
ls-append $(1)-uboot.bin | pad-to 3M | \ ls-append $(1)-uboot.bin | pad-to 3M | \
ls-append $(1)-uboot-env.bin | pad-to 15M | \ ls-append $(1)-uboot-env.bin | pad-to 16M | \
ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip
append-rootfs | check-size $(LS_SD_IMAGE_SIZE) IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/sysupgrade.bin := \
ls-clean | \
ls-append-sdhead $(1) | pad-to 15M | \
ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \
append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-rootfs | check-size $(LS_SD_IMAGE_SIZE) | append-metadata
endef endef
TARGET_DEVICES += fsl_ls1021a-twr-sdboot TARGET_DEVICES += fsl_ls1021a-twr-sdboot
define Device/fsl_ls1021a-iot-sdboot define Device/fsl_ls1021a-iot-sdboot
$(Device/rework-sdcard-images)
DEVICE_VENDOR := NXP DEVICE_VENDOR := NXP
DEVICE_MODEL := LS1021A-IoT DEVICE_MODEL := LS1021A-IoT
DEVICE_VARIANT := SD Card Boot DEVICE_VARIANT := SD Card Boot
DEVICE_DTS := ls1021a-iot DEVICE_DTS := ls1021a-iot
FILESYSTEMS := ext4
SUPPORTED_DEVICES := SUPPORTED_DEVICES :=
IMAGES := sdcard.img sysupgrade.bin KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
IMAGE/sdcard.img := \ IMAGES := sdcard.img.gz sysupgrade.bin
IMAGE/sdcard.img.gz := \
ls-clean | \ ls-clean | \
ls-append-sdhead $(1) | pad-to 4K | \ ls-append-sdhead $(1) | pad-to 4K | \
ls-append $(1)-uboot.bin | pad-to 1M | \ ls-append $(1)-uboot.bin | pad-to 1M | \
ls-append $(1)-uboot-env.bin | pad-to 15M | \ ls-append $(1)-uboot-env.bin | pad-to 16M | \
ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip
append-rootfs | check-size $(LS_SD_IMAGE_SIZE) IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/sysupgrade.bin := \
ls-clean | \
ls-append-sdhead $(1) | pad-to 15M | \
ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \
append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-rootfs | check-size $(LS_SD_IMAGE_SIZE) | append-metadata
endef endef
TARGET_DEVICES += fsl_ls1021a-iot-sdboot TARGET_DEVICES += fsl_ls1021a-iot-sdboot

View File

@ -67,6 +67,7 @@ endef
TARGET_DEVICES += fsl_ls1012a-rdb TARGET_DEVICES += fsl_ls1012a-rdb
define Device/fsl_ls1012a-frwy-sdboot define Device/fsl_ls1012a-frwy-sdboot
$(Device/rework-sdcard-images)
DEVICE_VENDOR := NXP DEVICE_VENDOR := NXP
DEVICE_MODEL := FRWY-LS1012A DEVICE_MODEL := FRWY-LS1012A
DEVICE_PACKAGES += \ DEVICE_PACKAGES += \
@ -74,8 +75,8 @@ define Device/fsl_ls1012a-frwy-sdboot
tfa-ls1012a-frwy-sdboot \ tfa-ls1012a-frwy-sdboot \
kmod-ppfe kmod-ppfe
DEVICE_DTS := freescale/fsl-ls1012a-frwy DEVICE_DTS := freescale/fsl-ls1012a-frwy
FILESYSTEMS := ext4 KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
IMAGES := firmware.bin sdcard.img sysupgrade.bin IMAGES := firmware.bin sdcard.img.gz sysupgrade.bin
IMAGE/firmware.bin := \ IMAGE/firmware.bin := \
ls-clean | \ ls-clean | \
ls-append $(1)-bl2.pbl | pad-to 128K | \ ls-append $(1)-bl2.pbl | pad-to 128K | \
@ -83,18 +84,12 @@ define Device/fsl_ls1012a-frwy-sdboot
ls-append $(1)-fip.bin | pad-to 1856K | \ ls-append $(1)-fip.bin | pad-to 1856K | \
ls-append $(1)-uboot-env.bin | pad-to 2048K | \ ls-append $(1)-uboot-env.bin | pad-to 2048K | \
check-size 2097153 check-size 2097153
IMAGE/sdcard.img := \ IMAGE/sdcard.img.gz := \
ls-clean | \ ls-clean | \
ls-append-sdhead $(1) | pad-to 15M | \ ls-append-sdhead $(1) | pad-to 16M | \
ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip
append-rootfs | check-size $(LS_SD_IMAGE_SIZE) IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/sysupgrade.bin := \
ls-clean | \
ls-append-sdhead $(1) | pad-to 15M | \
ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \
append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-rootfs | check-size $(LS_SD_IMAGE_SIZE) | append-metadata
endef endef
TARGET_DEVICES += fsl_ls1012a-frwy-sdboot TARGET_DEVICES += fsl_ls1012a-frwy-sdboot
@ -124,6 +119,7 @@ endef
TARGET_DEVICES += fsl_ls1043a-rdb TARGET_DEVICES += fsl_ls1043a-rdb
define Device/fsl_ls1043a-rdb-sdboot define Device/fsl_ls1043a-rdb-sdboot
$(Device/rework-sdcard-images)
DEVICE_VENDOR := NXP DEVICE_VENDOR := NXP
DEVICE_MODEL := LS1043A-RDB DEVICE_MODEL := LS1043A-RDB
DEVICE_VARIANT := SD Card Boot DEVICE_VARIANT := SD Card Boot
@ -135,24 +131,18 @@ define Device/fsl_ls1043a-rdb-sdboot
kmod-hwmon-ina2xx \ kmod-hwmon-ina2xx \
kmod-hwmon-lm90 kmod-hwmon-lm90
DEVICE_DTS := freescale/fsl-ls1043a-rdb-sdk DEVICE_DTS := freescale/fsl-ls1043a-rdb-sdk
FILESYSTEMS := ext4 KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
IMAGES := sdcard.img sysupgrade.bin IMAGES := sdcard.img.gz sysupgrade.bin
IMAGE/sdcard.img := \ IMAGE/sdcard.img.gz := \
ls-clean | \ ls-clean | \
ls-append-sdhead $(1) | pad-to 4K | \ ls-append-sdhead $(1) | pad-to 4K | \
ls-append $(1)-bl2.pbl | pad-to 1M | \ ls-append $(1)-bl2.pbl | pad-to 1M | \
ls-append $(1)-fip.bin | pad-to 5M | \ ls-append $(1)-fip.bin | pad-to 5M | \
ls-append $(1)-uboot-env.bin | pad-to 9M | \ ls-append $(1)-uboot-env.bin | pad-to 9M | \
ls-append fsl_ls1043a-rdb-fman.bin | pad-to 15M | \ ls-append fsl_ls1043a-rdb-fman.bin | pad-to 16M | \
ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip
append-rootfs | check-size $(LS_SD_IMAGE_SIZE) IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/sysupgrade.bin := \
ls-clean | \
ls-append-sdhead $(1) | pad-to 15M | \
ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \
append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-rootfs | check-size $(LS_SD_IMAGE_SIZE) | append-metadata
endef endef
TARGET_DEVICES += fsl_ls1043a-rdb-sdboot TARGET_DEVICES += fsl_ls1043a-rdb-sdboot
@ -182,6 +172,7 @@ endef
TARGET_DEVICES += fsl_ls1046a-rdb TARGET_DEVICES += fsl_ls1046a-rdb
define Device/fsl_ls1046a-rdb-sdboot define Device/fsl_ls1046a-rdb-sdboot
$(Device/rework-sdcard-images)
DEVICE_VENDOR := NXP DEVICE_VENDOR := NXP
DEVICE_MODEL := LS1046A-RDB DEVICE_MODEL := LS1046A-RDB
DEVICE_VARIANT := SD Card Boot DEVICE_VARIANT := SD Card Boot
@ -193,24 +184,18 @@ define Device/fsl_ls1046a-rdb-sdboot
kmod-hwmon-ina2xx \ kmod-hwmon-ina2xx \
kmod-hwmon-lm90 kmod-hwmon-lm90
DEVICE_DTS := freescale/fsl-ls1046a-rdb-sdk DEVICE_DTS := freescale/fsl-ls1046a-rdb-sdk
FILESYSTEMS := ext4 KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
IMAGES := sdcard.img sysupgrade.bin IMAGES := sdcard.img.gz sysupgrade.bin
IMAGE/sdcard.img := \ IMAGE/sdcard.img.gz := \
ls-clean | \ ls-clean | \
ls-append-sdhead $(1) | pad-to 4K | \ ls-append-sdhead $(1) | pad-to 4K | \
ls-append $(1)-bl2.pbl | pad-to 1M | \ ls-append $(1)-bl2.pbl | pad-to 1M | \
ls-append $(1)-fip.bin | pad-to 5M | \ ls-append $(1)-fip.bin | pad-to 5M | \
ls-append $(1)-uboot-env.bin | pad-to 9M | \ ls-append $(1)-uboot-env.bin | pad-to 9M | \
ls-append fsl_ls1046a-rdb-fman.bin | pad-to 15M | \ ls-append fsl_ls1046a-rdb-fman.bin | pad-to 16M | \
ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip
append-rootfs | check-size $(LS_SD_IMAGE_SIZE) IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/sysupgrade.bin := \
ls-clean | \
ls-append-sdhead $(1) | pad-to 15M | \
ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \
append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-rootfs | check-size $(LS_SD_IMAGE_SIZE) | append-metadata
endef endef
TARGET_DEVICES += fsl_ls1046a-rdb-sdboot TARGET_DEVICES += fsl_ls1046a-rdb-sdboot
@ -242,6 +227,7 @@ endef
TARGET_DEVICES += fsl_ls1088a-rdb TARGET_DEVICES += fsl_ls1088a-rdb
define Device/fsl_ls1088a-rdb-sdboot define Device/fsl_ls1088a-rdb-sdboot
$(Device/rework-sdcard-images)
DEVICE_VENDOR := NXP DEVICE_VENDOR := NXP
DEVICE_MODEL := LS1088A-RDB DEVICE_MODEL := LS1088A-RDB
DEVICE_VARIANT := SD Card Boot DEVICE_VARIANT := SD Card Boot
@ -254,9 +240,9 @@ define Device/fsl_ls1088a-rdb-sdboot
kmod-hwmon-ina2xx \ kmod-hwmon-ina2xx \
kmod-hwmon-lm90 kmod-hwmon-lm90
DEVICE_DTS := freescale/fsl-ls1088a-rdb DEVICE_DTS := freescale/fsl-ls1088a-rdb
FILESYSTEMS := ext4 KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
IMAGES := sdcard.img sysupgrade.bin IMAGES := sdcard.img.gz sysupgrade.bin
IMAGE/sdcard.img := \ IMAGE/sdcard.img.gz := \
ls-clean | \ ls-clean | \
ls-append-sdhead $(1) | pad-to 4K | \ ls-append-sdhead $(1) | pad-to 4K | \
ls-append $(1)-bl2.pbl | pad-to 1M | \ ls-append $(1)-bl2.pbl | pad-to 1M | \
@ -264,16 +250,10 @@ define Device/fsl_ls1088a-rdb-sdboot
ls-append $(1)-uboot-env.bin | pad-to 10M | \ ls-append $(1)-uboot-env.bin | pad-to 10M | \
ls-append fsl_ls1088a-rdb-mc.itb | pad-to 13M | \ ls-append fsl_ls1088a-rdb-mc.itb | pad-to 13M | \
ls-append fsl_ls1088a-rdb-dpl.dtb | pad-to 14M | \ ls-append fsl_ls1088a-rdb-dpl.dtb | pad-to 14M | \
ls-append fsl_ls1088a-rdb-dpc.dtb | pad-to 15M | \ ls-append fsl_ls1088a-rdb-dpc.dtb | pad-to 16M | \
ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \ ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \ append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip
append-rootfs | check-size $(LS_SD_IMAGE_SIZE) IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/sysupgrade.bin := \
ls-clean | \
ls-append-sdhead $(1) | pad-to 15M | \
ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \
append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-rootfs | check-size $(LS_SD_IMAGE_SIZE) | append-metadata
endef endef
TARGET_DEVICES += fsl_ls1088a-rdb-sdboot TARGET_DEVICES += fsl_ls1088a-rdb-sdboot

View File

@ -7,16 +7,18 @@
# #
set -x set -x
[ $# -eq 3 ] || { [ $# -eq 5 ] || {
echo "SYNTAX: $0 <file> <rootfs part offset> <rootfs size>" echo "SYNTAX: $0 <file> <kernel part offset> <kernel size> <rootfs part offset> <rootfs size>"
exit 1 exit 1
} }
OUTPUT="$1" OUTPUT="$1"
ROOTFSOFFSET="$(($2 * 1024))" KERNELOFFSET="$(($2 * 1024))"
ROOTFSSIZE="$3" KERNELSIZE="$3"
ROOTFSOFFSET="$(($4 * 1024))"
ROOTFSSIZE="$5"
head=4 head=4
sect=16 sect=63
set $(ptgen -o $OUTPUT -h $head -s $sect -l $ROOTFSOFFSET -t 83 -p ${ROOTFSSIZE}M) set $(ptgen -o $OUTPUT -h $head -s $sect -t 83 -p ${KERNELSIZE}M@${KERNELOFFSET} -p ${ROOTFSSIZE}M@${ROOTFSOFFSET})