Commit 2becf3fe authored by ROOL's avatar ROOL 🤖
Browse files

Add output mode for Wandboard SD cards

Detail:
  Add an extra radio icon and supporting code to generate images for a Wandboard target, based on the detail in RiscOS/Sources/HAL/iMx6/s/LowBoot.
  Because the on chip loader looks at specific offsets on the SD card we can't use the same FAT layout and file copy operations that the OMAPs do, instead a special FAT image was created:
    mkdosfs -C -R 16386 -s 2 -S 512 blank,fc8 64260
                  ^        ^  ^               ^
                  |        |  |               +---- same as blank for OMAP
                  |        |  +-------------------- 512B/sector
                  |        +----------------------- 2 sectors per cluster
                  +-------------------------------- 8MB reserved for ROM + 1 for BPB + 1 spare

  then the SDCreate program writes the ROM and CMOS into the reserved area plus a welcome note explaining what's happened.
  FrontEnd Desc/Messages/Templates updated accordingly.
  Permit CMOS files of size 260 (256 + the version footer) as well as 240/244/2052.
Admin:
  Makefile changed to use SQUISH from StdTools fragment.

Version 1.26. Tagged as 'SDCreate-1_26'
parent 07c77d0e
......@@ -34,9 +34,6 @@ APP = !${COMPONENT}
RDIR = Resources
LDIR = ${RDIR}.${LOCALE}
SQFLAGS = -nolist
SQUISH = squish
include StdTools
FILES =\
......@@ -49,6 +46,7 @@ FILES =\
$(RDIR).Desc\
$(LDIR).Templates\
$(RDIR).blank\
$(RDIR).blankwand\
$(RDIR).scripts.BeagleBoard\
$(RDIR).scripts.DevKit8000\
$(RDIR).scripts.IGEPv2\
......@@ -81,6 +79,7 @@ install release_autobuild: $(FILES)
${CP} $(RDIR).Desc ${INSTDIR}.${APP}.Desc ${CPFLAGS}
${CP} $(LDIR).Templates ${INSTDIR}.${APP}.Templates ${CPFLAGS}
${CP} $(RDIR).blank ${INSTDIR}.${APP}.blank ${CPFLAGS}
${CP} $(RDIR).blankwand ${INSTDIR}.${APP}.blankwand ${CPFLAGS}
${CP} $(LDIR).Messages ${INSTDIR}.${APP}.Messages ${CPFLAGS}
|
${CP} $(RDIR).scripts.BeagleBoard ${INSTDIR}.${APP}.scripts.BeagleBoard/scr ${CPFLAGS}
......@@ -89,6 +88,7 @@ install release_autobuild: $(FILES)
${CP} $(RDIR).scripts.PandaBoard ${INSTDIR}.${APP}.scripts.PandaBoard/scr ${CPFLAGS}
${CP} $(RDIR).scripts.Pandora ${INSTDIR}.${APP}.scripts.Pandora/scr ${CPFLAGS}
${CP} $(RDIR).scripts.uenv ${INSTDIR}.${APP}.scripts.uenv/txt ${CPFLAGS}
${CP} $(RDIR).scripts.Wandboard ${INSTDIR}.${APP}.scripts.Wandboard/txt ${CPFLAGS}
|
${CP} $(RDIR).scripts.source.beagle ${INSTDIR}.${APP}.scripts.source.beagle ${CPFLAGS}
${CP} $(RDIR).scripts.source.convert ${INSTDIR}.${APP}.scripts.source.convert ${CPFLAGS}
......@@ -113,11 +113,11 @@ clean:
#
$(RDIR).SDCreate: crunched.SDCreate
$(SQUISH) $(SQFLAGS) -from crunched.SDCreate -to $@
$(SQUISH) $(SQUISHFLAGS) -from crunched.SDCreate -to $@
crunched.SDCreate: bas.SDCreate
${MKDIR} crunched
bascrunch -1 bas.SDCreate $@
${RUN}BasCrunch -1 bas.SDCreate $@
$(RDIR).Desc: $(LDIR).Desc
${AWK} -f Build:AwkVers descmode=1 < $(LDIR).Desc > $@
......
......@@ -6,8 +6,8 @@ Introduction
------------
SDCreate is a utility designed to help people with the task of installing
RISC OS ROM images onto SD cards, for use with the OMAP3 and OMAP4 ports of
RISC OS. If you attempt to create an SD card manually then there are many
RISC OS ROM images onto SD cards, for use with the OMAP3, OMAP4, and iMx6 ports
of RISC OS. If you attempt to create an SD card manually then there are many
places where things can go wrong, either due to user error or operating system
quirks. But if you use SDCreate to create the image for you then you can
(almost) guarantee that it will boot without any trouble.
......@@ -22,7 +22,7 @@ space. You will need at least version 1.28 of the FrontEnd module and version
in the HardDisc4 image available in the downloads section of the RISC OS Open
website. Users of 26bit machines can find the modules in the "System resources"
download.
http://www.riscosopen.org/content/downloads/other-zipfiles
http://www.riscosopen.org/content/downloads/common
If you want to use SDCreate to write the image to an SD card, then you'll need
to be using a RISC OS 5 machine with a USB card reader and the USB mass storage
......@@ -101,7 +101,7 @@ If you want to write an existing SD image to an SD card:
That's it! If it all went well, you should now have a working SD card/image for
use with your OMAP machine.
use with your chosen machine.
CMOS files
......@@ -111,8 +111,9 @@ RISC OS stores a number of non volatile settings in what is often referred to
as CMOS memory. Most notably, these are all the configuration settings such as
the keyboard repeat rate and the drive to boot from.
From RISC OS 5.18 onwards the OMAP3 HAL will try to find CMOS memory mounted on
a carrier board plugged into the otherwise unused 14 pin JTAG connector.
From RISC OS 5.18 onwards the OMAP3 and OMAP4 HALs will try to find CMOS
memory mounted on a carrier board plugged into the otherwise unused 14 pin
JTAG connector.
If that is not found to be present then an attempt will be made to find a valid
CMOS image loaded into volatile memory by the boot process, though any settings
will be forgotten when powered down - it is recommended to obtain a CMOS
......@@ -140,8 +141,8 @@ The behaviour of SDCreate with regards to CMOS files is as follows:
The format of CMOS file used is compatible with that used by the
*LoadCMOS/*SaveCMOS commands, or the load/save CMOS option available within
Configure. Note that you should obviously only use CMOS files that have been
saved by an OMAP3 machine; a file from a RiscPC, Iyonix, etc. isn't guaranteed
to work correctly.
saved by the corresponding machine; a file from a RiscPC, Iyonix, etc. isn't
likely to work correctly.
Additional usage notes
......@@ -195,7 +196,11 @@ The techie bit
SDCreate creates SD card images in the following manner:
* The file !SDCreate.blank is a blank, 32MB FAT16 disc image created under
Windows and then copied off of the SD card using 'dd' under Linux
Windows and then copied off of the SD card using 'dd' under Linux.
For the Wandboard !SDCreate.blankwand is used instead, because the on-chip
bootloader looks at a specific sector offset on the SD card rather than
searching the root directory. This means the blank 32MB FAT16 disc image
needs those sectors reserving, leaving around 24MB of empty space.
* This file was then squashed using !Squash to cut down the size of the program.
* So one of the first things SDCreate does is to unsquash the image. If the
image is being written straight out to the SD card then it will be unsquashed
......@@ -247,6 +252,11 @@ SDCreate creates SD card images in the following manner:
RISCOS <- Your RISC OS ROM image
CMOS <- Your CMOS settings
Wandboard
README/TXT <- An introductory welcome note
RISCOS <- Your RISC OS ROM image
CMOS <- Your CMOS settings
* The rules for which files get used on which machine type are in the FrontEnd
description file (!SDCreate.Desc). I wouldn't advise trying to decipher it,
though!
......@@ -297,6 +307,8 @@ only (easy) method to boot RISC OS.
History
-------
V1.26 - 2018/2/1
* Added Wandboard (iMx6) support
V1.25 - 2012/5/21
* Fixed bug that prevented the SCSI drive number from being saved properly by
the "Save options" iconbar option
......
......@@ -34,6 +34,7 @@ dbox_start
icn 11 maps_to "BOOT/INI <SDCreate$Dir>.scripts.igepv2/ini RISCOS";
icn 12 maps_to "UIMAGE";
icn 13 maps_to "BOOT/SCR <SDCreate$Dir>.scripts.pandora/scr RISCOS";
icn 22 maps_to "README/TXT <SDCreate$Dir>.scripts.wandboard/txt RISCOS";
icn 28 maps_to "BOOT/SCR <SDCreate$Dir>.scripts.pandaboard/scr RISCOS";
icn 0 maps_to "";
......@@ -46,7 +47,7 @@ dbox_start
icn 21 on maps_to "" produces_output;
icn 21 off maps_to "" produces_no_output;
icn 22 maps_to "";
icn 29 maps_to "";
icn 23 maps_to "";
icn 24 maps_to "image " string;
icn 25 maps_to "";
......@@ -72,9 +73,9 @@ dbox_end
rules_start
# Enable/disable top-level 'create image' icons
icn 21 off deselects icn 8, icn 9, icn 10, icn 11, icn 12, icn 13, icn 28;
icn 21 off excludes icn 8, icn 9, icn 10, icn 11, icn 12, icn 13, icn 28, icn 4, icn 22, icn 20;
icn 21 on includes icn 8, icn 9, icn 10, icn 11, icn 12, icn 13, icn 28, icn 4, icn 22, icn 20;
icn 21 off deselects icn 8, icn 9, icn 10, icn 11, icn 12, icn 13, icn 22, icn 28;
icn 21 off excludes icn 8, icn 9, icn 10, icn 11, icn 12, icn 13, icn 22, icn 28, icn 4, icn 29, icn 20;
icn 21 on includes icn 8, icn 9, icn 10, icn 11, icn 12, icn 13, icn 22, icn 28, icn 4, icn 29, icn 20;
# Enable/disable 'SD image' icons
icn 16 on includes icn 23, icn 24;
......@@ -83,13 +84,14 @@ rules_start
icn 21 off includes icn 23, icn 24;
# Machine type ESG
icn 8 deselects icn 9, icn 10, icn 11, icn 12, icn 13, icn 28;
icn 9 deselects icn 8, icn 10, icn 11, icn 12, icn 13, icn 28;
icn 10 deselects icn 8, icn 9, icn 11, icn 12, icn 13, icn 28;
icn 11 deselects icn 8, icn 9, icn 10, icn 12, icn 13, icn 28;
icn 12 deselects icn 8, icn 9, icn 10, icn 11, icn 13, icn 28;
icn 13 deselects icn 8, icn 9, icn 10, icn 11, icn 12, icn 28;
icn 28 deselects icn 8, icn 9, icn 10, icn 11, icn 12, icn 13;
icn 8 deselects icn 9, icn 10, icn 11, icn 12, icn 13, icn 22, icn 28;
icn 9 deselects icn 8, icn 10, icn 11, icn 12, icn 13, icn 22, icn 28;
icn 10 deselects icn 8, icn 9, icn 11, icn 12, icn 13, icn 22, icn 28;
icn 11 deselects icn 8, icn 9, icn 10, icn 12, icn 13, icn 22, icn 28;
icn 12 deselects icn 8, icn 9, icn 10, icn 11, icn 13, icn 22, icn 28;
icn 13 deselects icn 8, icn 9, icn 10, icn 11, icn 12, icn 22, icn 28;
icn 22 deselects icn 8, icn 9, icn 10, icn 11, icn 12, icn 13, icn 28;
icn 28 deselects icn 8, icn 9, icn 10, icn 11, icn 12, icn 13, icn 22;
# Machine type -> ROM/x-loader/U-Boot mapping (disable stuff)
icn 9 off excludes icn 5, icn 6, icn 14, icn 15;
......@@ -98,10 +100,12 @@ rules_start
icn 10 on excludes icn 5, icn 6, icn 14, icn 15;
icn 11 on excludes icn 5, icn 6, icn 14, icn 15;
icn 13 on excludes icn 5, icn 6, icn 14, icn 15;
icn 22 on excludes icn 5, icn 6, icn 14, icn 15;
icn 8 off excludes icn 5, icn 6, icn 14, icn 15;
icn 10 off excludes icn 5, icn 6, icn 14, icn 15;
icn 11 off excludes icn 5, icn 6, icn 14, icn 15;
icn 13 off excludes icn 5, icn 6, icn 14, icn 15;
icn 22 off excludes icn 5, icn 6, icn 14, icn 15;
icn 28 off excludes icn 5, icn 6, icn 14, icn 15;
icn 28 on excludes icn 5, icn 6, icn 14, icn 15;
......@@ -128,6 +132,7 @@ rules_start
icn 11 off excludes icn 0, icn 0;
icn 12 off excludes icn 0, icn 0;
icn 13 off excludes icn 0, icn 0;
icn 22 off excludes icn 0, icn 0;
icn 28 off excludes icn 0, icn 0;
icn 8 on includes icn 0, icn 0;
icn 9 on includes icn 0, icn 0;
......@@ -135,6 +140,7 @@ rules_start
icn 11 on includes icn 0, icn 0;
icn 12 on includes icn 0, icn 0;
icn 13 on includes icn 0, icn 0;
icn 22 on includes icn 0, icn 0;
icn 28 on includes icn 0, icn 0;
rules_end
......@@ -143,4 +149,4 @@ rules_end
# [CMOS <name>] (disc <id> | file <name>) [MLO <name>] [U-BOOT/BIN <name>] ([BOOT/SCR|BOOT/INI] <name> RISCOS <name> | UIMAGE <name>)
# [CMOS <name>] disc <id> image <name>
order_is
icn 27, icn 16, icn 24, output, icn 5, icn 6, icn 8, icn 9, icn 10, icn 11, icn 12, icn 13, icn 28, icn 4;
icn 27, icn 16, icn 24, output, icn 5, icn 6, icn 8, icn 9, icn 10, icn 11, icn 12, icn 13, icn 22, icn 28, icn 4;
......@@ -93,5 +93,7 @@ SETUPd:Select this option to create an SD card image for the Pandora.
SETUPg:Select this option to write an image to an SD card.
SETUPh:Enter the target SCSI drive number here.
SETUPl:Select this option to create an image.
SETUPm:Select this option to create an SD card image for the Wandboard
SETUPo:Enter the name of the SD image to load, or drag it to this icon.
SETUPr:Enter the name of the (optional) CMOS settings file, or drag it to this icon.
SETUPs:Select this option to create an SD card image for the PandaBoard
Wandboard
=========
Welcome to RISC OS for the iMx6 (Wandboard).
IMPORTANT
=========
Note that the bootloader built into the ARM processor on the Wandboard looks
for the operating system at a fixed sector address on the SDFS::1 drive.
To keep it fixed at that one place it is stored in hidden sectors that can't
be seen in the Filer, which means to update the ROM you must re-run SDCreate.
The rest of the space is formatted as FAT16 and can be used for any purpose,
for example keeping a backup !Boot application. Beware! Re-running SDCreate
will overwrite the contents of SDFS::1 each time.
This text file can be deleted - it is not required for booting.
-- RISC OS Open
/* (1.25)
/* (1.26)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.25
#define Module_MajorVersion_CMHG 1.26
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 21 May 2012
#define Module_Date_CMHG 06 Feb 2018
#define Module_MajorVersion "1.25"
#define Module_Version 125
#define Module_MajorVersion "1.26"
#define Module_Version 126
#define Module_MinorVersion ""
#define Module_Date "21 May 2012"
#define Module_Date "06 Feb 2018"
#define Module_ApplicationDate "21-May-12"
#define Module_ApplicationDate "06-Feb-18"
#define Module_ComponentName "SDCreate"
#define Module_ComponentPath "bsd/RiscOS/Sources/Utilities/SDCreate"
#define Module_FullVersion "1.25"
#define Module_HelpVersion "1.25 (21 May 2012)"
#define Module_LibraryVersionInfo "1:25"
#define Module_FullVersion "1.26"
#define Module_HelpVersion "1.26 (06 Feb 2018)"
#define Module_LibraryVersionInfo "1:26"
......@@ -55,14 +55,18 @@ ELSE
sdimage$=FNgetarg
IF sdimage$="" THEN PRINT "No output filename given"
ENDIF
wand%=FALSE : REM Assume no special Wandboard handling
REM Validate the other command line args
pos%=clpos%
outfile$=FNgetarg
IF outfile$="image" THEN
infile$=FNgetarg
REM Try to deduce if Wandboard special processing required
wand%=FNCheckWand(infile$,&400)
REM Write a prepared image to SD
PROCwrite(FNgetarg)
PROCwrite(infile$)
REM Write CMOS file if necessary
IF loadedcmos%=TRUE THEN PROCwriteCMOS : PROCdismount
PRINT "Done"
......@@ -77,7 +81,11 @@ ENDWHILE
REM Now do it for real
clpos%=pos%
PROCdecompress("<SDCreate$Dir>.blank")
IF wand% THEN
PROCdecompress("<SDCreate$Dir>.blankwand")
ELSE
PROCdecompress("<SDCreate$Dir>.blank")
ENDIF
REM Process other command line args
outfile$=FNgetarg
WHILE outfile$<>""
......@@ -95,8 +103,13 @@ WHILE outfile$<>""
IF F%<>0 THEN E%=EXT#F% : CLOSE#F% ELSE E%=0
IF F%=0 OR E%<>L%+64 THEN PRINT "Failed to create uimage" : END
ELSE
PRINT "Copying "+outfile$
OSCLI("copy "+infile$+" "+sdimage$+"."+outfile$+" A~C~DF~N~V")
IF wand% AND outfile$="RISCOS" THEN
REM RISC OS ROM only, hidden in a special sector
PROCwriteWandROM(sdimage$,infile$,&400)
ELSE
PRINT "Copying "+outfile$
OSCLI("copy "+infile$+" "+sdimage$+"."+outfile$+" A~C~DF~N~V")
ENDIF
ENDIF
outfile$=FNgetarg
ENDWHILE
......@@ -166,10 +179,13 @@ DEF PROCCheckFile(outfile$,infile$)
IF F%=0 THEN PRINT "File '"+infile$+"' not found" : END
L%=EXT#F%
CLOSE#F%
REM Try to deduce if Wandboard special processing required
IF outfile$="RISCOS" THEN wand%=FNCheckWand(infile$,0)
REM Simplistic error checks
CASE outfile$ OF
WHEN "RISCOS","UIMAGE" : IF L%<1024*1024 OR (L% AND 3)<>0 THEN PRINT "File '"+infile$+"' doesn't look like a valid ROM image to me" : END
WHEN "BOOT/SCR","BOOT/INI","RESET/SCR","UENV/TXT" : IF L%>1024 THEN PRINT "File '"+infile$+"' doesn't look like a boot script to me" : END
WHEN "README/TXT" : IF L%>32768 THEN PRINT "File '"+infile$+"' doesn't look like a brief introduction to me" : END
WHEN "MLO" : IF L%>64*1024 OR L%<8*1024 THEN PRINT "File '"+infile$+"' doesn't look like a copy of x-loader to me" : END
WHEN "U-BOOT/BIN" : IF L%>512*1024 OR L%<64*1024 THEN PRINT "File '"+infile$+"' doesn't look like a copy of u-boot to me" : END
OTHERWISE PRINT "Don't know how to handle output file '"+outfile$+"'" : END
......@@ -205,8 +221,9 @@ DEF PROCloadCMOS(infile$)
IF F%=0 THEN PRINT "File '"+infile$+"' not found" : END
L%=EXT#F%
REM Accept all sizes saved by *SaveCMOS
IF L%<>240 AND L%<>244 AND L%<>2052 THEN PRINT "File '"+infile$+"' doesn't look like a valid CMOS file to me" : END
IF L%<>240 AND L%<>244 AND L%<>260 AND L%<>2052 THEN PRINT "File '"+infile$+"' doesn't look like a valid CMOS file to me" : END
IF L%=244 THEN L%=240
IF L%=260 THEN L%=256
PRINT "Loading CMOS image"
pos%=0
WHILE pos%<L%
......@@ -218,7 +235,51 @@ ENDPROC
DEF PROCwriteCMOS
PRINT "Writing CMOS image"
SYS "OS_File",10,sdimage$+".CMOS",&ff2,,cmos%,cmos%+2052
IF wand% THEN
REM First 256 bytes only, hidden in a special sector, and in physical byte order
LOCAL unwritten%,I%,O%
DIM phycmos% LOCAL 256
FOR I%=0 TO 255
CASE I%>>4 OF
WHEN&F : O%=&00+(I% AND&F)
WHEN&C,&D,&E : O%=&10+I%-&C0
OTHERWISE : O%=&40+I%
ENDCASE
phycmos%?O%=cmos%?I%
NEXT
IF disc% THEN
SYS "SCSIFS_DiscOp",,2,&1200 OR (discno%<<29),phycmos%,256 TO ,,,,unwritten%
ELSE
F%=OPENUP(sdimage$)
SYS "OS_GBPB",1,F%,phycmos%,256,&1200 TO,,,unwritten%
CLOSE#F%
ENDIF
IF unwritten%>0 THEN PRINT '"Failed to write correct data length"
ELSE
SYS "OS_File",10,sdimage$+".CMOS",&ff2,,cmos%,cmos%+2052
ENDIF
ENDPROC
DEF PROCwriteWandROM(sdimage$,infile$,offset%)
LOCAL raw%,rom%,size%,read%,unread%,unwritten%
DIM buf% LOCAL 128*1024
raw%=OPENUP(sdimage$)
rom%=OPENIN(infile$)
size%=EXT#rom%
PTR#raw%=offset%
PRINT "Overlaying ROM image...";
REPEAT
IF size%>128*1024 THEN read%=128*1024 ELSE read%=size%
SYS "OS_GBPB",4,rom%,buf%,read% TO ,,,unread%
IF unread%>0 THEN PRINT '"Failed to read from ROM file!" : CLOSE#raw% : CLOSE#rom% : END
SYS "OS_GBPB",2,raw%,buf%,read% TO ,,,unwritten%
IF unwritten%>0 THEN PRINT '"Failed to overlay data in the image" : CLOSE#raw% : CLOSE#rom% : END
PRINT ".";
size%-=read%
UNTIL size%=0
CLOSE#raw%
CLOSE#rom%
PRINT
ENDPROC
DEF PROCdismount
......@@ -234,6 +295,22 @@ DEF PROCdismount
OSCLI(A$)
ENDPROC
DEF FNCheckWand(infile$,offset%)
LOCAL F%,unread%,wand%,flags%
DIM buf% LOCAL 32
F%=OPENIN(infile$)
IF F%<>0 THEN
SYS "XOS_GBPB",3,F%,buf%,32,offset% TO,,,unread%;flags%
IF (flags% AND 1) = 0 AND unread% = 0 THEN
REM Inspect the IVT section header
IF buf%!0=&402000D1 AND buf%!4=&17801000 AND buf%!8=0 AND buf%!24=0 AND buf%!28=0 THEN
wand%=TRUE
ENDIF
ENDIF
CLOSE#F%
ENDIF
=wand%
DEF PROCCheckDisc
LOCAL buf1%,buf2%,flags%,pos%,bad%,fs%,default%,result%
bad%=FALSE
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment