1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00

Add working ext4 support for BPI-R2, but dirty for now

This commit is contained in:
Ycarus (Yannick Chabanois) 2019-06-22 20:21:54 +02:00
parent 3d9429ff7d
commit b854992ef2
29 changed files with 4292 additions and 2 deletions

View file

@ -8,6 +8,9 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
FAT32_BLOCK_SIZE=1024
FAT32_BLOCKS=$(shell echo $$((32*1024*1024/$(FAT32_BLOCK_SIZE))))
# for arm
KERNEL_LOADADDR := 0x80008000
@ -16,6 +19,22 @@ ifeq ($(SUBTARGET),mt7622)
KERNEL_LOADADDR = 0x41080000
endif
define Build/mediatek-sdcard
rm -f $@.boot
mkfs.fat $@.boot -C $(FAT32_BLOCKS)
mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-uEnv.txt ::uEnv.txt
mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage
./gen_mediatek_sdcard_img.sh $@ \
$(STAGING_DIR_IMAGE)/bpi-r2-preloader.bin \
$(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-uboot-mediatek.bin \
$@.boot \
$(IMAGE_ROOTFS) \
32 \
$(CONFIG_TARGET_ROOTFS_PARTSIZE)
rm -f $@.boot
endef
define Build/sysupgrade-emmc
rm -f $@.recovery
mkfs.fat -C $@.recovery 3070
@ -30,6 +49,7 @@ define Build/sysupgrade-bpi-r2-sd
dd bs="1024" if="$(STAGING_DIR_IMAGE)/mtk-bpi-r2-preloader-sd.bin" of="$@" seek="0"
dd bs="1024" if="$(STAGING_DIR_IMAGE)/mtk-bpi-r2-uboot.bin" of="$@" seek="320"
dd bs="1024" if="$(IMAGE_KERNEL)" of="$@" seek="2048"
#dd bs="1024" if="$(IMAGE_ROOTFS)" of="$@" seek="67584"
dd bs="1024" if="$(IMAGE_ROOTFS)" of="$@" seek="67584"
endef
define Build/sysupgrade-bpi-r2-emmc
@ -48,9 +68,11 @@ define Device/Default
IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
ifeq ($(SUBTARGET),mt7623)
DEVICE_VARS := MEDIATEK_UBOOT
KERNEL_NAME := zImage
KERNEL := kernel-bin | append-dtb | uImage none
KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none
FILESYSTEMS += ext4
endif
ifeq ($(SUBTARGET),mt7622)
KERNEL_NAME := Image

View file

@ -0,0 +1,48 @@
#!/usr/bin/env bash
#
# Copyright (C) 2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
set -e
[ $# -eq 7 ] || {
echo "SYNTAX: $0 <file> <preloader image> <u-boot image> <bootfs image> <rootfs image> <bootfs size> <rootfs size>"
exit 1
}
OUTPUT="$1"
PRELOADER="$2"
UBOOT="$3"
BOOTFS="$4"
ROOTFS="$5"
BOOTFSSIZE="$6"
ROOTFSSIZE="$7"
head=4
sect=63
set `ptgen -o $OUTPUT -h $head -s $sect -l 1024 -t c -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M -a 0`
BOOT_OFFSET="$(($1 / 512))"
BOOT_SIZE="$(($2 / 512))"
ROOTFS_OFFSET="$(($3 / 512))"
ROOTFS_SIZE="$(($4 / 512))"
PRELOADER_OFFSET=2 # 2KB
UBOOT_OFFSET=320 # 320KB
SDMMC_BOOT="SDMMC_BOOT\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00"
BRLYT="\
BRLYT\x00\x00\x00\x01\x00\x00\x00\x00\x08\x00\x00\
\x00\x08\x00\x00\x42\x42\x42\x42\x08\x00\x01\x00\x00\x08\x00\x00\
\x00\x08\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
echo -en "${SDMMC_BOOT}" | dd bs=1 of="${OUTPUT}" seek=0 conv=notrunc
echo -en "${BRLYT}" | dd bs=1 of="${OUTPUT}" seek=512 conv=notrunc
dd bs=1024 if="${PRELOADER}" of="${OUTPUT}" seek="${PRELOADER_OFFSET}" conv=notrunc
dd bs=1024 if="${UBOOT}" of="${OUTPUT}" seek="${UBOOT_OFFSET}" conv=notrunc
dd bs=512 if="${BOOTFS}" of="${OUTPUT}" seek="${BOOT_OFFSET}" conv=notrunc
dd bs=512 if="${ROOTFS}" of="${OUTPUT}" seek="${ROOTFS_OFFSET}" conv=notrunc

View file

@ -13,12 +13,13 @@ define Device/7623n-bananapi-bpi-r2
DEVICE_TITLE := MTK7623n BananaPi R2
DEVICE_DTS := mt7623n-bananapi-bpi-r2
# DEVICE_PACKAGES := wmt uboot-mtk-bpi-r2 kmod-crypto-hw-mtk kmod-nat-hw-mtk
DEVICE_PACKAGES := wmt uboot-mtk-bpi-r2 kmod-crypto-hw-mtk kmod-mt6625l-wlan-gen2
DEVICE_PACKAGES := wmt uboot-mtk-bpi-r2 kmod-crypto-hw-mtk kmod-mt6625l-wlan-gen2 kmod-usb-core kmod-ata-core kmod-usb3 kmod-usb2 kmod-usb-ohci mt7623n-preloader
SUPPORTED_DEVICES := bananapi,bpi-r2
IMAGES := sysupgrade.tar sysupgrade-sd.img.gz sysupgrade-emmc.img.gz
IMAGES := sysupgrade.tar sysupgrade-sd.img.gz sysupgrade-emmc.img.gz sdcard.img.gz
IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata
IMAGE/sysupgrade-sd.img.gz := sysupgrade-bpi-r2-sd | gzip | append-metadata
IMAGE/sysupgrade-emmc.img.gz := sysupgrade-bpi-r2-emmc | gzip | append-metadata
IMAGE/sdcard.img.gz := mediatek-sdcard | gzip | append-metadata
endef
TARGET_DEVICES += 7623n-bananapi-bpi-r2