Skip to content

Commit

Permalink
fix chromeos-installer
Browse files Browse the repository at this point in the history
  • Loading branch information
yunshansimon committed Apr 28, 2024
1 parent ce2613d commit e59eb15
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 94 deletions.
11 changes: 5 additions & 6 deletions chromeos-base/chromeos-installer/chromeos-installer.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@

unset -f cros_pre_src_prepare_openfyde_patches

cros_post_src_install_orangepi5_openfyde_base() {
cros_post_src_install_orangepi5_openfyde() {
exeinto /usr/sbin
doexe ${ORANGEPI5_OPENFYDE_BASE_BASHRC_FILESDIR}/flash_spi.sh
doexe ${ORANGEPI5_OPENFYDE_BASE_BASHRC_FILESDIR}/copy_kernel.sh
doexe ${ORANGEPI5_OPENFYDE_BASHRC_FILESDIR}/flash_spi.sh
doexe ${ORANGEPI5_OPENFYDE_BASHRC_FILESDIR}/copy_kernel.sh
}

cros_pre_src_prepare_orangepi5_openfyde_base_patches() {
eapply -p2 ${ORANGEPI5_OPENFYDE_BASE_BASHRC_FILESDIR}/install.patch
eapply -p2 ${ORANGEPI5_OPENFYDE_BASE_BASHRC_FILESDIR}/postinst.patch
cros_pre_src_prepare_orangepi5_openfyde_patches() {
eapply -p1 ${ORANGEPI5_OPENFYDE_BASHRC_FILESDIR}/orange-pi5.patch
}
21 changes: 0 additions & 21 deletions chromeos-base/chromeos-installer/files/install.patch

This file was deleted.

68 changes: 68 additions & 0 deletions chromeos-base/chromeos-installer/files/orange-pi5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Index: installer/chromeos-install
===================================================================
--- installer.orig/chromeos-install
+++ installer/chromeos-install
@@ -722,6 +722,7 @@ install_stateful() {
var_overlay/db/pkg
var_overlay/lib/portage
dev_image
+ fyde
"

local rootfs_dlc="${ROOT}/opt/google/dlc"
@@ -1026,6 +1027,8 @@ do_post_install() {
fi
local dst_rootfs_dev=""

+ FLAGS_skip_postinstall="${FLAGS_FALSE}"
+ echo "Ignoring --skip_postinstall"
# Now run the postinstall script on one new rootfs. Note that even though
# we're passing the new destination partition number as an arg, the postinst
# script had better not try to access it, for the reasons we just gave.
Index: installer/chromeos-postinst
===================================================================
--- installer.orig/chromeos-postinst
+++ installer/chromeos-postinst
@@ -58,6 +58,32 @@ get_android_version() {
echo ${version#*=}
}

+get_mtd_dev()
+{
+ echo '/dev/mtdblock0'
+}
+
+get_boot_type()
+{
+ cat /mnt/stateful_partition/fyde/Env.txt \
+ | grep -o '^[^#]*' | grep 'overlays=' | grep -q 'ssd-sata'
+
+ if [ "$?" -eq "0" ]; then
+ echo 'SATA'
+ return 0
+ fi
+
+ cat /mnt/stateful_partition/fyde/Env.txt \
+ | grep -o '^[^#]*' | grep 'fdtfile=' | grep -q 'rk3588s-orangepi-5b'
+
+ if [ "$?" -eq "0" ]; then
+ echo 'EMMC'
+ else
+ echo 'NVME'
+ fi
+}
+
+
main() {
local target_disk=$(get_disk_dev)
local target_part_num=$(get_part_num)
@@ -80,6 +106,9 @@ main() {
fi

local install_dev="$1"
+
+ chroot . /usr/sbin/flash_spi.sh "$(get_mtd_dev)" "$(get_boot_type)"
+ chroot . /usr/sbin/copy_kernel.sh "$target_disk"
shift
chroot . /usr/bin/cros_installer --type="postinst" \
--install_dev="${install_dev}" --install_dir="/" "$@"
67 changes: 0 additions & 67 deletions chromeos-base/chromeos-installer/files/postinst.patch

This file was deleted.

14 changes: 14 additions & 0 deletions profiles/base/profile.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

orangepi5_openfyde_stack_bashrc() {
local cfg

cfgd="/mnt/host/source/src/overlays/overlay-orangepi5-openfyde/${CATEGORY}/${PN}"
for cfg in ${PN} ${P} ${PF} ; do
cfg="${cfgd}/${cfg}.bashrc"
[[ -f ${cfg} ]] && . "${cfg}"
done

export ORANGEPI5_OPENFYDE_BASHRC_FILESDIR="${cfgd}/files"
}

orangepi5_openfyde_stack_bashrc

0 comments on commit e59eb15

Please sign in to comment.