palvarez89

Untitled

Jun 30th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.22 KB | None | 0 0
  1. [[!meta title="How To: Porting to a new architecture"]]
  2.  
  3. Cross-bootstrap
  4. ===============
  5.  
  6. These are the steps to porting and cross-bootstrap baserock from one
  7. architecture to another.
  8.  
  9.  
  10. 1. Modify morph and build-essential
  11. -----------------------------------
  12.  
  13. This is **only neccessary** if you are trying to cross-bootstrap to a new
  14. architecture.
  15.  
  16. Mainly you have to include the new architecture in morph as a valid
  17. architecture (FIXME: explain how to, and where)
  18.  
  19. Also you have to modify linux (git://git.baserock.org/delta/linux.git).
  20. There is a file in the `baserock/build-essential` branch called
  21. `morph-arch`. You have to include changes for the new architecture.
  22.  
  23.  
  24.  
  25. 2. Generate a bootstrap baserock tarball
  26. ----------------------------------------
  27.  
  28. Create a `cross-bootstrap-system-TARGET_ARCH-generic.morph` file (where
  29. TARGET_ARCH is the target architecture) and edit it so that it contains
  30. the following:
  31.  
  32. arch: TARGET_ARCH
  33. description: A system that produces the minimum needed to build a devel system
  34. kind: system
  35. name: cross-bootstrap-system-TARGET_ARCH-generic
  36. strata:
  37. - morph: build-essential
  38. ref: master
  39. repo: baserock:baserock/morphs
  40. - morph: core
  41. ref: master
  42. repo: baserock:baserock/morphs
  43. - morph: cross-bootstrap
  44. ref: master
  45. repo: baserock:baserock/morphs
  46.  
  47. You must **replace** TARGET_ARCH for the target architecture in the morphology.
  48. The morphology has o be commited and pushed in a git repository. For this
  49. example we assume the morphology is in `baserock:baserock/morphs` and
  50. in the `master` branch.
  51.  
  52. Execute `morph cross-bootstrap` for the morphology file created:
  53.  
  54. morph cross-bootstrap TARGET_ARCH baserock:baserock/morphs master cross-bootstrap-system-TARGET_ARCH-generic
  55.  
  56. Fix any problems if it fails, and execute `morph cross-bootstrap` again.
  57.  
  58.  
  59. 3. Native building of the cross-bootstrap process
  60. -------------------------------------------------
  61.  
  62. Once you have the tarball you have two options:
  63.  
  64. 1. If you have running linux in the target architecture you can copy
  65. the tarball there and then chroot into it with `chroot rootfs
  66. /bin/sh`
  67. 1. Nfs boot to the tarball's filesystem.
  68.  
  69. Once you are into the filesystem created, you have to execute the
  70. `native-bootstrap` script. This script ends building everything. Fix any
  71. problem executing this script and regenerate the tarball. (You also can
  72. try to fix the problems without regenerating the tarbal to save time,
  73. but is not recommendable).
  74.  
  75.  
  76. 4. Prepare the bootstrap system
  77. -------------------------------
  78.  
  79. When the `native-crossbootstrap` ends, you have to merge all the build
  80. results into one directory
  81.  
  82. cp *.inst/* NEW_DIR/
  83.  
  84. Now you have in the NEW_DIR all the bootstrap filesystem.
  85.  
  86.  
  87. 5. Using the bootstrap system
  88. -----------------------------
  89.  
  90. To avoid problems using `morph build` running chroot the bootstrap
  91. system you have two possible solutions ($path is the path to the
  92. bootstrap filesysyem
  93.  
  94. 1. `cd $path && mount --bind . . `
  95. 1. move the filesystem to another disk.
  96.  
  97. After that you have to go to che $path folder and run:
  98.  
  99. mount -t proc proc proc/
  100. mount -t sysfs sys sys/
  101. mount -o bind /dev dev/
  102.  
  103. This is important because morph won't work without it. After that
  104. you are ready to chroot into it:
  105.  
  106. chroot . /bin/sh
  107. PATH=/bin:/usr/bin:/sbin:/usr/sbin
  108. LD_LIBRARY_PATH=/lib:/lib64
  109. ldconfig
  110.  
  111. Sometimes you have to run the following to be able to ping URL's
  112.  
  113. echo "nameserver 8.8.8.8" > /etc/resolv.conf
  114.  
  115.  
  116.  
  117. <pedroalvarez> mtix: oh, just tell me what needs more explanation
  118. <pedroalvarez> I'll improve it
  119. <mtix> everything!
  120. <mtix> i may be a lost cause
  121. <pedroalvarez> maybe is because the tutorial doesn't explain what it does
  122. <pedroalvarez> juist how to do it
  123. <mtix> def need tutoring on what each step means
  124. <pedroalvarez> 1: is only modify the morph tool in baserock to allow morph to work in the new architecture
  125. <pedroalvarez> 2: is Cross-build baserock. We cross-build a tiny devel system called cross-bootstrap-system
  126. <pedroalvarez> 3: is the second part of the cross-build. It has to be done in the target architecture
  127. <pedroalvarez> In the 2nd and 3rd step is usual to have problems due you are building to a new architecture. The main work in this steps is to fix this problems.
  128. <pedroalvarez> 4: this step is only the final step of the cross-build of baserock. Put the things together
  129. <pedroalvarez> 5: is an explanation of how to use the cross-built system
  130. <pedroalvarez> After this tutorial you have a cross built baserock, and you can use it to build the system you want
  131. <pedroalvarez> Building a devel system, for example, will include more things than the tiny system we have cross-built, so more problems will happen building from here
  132. <pedroalvarez> Problems in some chunks in baserock, which need some changes to work in the new architecture
  133. <mtix> i see morph has a command called cross-bootstrap
  134. <mtix> what does that command do?
  135. <pedroalvarez> it creates a tarball of a system with a few things cross-compiled
  136. <pedroalvarez> is the tarball you have to use in the step 3
  137. <pedroalvarez> with this system you finish building the tiny baserock (bootstrap baserock) natively
Advertisement
Add Comment
Please, Sign In to add comment