Package: flash-kernel Version: 3.11 Severity: wishlist Tags: patch The attached patch adds Raspberry Pi support to flash-kernel. It is based on current flash-kernel git (as of 7f52719ab0a607b89555baffd1cc8c14207c0f8f).
It is available for merging in the "rpi-support-rebased" branch at http://anonscm.debian.org/gitweb/?p=users/merker/flash-kernel.git;a=shortlog;h=refs/heads/rpi-support-rebased Regards, Karsten -- Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der Werbung sowie der Markt- oder Meinungsforschung.
>From ff2103a10fc27f77c2763d9dd4b043254b6e489d Mon Sep 17 00:00:00 2001 From: "K. Merker" <mer...@debian.org> Date: Wed, 1 Jan 2014 13:17:13 +0100 Subject: [PATCH] Initial Raspberry Pi support Add a method "rpiconfigtxt" and a new machine database entry for the Raspberry Pi. The method "rpiconfigtxt" enables flash-kernel to update the kernel file name to be booted by the Raspberry Pi firmware. As the Raspberry Pi firmware can only boot from a FAT partition, using symlinks to point to the kernel to be booted is not possible. Therefore the kernel filename entry in the firmware config has to be changed after installation of a new kernel package. --- README | 10 +++++++++- db/all.db | 5 +++++ functions | 19 +++++++++++++++++++ test_db | 2 +- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/README b/README index 51aa15f..c7cde61 100644 --- a/README +++ b/README @@ -49,6 +49,7 @@ The following systems are supported: - QNAP TS-409 - QNAP TS-410 and TS-410U Turbo NAS - QNAP TS-419P and TS-419U Turbo NAS + - Raspberry Pi - Seagate FreeAgent DockStar - SheevaPlug - SheevaPlug eSATA @@ -153,12 +154,19 @@ The supported fields are: * Method: (optional) indicates how to support this particular machine; the default is "generic"; other available methods are: android, multi, - redboot, slug, symlink + redboot, slug, symlink, rpiconfigtxt * Boot-Device: (optional) block device to mount before installing kernel, initrd and U-Boot script; Boot-Kernel-Path, Boot-Initrd-Path and Boot-Script-Path are then taken relative to this boot device +* Rpi-ConfigTxt-Path: (optional) Raspberry Pi firmware configuration pathname. + The Raspberry Pi firmware configuration is stored in a text file on the + first (FAT formatted) partition of the SD card in the system and + contains settings like kernel file name, video mode, memory split + between CPU and GPU, overclocking parameters, etc. Rpi-ConfigTxt-Path + contains the full path to this file (default value: /boot/config.txt). + Configuration - - - - - - - diff --git a/db/all.db b/db/all.db index c28432a..c0fdf27 100644 --- a/db/all.db +++ b/db/all.db @@ -382,3 +382,8 @@ Method: android Android-Boot-Device: /dev/mmcblk0 Required-Packages: abootimg Bootloader-Sets-Root: no + +Machine: BCM2708 +Method: rpiconfigtxt +Rpi-ConfigTxt-Path: /boot/config.txt +Bootloader-Sets-Root: yes diff --git a/functions b/functions index 1233981..26a16ed 100644 --- a/functions +++ b/functions @@ -440,6 +440,7 @@ boot_script_path="$(get_machine_field "$machine" "Boot-Script-Path")" || : boot_dtb_path="$(get_machine_field "$machine" "Boot-DTB-Path")" || : boot_multi_path="$(get_machine_field "$machine" "Boot-Multi-Path")" || : android_boot_device="$(get_machine_field "$machine" "Android-Boot-Device")" || : +rpi_configtxt_path="$(get_machine_field "$machine" "Rpi-ConfigTxt-Path")" || : if [ -n "$dtb_append_from" ]; then if dtb_append_required; then @@ -711,6 +712,24 @@ case "$method" in } > "$imtd" || error "failed." echo "done." >&2 ;; + "rpiconfigtxt") + rpi_configtxt_path=${rpi_configtxt_path:-"/boot/config.txt"} + rpi_configtxt_tempfile=$(tempfile) + + if [ ! -e "${rpi_configtxt_path}" ]; then + echo "${rpi_configtxt_path} not found. Creating it." + touch "${rpi_configtxt_path}" + fi + + grep -E -v "^#fk-old-" < "${rpi_configtxt_path}" | \ + sed -e 's/^kernel=/#fk-old-kernel=/' \ + -e 's/^initramfs/#fk-old-initramfs/' \ + -e 's/^ramfsfile/#fk-old-ramfsfile/' \ + -e 's/^ramfsaddr/#fk-old-ramfsaddr/' > ${rpi_configtxt_tempfile} + + echo -n "kernel=$(basename ${kfile})\ninitramfs $(basename ${ifile})\n" >> ${rpi_configtxt_tempfile} + mv "${rpi_configtxt_tempfile}" "${rpi_configtxt_path}" + ;; esac } diff --git a/test_db b/test_db index aec83f1..217fe64 100755 --- a/test_db +++ b/test_db @@ -22,7 +22,7 @@ MACHINE_DB="$(cat "${FK_CHECKOUT:-$FK_DIR}/db/"*.db)" test_no_unknown_fields() { - local expected='Android-Boot-Device Boot-Device Boot-DTB-Path Boot-Initrd-Path Boot-Kernel-Path Boot-Multi-Path Boot-Script-Path Bootloader-Sets-Root DTB-Append DTB-Append-From DTB-Id Kernel-Flavors Machine Machine-Id Method Mtd-Initrd Mtd-Kernel Optional-Packages Required-Packages U-Boot-Initrd-Address U-Boot-Kernel-Address U-Boot-Kernel-Entry-Point U-Boot-Multi-Address U-Boot-Script-Address U-Boot-Script-Name' + local expected='Android-Boot-Device Boot-Device Boot-DTB-Path Boot-Initrd-Path Boot-Kernel-Path Boot-Multi-Path Boot-Script-Path Bootloader-Sets-Root DTB-Append DTB-Append-From DTB-Id Kernel-Flavors Machine Machine-Id Method Mtd-Initrd Mtd-Kernel Optional-Packages Required-Packages U-Boot-Initrd-Address U-Boot-Kernel-Address U-Boot-Kernel-Entry-Point U-Boot-Multi-Address U-Boot-Script-Address U-Boot-Script-Name Rpi-ConfigTxt-Path' expected="$(echo "$expected" | sed 's/ /\n/g' | sort -u | xargs)" local fields="$(echo "$MACHINE_DB" | sed -n '/^[^#]*:/s/:.*//p' | sort -u | xargs)" if [ "$fields" != "$expected" ]; then -- 1.7.10.4