diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-10-08 09:47:40 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-10-11 16:37:17 -0400 |
commit | 2a471e288c16b91a7186a60b3fb84dd55a494c7a (patch) | |
tree | 3e746212c5fa69b59f61d19b6e29d11aa8a5e31b /tools/hiby_patcher.pl | |
parent | 5efaa9ef8073bb216e3dcdbb4476f2fa7c672b76 (diff) | |
download | rockbox-2a471e288c16b91a7186a60b3fb84dd55a494c7a.tar.gz rockbox-2a471e288c16b91a7186a60b3fb84dd55a494c7a.zip |
New port: AIGO EROS Q / EROS K
The Q and K have a slightly different case, but the hardware under the
shell is completely identical.
These models are rebadged versions:
* Hifiwalker H2 (== Q)
* AGPTek H3 (== K)
* Surfans F20 (== K)
Other notes:
* Significant improvements in the shared Hiby-platform launcher/loader
* SD card can theoretically be hot-swapped now
* Support external USB mass storage!
* Some consolidation of Hiby-platform targets
* Some consolidation of plugin keymaps
Todo/known issues:
* Keymaps need to be gone over properly
* Convert to HAVE_SCROLLWHEEL?
Change-Id: I5a8a4f22c38a5b69392ca7c0a8ad8c4e07d9523c
Diffstat (limited to 'tools/hiby_patcher.pl')
-rwxr-xr-x | tools/hiby_patcher.pl | 77 |
1 files changed, 70 insertions, 7 deletions
diff --git a/tools/hiby_patcher.pl b/tools/hiby_patcher.pl index 9c45ce6dd3..86b8ad3d3f 100755 --- a/tools/hiby_patcher.pl +++ b/tools/hiby_patcher.pl | |||
@@ -38,6 +38,10 @@ if ($model eq 'rocker') { | |||
38 | @ubiopts = ("-e", "124KiB", "-c", "1024", "-m", "2048", "-j", "8192KiB", "-U"); | 38 | @ubiopts = ("-e", "124KiB", "-c", "1024", "-m", "2048", "-j", "8192KiB", "-U"); |
39 | } elsif ($model eq 'x20') { | 39 | } elsif ($model eq 'x20') { |
40 | @ubiopts = ("-e", "124KiB", "-c", "1024", "-m", "2048", "-j", "8192KiB", "-U"); | 40 | @ubiopts = ("-e", "124KiB", "-c", "1024", "-m", "2048", "-j", "8192KiB", "-U"); |
41 | } elsif ($model eq 'eros_q') { | ||
42 | @ubiopts = ("-e", "124KiB", "-c", "1024", "-m", "2048", "-j", "8192KiB", "-U"); | ||
43 | } elsif ($model eq 'm3k') { | ||
44 | @ubiopts = ("-e", "124KiB", "-c", "2048", "-m", "2048", "-j", "8192KiB", "-U"); | ||
41 | } else { | 45 | } else { |
42 | die ("Unknown hiby model: $model\n"); | 46 | die ("Unknown hiby model: $model\n"); |
43 | } | 47 | } |
@@ -81,7 +85,6 @@ while (<UPDATE>) { | |||
81 | if ($rootfs_found) { | 85 | if ($rootfs_found) { |
82 | if (/file_path=(.*)/) { | 86 | if (/file_path=(.*)/) { |
83 | $ubiname = basename($1); | 87 | $ubiname = basename($1); |
84 | $ubiname =~ tr/[a-z]/[A-Z]/; | ||
85 | last; | 88 | last; |
86 | } | 89 | } |
87 | } else { | 90 | } else { |
@@ -92,7 +95,11 @@ while (<UPDATE>) { | |||
92 | } | 95 | } |
93 | close UPDATE; | 96 | close UPDATE; |
94 | 97 | ||
95 | die("can't locate rootfs image") if (! -e "$isowork/$ubiname"); | 98 | if (! -e "$isowork/$ubiname") { |
99 | $ubiname =~ tr/[a-z]/[A-Z]/; | ||
100 | die("can't locate rootfs image ($ubiname)") if (! -e "$isowork/$ubiname"); | ||
101 | } | ||
102 | |||
96 | $ubiname = "$isowork/$ubiname"; | 103 | $ubiname = "$isowork/$ubiname"; |
97 | 104 | ||
98 | ### Extract RootFS | 105 | ### Extract RootFS |
@@ -102,6 +109,7 @@ mkdir($rootfsdir) || die ("Can't create '$rootfsdir'"); | |||
102 | @sysargs = ("ubireader_extract_files", "-k", "-o", $rootfsdir, $ubiname); | 109 | @sysargs = ("ubireader_extract_files", "-k", "-o", $rootfsdir, $ubiname); |
103 | system(@sysargs); | 110 | system(@sysargs); |
104 | 111 | ||
112 | # exit(0); | ||
105 | ### Mangle RootFS | 113 | ### Mangle RootFS |
106 | 114 | ||
107 | # Generate rb_bootloader.sh | 115 | # Generate rb_bootloader.sh |
@@ -109,19 +117,74 @@ my $rbbasename = basename($rbbname); | |||
109 | my $bootloader_sh = | 117 | my $bootloader_sh = |
110 | "#!/bin/sh | 118 | "#!/bin/sh |
111 | 119 | ||
112 | mount /dev/mmcblk0 /mnt/sd_0 &>/dev/null || \ | 120 | #mkdir -p /mnt/sd_0 |
113 | mount /dev/mmcblk0p1 /mnt/sd_0 &>/dev/null | 121 | # |
122 | #mount /dev/mmcblk0 /mnt/sd_0 &>/dev/null || \ | ||
123 | #mount /dev/mmcblk0p1 /mnt/sd_0 &>/dev/null | ||
124 | |||
125 | killall hiby_player &>/dev/null | ||
126 | killall -9 hiby_player &>/dev/null | ||
127 | |||
128 | killall $rbbasename &>/dev/null | ||
129 | killall -9 $rbbasename &>/dev/null | ||
114 | 130 | ||
115 | killall $rbbasename | 131 | # /etc/init.d/K90adb start |
116 | killall -9 $rbbasename | ||
117 | 132 | ||
133 | # Rockbox launcher! | ||
118 | /usr/bin/$rbbasename | 134 | /usr/bin/$rbbasename |
119 | sleep 1 | 135 | sleep 1 |
120 | reboot | 136 | reboot |
121 | "; | 137 | "; |
122 | open FILE, ">$rootfsdir/usr/bin/hiby_player.sh" || die ("can't write bootloader script!"); | 138 | open FILE, ">$rootfsdir/usr/bin/hiby_player.sh" || die ("can't write bootloader script!"); |
123 | print FILE $bootloader_sh; | 139 | print FILE $bootloader_sh; |
124 | close FILE; | 140 | close FILE; |
141 | chmod 0755, "$rootfsdir/usr/bin/hiby_player.sh"; | ||
142 | |||
143 | # Auto mount/unmount external USB drives | ||
144 | open FILE, ">>$rootfsdir/etc/mdev.conf" || die ("can't access mdev conf!"); | ||
145 | print FILE "sd[a-z][0-9]+ 0:0 664 @ /etc/rb_inserting.sh\n"; | ||
146 | print FILE "mmcblk[0-9]p[0-9] 0:0 664 @ /etc/rb_inserting.sh\n"; | ||
147 | print FILE "mmcblk[0-9] 0:0 664 @ /etc/rb_inserting.sh\n"; | ||
148 | print FILE "sd[a-z] 0:0 664 \$ /etc/rb_removing.sh"; | ||
149 | print FILE "mmcblk[0-9] 0:0 664 \$ /etc/rb_removing.sh\n"; | ||
150 | close FILE; | ||
151 | |||
152 | my $insert_sh = ' | ||
153 | #!/bin/sh | ||
154 | # $MDEV is the device | ||
155 | |||
156 | case $MDEV in | ||
157 | mmc*) | ||
158 | MNT_POINT=/mnt/sd_0 | ||
159 | ;; | ||
160 | sd*) | ||
161 | MNT_POINT=/mnt/sd_0/USB | ||
162 | ;; | ||
163 | esac | ||
164 | |||
165 | if [ ! -d $MNT_POINT ];then | ||
166 | mkdir $MNT_POINT | ||
167 | fi | ||
168 | |||
169 | mount $MDEV $MNT_POINT | ||
170 | '; | ||
171 | |||
172 | open FILE, ">$rootfsdir/etc/rb_inserting.sh" || die("can't write hotplug helpers!"); | ||
173 | print FILE $insert_sh; | ||
174 | close FILE; | ||
175 | chmod 0755, "$rootfsdir/etc/rb_inserting.sh"; | ||
176 | |||
177 | my $remove_sh = ' | ||
178 | #!/bin/sh | ||
179 | # $MDEV is the device | ||
180 | sync; | ||
181 | unmount -f $MDEV; | ||
182 | '; | ||
183 | |||
184 | open FILE, ">$rootfsdir/etc/rb_removing.sh" || die("can't write hotplug helpers!"); | ||
185 | print FILE $remove_sh; | ||
186 | close FILE; | ||
187 | chmod 0755, "$rootfsdir/etc/rb_removing.sh"; | ||
125 | 188 | ||
126 | # Copy bootloader over | 189 | # Copy bootloader over |
127 | @sysargs=("cp", "$rbbname", "$rootfsdir/usr/bin/$rbbasename"); | 190 | @sysargs=("cp", "$rbbname", "$rootfsdir/usr/bin/$rbbasename"); |