README 5.2 KB

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