freemyipod r672 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r671‎ | r672 | r673 >
Date:18:37, 25 March 2011
Author:theseven
Status:new
Tags:
Comment:
Integrate the new iPod Nano 2G features into its installer, and fix some installer bugs
Modified paths:
  • /apps/installer-ipodnano2g/Makefile (modified) (history)
  • /apps/installer-ipodnano2g/flashfiles (modified) (history)
  • /apps/installer-ipodnano2g/main.c (modified) (history)
  • /apps/installer-ipodnano2g/resources.S (modified) (history)

Diff [purge]

Index: apps/installer-ipodnano2g/flashfiles
Property changes on: apps/installer-ipodnano2g/flashfiles
___________________________________________________________________
Modified: svn:ignore
## -10,3 +10,6 ##
11 rockbox.png
22 ui.emcorelib
33 umsboot-ipodnano2g.ucl
 4+rockbox.ipod.ucl
 5+mkfat32.emcorelib
 6+uninstaller-ipodnano2g.emcoreapp
Index: apps/installer-ipodnano2g/main.c
@@ -27,7 +27,8 @@
2828
2929
3030 #define STRINGIFY(x) #x
31 -#define BOOTNOTE_FILENAME "/Notes/" STRINGIFY(BASENAME) ".bootnote"
 31+#define STR(x) STRINGIFY(x)
 32+#define BOOTNOTE_FILENAME "/Notes/" STR(BASENAME) ".bootnote"
3233
3334
3435 void main();
@@ -283,7 +284,7 @@
284285 ((uint16_t*)buf1)[0x18] = 1;
285286 ((uint8_t*)buf1)[0x40] = 0x80;
286287 ((uint8_t*)buf1)[0x42] = 0x29;
287 - if (!fat32_ok) memcpy(&((uint8_t*)buf1)[0x43], "\0\0\0\0iPod Nano ", 0xf);
 288+ if (!fat32_ok) memcpy(&((uint8_t*)buf1)[0x43], "\0\0\0\0iPod Nano2G", 0xf);
288289 else memcpy(&((uint8_t*)buf1)[0x43], &((uint8_t*)buf2)[0x43], 0xf);
289290 memcpy(&((uint8_t*)buf1)[0x52], "FAT32 ", 8);
290291 ((uint16_t*)buf1)[0xff] = 0xaa55;
@@ -391,7 +392,7 @@
392393 for (i = 0; i < fat32_secperclus; i++)
393394 {
394395 memset(buf1, 0, 0x800);
395 - if (!i) memcpy(buf1, "iPod Nano \x08", 12);
 396+ if (!i) memcpy(buf1, "iPod Nano2G\x08", 12);
396397 if (storage_write_sectors_md(0, database + i, 1, buf1))
397398 {
398399 free(buf1);
@@ -748,7 +749,8 @@
749750 sleep(500000);
750751 ui->blenda(160, 60, 255, framebuf, 0, 0, 160,
751752 darkened, 8, 27, 176, disclaimer, 0, 550, 160);
752 - displaylcd(8, 27, 160, 91, framebuf, 0, 0, 160);
 753+ displaylcd(8, 27, 160, 60, framebuf, 0, 0, 160);
 754+ displaylcd(8, 87, 160, 31, darkened, 8, 87, 176);
753755 button = 0;
754756 while (!button) wakeup_wait(&eventwakeup, TIMEOUT_BLOCK);
755757 memcpy((void*)0x2202bf00, "diskmodehotstuff\1\0\0", 20);
@@ -765,7 +767,8 @@
766768 {
767769 ui->blenda(160, 80, 255, framebuf, 0, 0, 160,
768770 darkened, 8, 27, 176, disclaimer, 0, 470, 160);
769 - displaylcd(8, 27, 160, 91, framebuf, 0, 0, 160);
 771+ displaylcd(8, 27, 160, 80, framebuf, 0, 0, 160);
 772+ displaylcd(8, 107, 160, 11, darkened, 8, 107, 176);
770773
771774 button = 0;
772775 struct button_hook_entry* hook = button_register_handler(handler, NULL);
@@ -786,7 +789,8 @@
787790 sleep(500000);
788791 ui->blenda(160, 60, 255, framebuf, 0, 0, 160,
789792 darkened, 8, 27, 176, disclaimer, 0, 550, 160);
790 - displaylcd(8, 27, 160, 91, framebuf, 0, 0, 160);
 793+ displaylcd(8, 27, 160, 60, framebuf, 0, 0, 160);
 794+ displaylcd(8, 87, 160, 31, darkened, 8, 87, 176);
791795 button = 0;
792796 while (!button) wakeup_wait(&eventwakeup, TIMEOUT_BLOCK);
793797 memcpy((void*)0x2202bf00, "diskmodehotstuff\1\0\0", 20);
@@ -800,9 +804,10 @@
801805 }
802806 else if (fat32_startsector)
803807 {
804 - ui->blenda(160, 70, 255, framebuf, 0, 0, 160,
805 - darkened, 8, 27, 176, disclaimer, 0, 400, 160);
806 - displaylcd(8, 27, 160, 91, framebuf, 0, 0, 160);
 808+ ui->blenda(130, 70, 255, framebuf, 0, 0, 130,
 809+ darkened, 23, 27, 176, disclaimer, 0, 400, 160);
 810+ displaylcd(8, 27, 160, 91, darkened, 8, 27, 176);
 811+ displaylcd(23, 27, 130, 70, framebuf, 0, 0, 130);
807812
808813 button = 0;
809814 struct button_hook_entry* hook = button_register_handler(handler, NULL);
Index: apps/installer-ipodnano2g/resources.S
@@ -115,6 +115,22 @@
116116 .byte 0
117117 .byte 0
118118 .byte 1
 119+.word f_mkfat32_emcorelib
 120+.word f_mkfat32_emcorelib_end - f_mkfat32_emcorelib
 121+.ascii "libmkf32"
 122+
 123+.byte 0
 124+.byte 0
 125+.byte 0
 126+.byte 1
 127+.word f_uninstaller_ipodnano2g_emcoreapp
 128+.word f_uninstaller_ipodnano2g_emcoreapp_end - f_uninstaller_ipodnano2g_emcoreapp
 129+.ascii "uninst "
 130+
 131+.byte 0
 132+.byte 0
 133+.byte 0
 134+.byte 1
119135 .word f_bootmenu_ipodnano2g_emcoreapp
120136 .word f_bootmenu_ipodnano2g_emcoreapp_end - f_bootmenu_ipodnano2g_emcoreapp
121137 .ascii "bootmenu"
@@ -151,17 +167,23 @@
152168 .word f_crapple_png_end - f_crapple_png
153169 .ascii "crapple "
154170
 171+.byte 0
 172+.byte 2
 173+.byte 0
 174+.byte 1
 175+.word f_rockbox_ipod_ucl
 176+.word f_rockbox_ipod_ucl_end - f_rockbox_ipod_ucl
 177+.ascii "rockbox "
 178+
155179 .word 0
156180
157181
158182 firstinstcost:
 183+.word 11
 184+commoncost:
159185 .word 0
 186+
160187 firstinstscript:
161 -.word 0
162 -
163 -commoncost:
164 -.word 11
165 -commonscript:
166188 .word 1
167189 .word boot_dirname
168190 .word 1
@@ -170,6 +192,7 @@
171193 .word 0xffffffff
172194 .word 0
173195 .word 10
 196+commonscript:
174197 .word 0
175198
176199
@@ -231,6 +254,16 @@
232255 f_ui_emcorelib_end:
233256
234257 .align 4
 258+f_mkfat32_emcorelib:
 259+.incbin "flashfiles/mkfat32.emcorelib"
 260+f_mkfat32_emcorelib_end:
 261+
 262+.align 4
 263+f_uninstaller_ipodnano2g_emcoreapp:
 264+.incbin "flashfiles/uninstaller-ipodnano2g.emcoreapp"
 265+f_uninstaller_ipodnano2g_emcoreapp_end:
 266+
 267+.align 4
235268 f_bootmenu_ipodnano2g_emcoreapp:
236269 .incbin "flashfiles/bootmenu-ipodnano2g.emcoreapp"
237270 f_bootmenu_ipodnano2g_emcoreapp_end:
@@ -241,6 +274,11 @@
242275 f_umsboot_ipodnano2g_ucl_end:
243276
244277 .align 4
 278+f_rockbox_ipod_ucl:
 279+.incbin "flashfiles/rockbox.ipod.ucl"
 280+f_rockbox_ipod_ucl_end:
 281+
 282+.align 4
245283 f_emcore_ipodnano2g_ucl:
246284 .incbin "flashfiles/emcore-ipodnano2g.ucl"
247285 f_emcore_ipodnano2g_ucl_end:
Index: apps/installer-ipodnano2g/Makefile
@@ -5,17 +5,20 @@
66 FATNAME ?= INSTAL~1BOO
77
88 EMCOREDIR ?= ../../emcore/trunk/
 9+UNINSTDIR ?= ../uninstaller-ipodnano2g/
910 BOOTMENUDIR ?= ../bootmenu-ipodnano2g/
1011 LIBBOOTDIR ?= ../../libs/boot/
1112 LIBPNGDIR ?= ../../libs/png/
1213 LIBUIDIR ?= ../../libs/ui/
 14+LIBMKFAT32DIR ?= ../../libs/mkfat32/
1315 UMSBOOTDIR ?= ../../umsboot/
1416 NOTEBOOTDIR ?= ../../noteboot/
1517 TOOLSDIR ?= ../../tools/
1618
17 -FLASHFILES = flashfiles/boot.emcorelib flashfiles/png.emcorelib flashfiles/ui.emcorelib flashfiles/crapple.png \
18 - flashfiles/bootmenu-ipodnano2g.emcoreapp flashfiles/background.png flashfiles/icons.png flashfiles/rockbox.png \
19 - flashfiles/emcoreldr-ipodnano2g.dfu flashfiles/emcore-ipodnano2g.ucl flashfiles/umsboot-ipodnano2g.ucl
 19+FLASHFILES = flashfiles/boot.emcorelib flashfiles/png.emcorelib flashfiles/ui.emcorelib flashfiles/mkfat32.emcorelib \
 20+ flashfiles/crapple.png flashfiles/uninstaller-ipodnano2g.emcoreapp flashfiles/bootmenu-ipodnano2g.emcoreapp \
 21+ flashfiles/background.png flashfiles/icons.png flashfiles/rockbox.png flashfiles/emcoreldr-ipodnano2g.dfu \
 22+ flashfiles/emcore-ipodnano2g.ucl flashfiles/umsboot-ipodnano2g.ucl
2023
2124 ifeq ($(shell uname),WindowsNT)
2225 CCACHE :=
@@ -43,7 +46,7 @@
4447 LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --emit-relocs --gc-sections
4548
4649 preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
47 -preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
 50+preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:" | sed -e "s:^\\./::")
4851
4952 REVISION := $(shell svnversion .)
5053 REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
@@ -191,6 +194,12 @@
192195 @echo [CP] $@
193196 @cp $< $@
194197
 198+$(LIBMKFAT32DIR)/build/mkfat32.emcorelib: libmkfat32
 199+
 200+flashfiles/mkfat32.emcorelib: $(LIBMKFAT32DIR)/build/mkfat32.emcorelib libmkfat32
 201+ @echo [CP] $@
 202+ @cp $< $@
 203+
195204 $(UMSBOOTDIR)/build/ipodnano2g/umsboot-ipodnano2g.ucl: umsboot
196205
197206 flashfiles/umsboot-ipodnano2g.ucl: $(UMSBOOTDIR)/build/ipodnano2g/umsboot-ipodnano2g.ucl umsboot
@@ -197,6 +206,12 @@
198207 @echo [CP] $@
199208 @cp $< $@
200209
 210+$(UNINSTDIR)/build/uninstaller-ipodnano2g.emcoreapp: uninstaller-ipodnano2g
 211+
 212+flashfiles/uninstaller-ipodnano2g.emcoreapp: $(UNINSTDIR)/build/uninstaller-ipodnano2g.emcoreapp uninstaller-ipodnano2g
 213+ @echo [CP] $@
 214+ @cp $< $@
 215+
201216 $(BOOTMENUDIR)/build/bootmenu-ipodnano2g.emcoreapp: bootmenu-ipodnano2g
202217
203218 flashfiles/bootmenu-ipodnano2g.emcoreapp: $(BOOTMENUDIR)/build/bootmenu-ipodnano2g.emcoreapp bootmenu-ipodnano2g
@@ -241,6 +256,9 @@
242257 emcoreldr-ipodnano2g:
243258 @make -C $(EMCOREDIR)/loader/ipodnano2g
244259
 260+uninstaller-ipodnano2g:
 261+ @make -C $(UNINSTDIR)
 262+
245263 bootmenu-ipodnano2g:
246264 @make -C $(BOOTMENUDIR)
247265
@@ -253,6 +271,9 @@
254272 libui:
255273 @make -C $(LIBUIDIR)
256274
 275+libmkfat32:
 276+ @make -C $(LIBMKFAT32DIR)
 277+
257278 umsboot:
258279 @make -C $(UMSBOOTDIR) ipodnano2g
259280
@@ -259,4 +280,4 @@
260281 clean:
261282 @rm -rf build
262283
263 -.PHONY: all clean emcore emcoreldr-ipodnano2g bootmenu-ipodnano2g libboot libpng libui umsboot libucl flashfiles $(NAME)
 284+.PHONY: all clean emcore emcoreldr-ipodnano2g bootmenu-ipodnano2g uninstaller-ipodnano2g libboot libpng libui libmkfat32 umsboot libucl flashfiles $(NAME)