wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 1 | Hymod Board Database |
| 2 | |
| 3 | (C) Copyright 2001 |
Wolfgang Denk | b3b0fd5 | 2005-08-12 23:20:59 +0200 | [diff] [blame] | 4 | Murray Jensen <Murray.Jensen@csiro.au> |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 5 | CSIRO Manufacturing Science and Technology, Preston Lab |
| 6 | |
| 7 | 25-Jun-01 |
| 8 | |
| 9 | This stuff is a set of PHP/MySQL scripts to implement a custom board |
| 10 | database. It will need *extensive* hacking to modify it to keep the |
| 11 | information about your custom boards that you want, however it is a good |
| 12 | starting point. |
| 13 | |
| 14 | How it is used: |
| 15 | |
| 16 | 1. a board has gone through all the hardware testing etc and is |
| 17 | ready to have the flash programmed for the first time - first you |
| 18 | go to a web page and fill in information about the board in a form |
| 19 | to register it in a database |
| 20 | |
| 21 | 2. the web stuff allocates a (unique) serial number and (optionally) |
| 22 | a (locally administered) ethernet address and stores the information |
| 23 | in a database using the serial number as the key (can do whole |
| 24 | batches of boards in one go and/or use a previously registered board |
| 25 | as defaults for the new board(s)) |
| 26 | |
| 27 | 3. it then creates a file in the tftp area of a server somewhere |
| 28 | containing the board information in a simple text format (one |
| 29 | per serial number) |
| 30 | |
| 31 | 4. all hymod boards have an i2c eeprom, and when U-Boot sees that |
| 32 | the eeprom is unitialised, it prompts for a serial number and |
| 33 | ethernet address (if not set), then transfers the file created |
| 34 | in step 3 from the server and initialises the eeprom from its |
| 35 | contents |
| 36 | |
| 37 | What this means is you can't boot the board until you have allocated a serial |
| 38 | number, but you don't have to type it all twice - you do it once on the web |
| 39 | and the board then finds the info it needs to initialise its eeprom. The |
| 40 | other side of the coin is the reading of the eeprom and how it gets passed |
| 41 | to Linux (or another O/S). |
| 42 | |
| 43 | To see how this is all done for the hymod boards look at the code in the |
| 44 | "board/hymod" directory and in the file "include/asm/hymod.h". Hymod boards |
| 45 | can have a mezzanine card which also have an eeprom that needs allocating, |
| 46 | the same process is used for these as well - just a different i2c address. |
| 47 | |
| 48 | Other forms provide the following functions: |
| 49 | |
| 50 | - browsing the board database |
| 51 | - editing board information (one at a time) |
| 52 | - maintaining/browsing a (simple) per board event log |
| 53 | |
| 54 | You will need: MySQL (I use version 3.23.7-alpha), PHP4 (with MySQL |
| 55 | support enabled) and a web server (I use Apache 1.3.x). |
| 56 | |
| 57 | I originally started by using phpMyBuilder (http://kyber.dk/phpMyBuilder) |
| 58 | but it soon got far more complicated than that could handle (but I left |
| 59 | the copyright messages in there anyway). Most of the code resides in the |
| 60 | common defs.php file, which shouldn't need much alteration - all the work |
| 61 | will be in shaping the front-end php files to your liking. |
| 62 | |
| 63 | Here's a quick summary of what needs doing to use it for your boards: |
| 64 | |
| 65 | 1. get phpMyAdmin (http://phpwizard.net/projects/phpMyAdmin/) - it's an |
| 66 | invaluable tool for this sort of stuff (this step is optional of course) |
| 67 | |
| 68 | 2. edit "bddb.css" to your taste, if you could be bothered - I have no |
| 69 | idea what is in there or what it does - I copied it from somewhere else |
| 70 | ("user.css" from the phpMyEdit (http://phpmyedit.sourcerforge.net) package, |
| 71 | I think) - I figure one day I'll see what sort of things I can change |
| 72 | in there. |
| 73 | |
| 74 | 3. create a mysql database - call it whatever you like |
| 75 | |
| 76 | 4. edit "create_tables.sql" and modify the "boards" table schema to |
| 77 | reflect the information you want to keep about your boards. It may or |
| 78 | may not be easier to do this and the next step in phpMyAdmin. Check out |
| 79 | the MySQL documentation at http://www.mysql.com/doc/ in particular the |
| 80 | column types at http://www.mysql.com/doc/C/o/Column_types.html - Note |
| 81 | there is only support for a few data types: |
| 82 | |
| 83 | int - presented as an html text input |
| 84 | char/text - presented as an html text input |
| 85 | date - presented as an html text input |
| 86 | enum - presented as an html radio input |
| 87 | |
| 88 | I also have what I call "enum_multi" which is a set of enums with the |
| 89 | same name, but suffixed with a number e.g. fred0, fred1, fred2. These |
| 90 | are presented as a number of html select's with a single label "fred" |
| 91 | this is useful for board characteristics that have multiple items of |
| 92 | the same type e.g. multiple banks of sdram. |
| 93 | |
| 94 | 5. use the "create_tables.sql" file to create the "boards" table in the |
| 95 | database e.g. mysql dbname < create_tables.sql |
| 96 | |
| 97 | 6. create a user and password for the web server to log into the MySQL |
| 98 | database with; give this user select, insert and update privileges |
| 99 | to the database created in 3 (and delete, if you want the "delete" |
| 100 | functions in the edit forms to work- I have this turned off). phpMyAdmin |
| 101 | helps in this step. |
| 102 | |
| 103 | 7. edit "config.php" and set the variables: $mysql_user, $mysql_pw, $mysql_db, |
| 104 | $bddb_cfgdir and $bddb_label - keep the contents of this file secret - it |
| 105 | contains the web servers username and password (the three $mysql_* vars |
| 106 | are set from the previous step) |
| 107 | |
| 108 | 8. edit "defs.php" and a. adjust the various enum value arrays and b. edit |
| 109 | the function "pg_foot()" to remove my email address :-) |
| 110 | |
| 111 | 9. do major hacking on the following files: browse.php, doedit.php, donew.php, |
| 112 | edit.php and new.php to reflect your database schema - fortunately the |
| 113 | hacking is fairly straight-forward, but it is boring and time-consuming. |
| 114 | |
| 115 | These notes were written rather hastily - if you find any obvious problems |
| 116 | please let me know. |