Преглед изворни кода

revert to MBR

Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
Michel-FK пре 3 година
родитељ
комит
7a7eef2fae

+ 0 - 1
FunKey/board/funkey/linux.config

@@ -11,7 +11,6 @@ CONFIG_PERF_EVENTS=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_PARTITION_ADVANCED=y
-# CONFIG_MSDOS_PARTITION is not set
 CONFIG_ARCH_SUNXI=y
 # CONFIG_MACH_SUN4I is not set
 # CONFIG_MACH_SUN5I is not set

+ 4 - 4
FunKey/board/funkey/rootfs-overlay/etc/init.d/S01first_boot

@@ -6,14 +6,14 @@ case "$1" in
     start)
 
     # Check is SWAP partition already created
-    sgdisk -p /dev/mmcblk0 | grep swap > /dev/null
+    fdisk -l /dev/mmcblk0 | grep "Linux swap" > /dev/null
     if [ $? -ne 0 ]; then
-            first_boot
-            exit $?
+        first_boot
+        exit $?
     fi
 
     # Check is share partition already created
-    sgdisk -p /dev/mmcblk0 | grep share > /dev/null
+    fdisk -l /dev/mmcblk0 | grep "W95 FAT32" > /dev/null
     if [ $? -ne 0 ]; then
         first_boot
         exit $?

+ 1 - 1
FunKey/board/funkey/rootfs-overlay/etc/issue

@@ -5,6 +5,6 @@
 |___|    |_____|__|__||__|\__||_____|___  |
          FUN ON A KEYCHAIN          |_____|
  -----------------------------------------------------
- Version 1.0.1
+ Version 1.1.0
  -----------------------------------------------------
 

+ 5 - 5
FunKey/board/funkey/rootfs-overlay/etc/os-release

@@ -1,12 +1,12 @@
 NAME="FunKey-OS"
-VERSION="1.0.1 (Funky Fish)"
+VERSION="1.1.0 (Quacking Quagga)"
 ID=funkey
 ID_LIKE=buildroot
-PRETTY_NAME="FunKey-OS 1.0.1"
-VERSION_ID="1.0.1"
+PRETTY_NAME="FunKey-OS 1.1.0"
+VERSION_ID="1.1.0"
 HOME_URL="https://www.funkey-project.com/"
 SUPPORT_URL="https://www.funkey-project.com/"
 BUG_REPORT_URL="https://www.funkey-project.com/"
 PRIVACY_POLICY_URL="https://www.funkey-project.com"
-VERSION_CODENAME=Funky
-UBUNTU_CODENAME=Funky
+VERSION_CODENAME=Quacking
+UBUNTU_CODENAME=Quacking

+ 1 - 1
FunKey/board/funkey/rootfs-overlay/etc/sw-versions

@@ -1 +1 @@
-rootfs	1.0.1
+rootfs	1.1.0

+ 45 - 25
FunKey/board/funkey/rootfs-overlay/usr/local/sbin/first_boot

@@ -3,6 +3,9 @@
 # Uncomment the following line to get debug info
 #set -x
 
+# This is to avoid expanding '*' in fdisk results
+set -f
+
 source /usr/local/lib/utils
 
 SELF=$(basename $0)
@@ -22,11 +25,6 @@ swap_part=/dev/mmcblk0p${swap_part_num}
 let share_part_num=${swap_part_num}+1
 share_part=/dev/mmcblk0p${share_part_num}
 
-check_first_boot () {
-    [ -f /.first_boot ] && die 0 "nothing to do"
-    return 0
-}
-
 check_root_id () {
     [ $(id -u) -ne 0 ] && die 3 "this script must be run as root, aborting"
     return 0
@@ -35,25 +33,30 @@ check_root_id () {
 resize_rootfs_partition () {
 
     # Check that the last partition is the rootfs partition
-    local last_part_line=$(sgdisk -p /dev/mmcblk0 | tail -n 1)
+    local last_part_line=$(fdisk -l /dev/mmcblk0 2>/dev/null | tail -n 1)
     set ${last_part_line}
-    local last_part=${1}
-    if [ "${last_part}" != "${root_part_num}" ]; then
+    local last_part_num=${1#/dev/mmcblk0p}
+    local part_start=${3}
+    if [ "${last_part_num}" != "${root_part_num}" ]; then
 	die 4 "rootfs is not the last partition. Don't know how to expand, aborting"
     fi
 
     # Remove (temporarily) the rootfs partition
-    sgdisk -d ${root_part_num} /dev/mmcblk0 >/dev/null 2>&1 || die 5 "cannot remove the rootfs partition, aborting"
-
     # Re-create the rootfs partition with a 1GB size
-    sgdisk -n ${root_part_num}:0:+1G -c ${root_part_num}:rootfs /dev/mmcblk0 >/dev/null 2>&1 || die 6 "cannot resize the rootfs partition, aborting"
+    fdisk /dev/mmcblk0 >/dev/null 2>&1 <<EOF
+d
+${root_part_num}
+n
+p
+${root_part_num}
+${part_start}
++1G
+w
+EOF
 
     # Mark the rootfs partition as bootable
-    sgdisk -A ${root_part_num}:set:2 /dev/mmcblk0 >/dev/null 2>&1 || die 7 "cannot make the rootfs partition bootable, aborting"
+    sfdisk -A /dev/mmcblk0 ${root_part_num} >/dev/null 2>&1 || die 7 "cannot make the rootfs partition bootable, aborting"
 
-    # Copy the primary GPT to the end of the disk
-    sgdisk -e /dev/mmcblk0 >/dev/null 2>&1 || die 8 "cannot move the GPT to the end of the disk"
-    sync
     return 0
 }
 
@@ -74,9 +77,9 @@ create_swap () {
     if [ $? -ne 0 ]; then
 
 	# Check that the last partition is the rootfs partition
-	local last_part_line=$(sgdisk -p /dev/mmcblk0 2>/dev/null | tail -n 1)
+	local last_part_line=$(fdisk -l /dev/mmcblk0 2>/dev/null | tail -n 1)
 	set ${last_part_line}
-	local last_part_num=${1}
+	local last_part_num=${1#/dev/mmcblk0p}
 	if [ "$last_part_num" != "$root_part_num" ]; then
 	    die 11 "rootfs is not the last partition. Don't know how to create the backing store partition"
 	fi
@@ -84,9 +87,17 @@ create_swap () {
 	# Create an additional linux swap partition
 	let swap_part_num=${last_part_num}+1
 	swap_part=/dev/mmcblk0p${swap_part_num}
-	sgdisk -n ${swap_part_num}:0:+128M -c ${swap_part_num}:swap -t ${swap_part_num}:8200 /dev/mmcblk0 >/dev/null 2>&1 || die 12 "cannot create the swap partition, aborting"
-	sync
-	partprobe /dev/mmcblk0 >/dev/null 2>&1 || die 13 "cannot reload the partition table, aborting"
+	fdisk /dev/mmcblk0 >/dev/null 2>&1 <<EOF
+n
+p
+${swap_part_num}
+
++128M
+t
+${wap_part_num}
+82
+w
+EOF
 	mkswap ${swap_part} >/dev/null 2>&1
 	if [ $? -ne 0 ]; then
 	    die 14 "cannot create swap file, aborting"
@@ -105,17 +116,27 @@ create_backing_store_partition () {
     if [ $? -ne 0 ]; then
 
 	# Check that the last partition is the swap partition
-	local last_part_line=$(sgdisk -p /dev/mmcblk0 2>/dev/null | tail -n 1)
+	local last_part_line=$(fdisk -l /dev/mmcblk0 2>/dev/null | tail -n 1)
 	set ${last_part_line}
-	local last_part_num=${1}
+	local last_part_num=${1#/dev/mmcblk0p}
 	if [ "${last_part_num}" != "${swap_part_num}" ]; then
 	    die 15 "rootfs is not the last partition. Don't know how to create the backing store partition"
 	fi
 
-	# Create an additional Microsoft basic data partition share partition that fills the disk
+	# Create an additional FAT32 share partition that fills the disk
 	let share_part_num=${last_part_num}+1
 	share_part=/dev/mmcblk0p${share_part_num}
-	sgdisk -n ${share_part_num}:0:-0 -c ${share_part_num}:share -t ${share_part_num}:0700 /dev/mmcblk0 >/dev/null 2>&1 || die 16 "cannot create the backing store partition, aborting"
+	fdisk /dev/mmcblk0 >/dev/null 2>&1 <<EOF
+n
+p
+${share_part_num}
+
+
+t
+${share_part_num}
+c
+w
+EOF
 	sync
     fi
     return 0
@@ -139,7 +160,6 @@ copy_files_to_store_partition () {
 }
 
 check_root_id
-check_first_boot
 notif " FIRST BOOT DETECTED"
 
 notif " 1/9 RESIZE ROOT PARTITION"

+ 2 - 7
FunKey/board/funkey/rootfs-overlay/usr/local/sbin/recovery_mode

@@ -1,9 +1,4 @@
 #!/bin/sh
-sgdisk -A 1:set:2 -A 2:clear:2 /dev/mmcblk0 >/dev/null 2>&1
-recovery=$(sgdisk -A 1:get:2 /dev/mmcblk0 | cut -d : -f3)
-if [ ${recovery} -eq 1 ]; then
-    echo "Next boot will be in recovery mode"
-else
-    echo "Next boot will be in normal mode"
-fi
+sfdisk -A /dev/mmcblk0 1 >/dev/null 2>&1
+echo "Next boot will be in recovery mode"
 reboot

+ 1 - 1
FunKey/board/funkey/sw-description

@@ -1,6 +1,6 @@
 software =
 {
-        version = "1.0.1";
+        version = "1.1.0";
 
         hardware-compatibility = [ "#RE:^Rev\.[D-E]$" ];
 

+ 0 - 1
Recovery/board/funkey/linux.config

@@ -11,7 +11,6 @@ CONFIG_PERF_EVENTS=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_PARTITION_ADVANCED=y
-# CONFIG_MSDOS_PARTITION is not set
 CONFIG_ARCH_SUNXI=y
 # CONFIG_MACH_SUN4I is not set
 # CONFIG_MACH_SUN5I is not set

+ 1 - 1
Recovery/board/funkey/rootfs-overlay/etc/issue

@@ -5,6 +5,6 @@
 |___|    |_____|__|__||__|\__||_____|___  |
          FUN ON A KEYCHAIN          |_____|
  -----------------------------------------------------
- Version 1.0.1 (Recovery)
+ Version 1.1.0 (Recovery)
  -----------------------------------------------------
 

+ 5 - 5
Recovery/board/funkey/rootfs-overlay/etc/os-release

@@ -1,12 +1,12 @@
 NAME="FunKey-OS Recovery"
-VERSION="1.0.1 (Funky Fish)"
+VERSION="1.1.0 (Quacking Quagga)"
 ID=funkey-recovery
 ID_LIKE=buildroot
-PRETTY_NAME="FunKey-OS Recovery 1.0.1"
-VERSION_ID="1.0.1"
+PRETTY_NAME="FunKey-OS Recovery 1.1.0"
+VERSION_ID="1.1.0"
 HOME_URL="https://www.funkey-project.com/"
 SUPPORT_URL="https://www.funkey-project.com/"
 BUG_REPORT_URL="https://www.funkey-project.com/"
 PRIVACY_POLICY_URL="https://www.funkey-project.com"
-VERSION_CODENAME=Funky
-UBUNTU_CODENAME=Funky
+VERSION_CODENAME=Quacking
+UBUNTU_CODENAME=Quacking

+ 1 - 1
Recovery/board/funkey/rootfs-overlay/etc/sw-versions

@@ -1 +1 @@
-Recovery	1.0.1
+Recovery	1.1.0

+ 2 - 7
Recovery/board/funkey/rootfs-overlay/usr/local/sbin/normal_mode

@@ -1,9 +1,4 @@
 #!/bin/sh
-sgdisk -A 1:clear:2 -A 2:set:2 /dev/mmcblk0 >/dev/null 2>&1
-recovery=$(sgdisk -A 1:get:2 /dev/mmcblk0 | cut -d : -f3)
-if [ ${recovery} -eq 1 ]; then
-    echo "Next boot will be in recovery mode"
-else
-    echo "Next boot will be in normal mode"
-fi
+sfdisk -A /dev/mmcblk0 2 >/dev/null 2>&1
+echo "Next boot will be in normal mode"
 reboot

+ 0 - 14
genimage-prod.cfg

@@ -3,16 +3,8 @@ config {
 
 image sdcard-prod.img {
 	hdimage {
-		gpt = true
-		gpt-location = 800K
 	}
 
-#	partition gpt-header {
-#		in-partition-table = "no"
-#		offset = 1K
-#		size = 512
-#	}
-
 	partition u-boot {
 		in-partition-table = "no"
 		image = "Recovery/output/images/u-boot-sunxi-with-spl.bin"
@@ -27,12 +19,6 @@ image sdcard-prod.img {
 		image = "Recovery/output/images/u-boot-env-prod.img"
 	}
 
-#	partition gpt-table {
-#		in-partition-table = "no"
-#		offset = 800K
-#		size = 16K
-#	}
-
 	partition Recovery {
 		offset = 1M
 		partition-type = 0x83

+ 0 - 14
genimage.cfg

@@ -3,16 +3,8 @@ config {
 
 image sdcard.img {
 	hdimage {
-		gpt = true
-		gpt-location = 800K
 	}
 
-#	partition gpt-header {
-#		in-partition-table = "no"
-#		offset = 1K
-#		size = 512
-#	}
-
 	partition u-boot {
 		in-partition-table = "no"
 		image = "Recovery/output/images/u-boot-sunxi-with-spl.bin"
@@ -27,12 +19,6 @@ image sdcard.img {
 		image = "Recovery/output/images/u-boot-env.img"
 	}
 
-#	partition gpt-table {
-#		in-partition-table = "no"
-#		offset = 800K
-#		size = 16K
-#	}
-
 	partition Recovery {
 		offset = 1M
 		partition-type = 0x83