1
0

rpi2-build.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/sh
  2. # stop on errors
  3. set -e
  4. # rebuild uspi USB lib
  5. WD=$(pwd)
  6. cd devices/rpi2/uspi/lib
  7. make
  8. cd $WD
  9. NEWLIB="/usr/lib/arm-none-eabi/newlib"
  10. GCC_OPTS=" -g -O2 -nostartfiles -nostdlib -mhard-float -ffreestanding -mno-unaligned-access -fno-toplevel-reorder -mcpu=cortex-a7 -mfpu=neon-vfpv4 -std=gnu11 -L$NEWLIB/fpu -I./sledge -I. -I/usr/include/newlib -Idevices/rpi2 -Idevices/rpi2/uspi/env/include/ -DCPU_ARM "
  11. COMPILE="arm-none-eabi-gcc $GCC_OPTS"
  12. mkdir -p obj
  13. $COMPILE -c -o obj/alloc.o sledge/alloc.c
  14. $COMPILE -c -o obj/reader.o sledge/reader.c
  15. $COMPILE -c -o obj/strmap.o sledge/strmap.c
  16. $COMPILE -c -o obj/writer.o sledge/writer.c
  17. $COMPILE -c -o obj/stream.o sledge/stream.c
  18. $COMPILE -c -o obj/raspi.o devices/rpi2/raspi.c
  19. $COMPILE -c -o obj/r3d.o devices/rpi2/r3d.c
  20. $COMPILE -c -o obj/debug_util.o devices/debug_util.c
  21. $COMPILE -c -o obj/uspi_glue.o devices/rpi2/uspi_glue.c
  22. $COMPILE -c -o obj/timer2.o devices/rpi2/rpi-boot/timer.c
  23. $COMPILE -c -o obj/block.o devices/rpi2/rpi-boot/block.c
  24. $COMPILE -c -o obj/mbr.o devices/rpi2/rpi-boot/mbr.c
  25. $COMPILE -c -o obj/emmc.o devices/rpi2/rpi-boot/emmc.c
  26. $COMPILE -c -o obj/mbox.o devices/rpi2/rpi-boot/mbox.c
  27. $COMPILE -c -o obj/block_cache.o devices/rpi2/rpi-boot/block_cache.c
  28. $COMPILE -c -o obj/ccsbcs.o devices/rpi2/fat/ccsbcs.c
  29. $COMPILE -c -o obj/ff.o devices/rpi2/fat/ff.c
  30. $COMPILE -c -o obj/diskio.o devices/rpi2/fat/diskio.c
  31. $COMPILE -c -o obj/timer.o devices/rpi2/uspi/env/lib/timer.c
  32. $COMPILE -c -o obj/interrupt.o devices/rpi2/uspi/env/lib/interrupt.c
  33. $COMPILE -c -o obj/memio.o devices/rpi2/uspi/env/lib/memio.c
  34. $COMPILE -c -o obj/assert.o devices/rpi2/uspi/env/lib/assert.c
  35. $COMPILE -c -o obj/bcmpropertytags.o devices/rpi2/uspi/env/lib/bcmpropertytags.c
  36. $COMPILE -c -o obj/bcmmailbox.o devices/rpi2/uspi/env/lib/bcmmailbox.c
  37. $COMPILE -c -o obj/exceptionstub.o devices/rpi2/uspi/env/lib/exceptionstub.S
  38. $COMPILE -c -o obj/exceptionhandler.o devices/rpi2/uspi/env/lib/exceptionhandler.c
  39. $COMPILE -o build/interim-arm.elf -T devices/rpi2/arm.ld devices/rpi2/arm_start.S devices/rpi2/main_rpi2.c\
  40. obj/raspi.o obj/r3d.o\
  41. obj/reader.o obj/strmap.o obj/alloc.o obj/writer.o obj/stream.o\
  42. obj/debug_util.o\
  43. devices/rpi2/uspi/lib/libuspi.a\
  44. \
  45. obj/timer2.o\
  46. obj/block.o\
  47. obj/emmc.o\
  48. obj/mbox.o\
  49. obj/ff.o\
  50. obj/diskio.o\
  51. obj/block_cache.o\
  52. obj/ccsbcs.o\
  53. \
  54. obj/timer.o\
  55. obj/interrupt.o\
  56. obj/memio.o\
  57. obj/assert.o\
  58. obj/bcmpropertytags.o\
  59. obj/bcmmailbox.o\
  60. obj/exceptionstub.o\
  61. obj/exceptionhandler.o\
  62. \
  63. obj/uspi_glue.o\
  64. -lc -lgcc -lm
  65. # extract binary image from ELF executable
  66. arm-none-eabi-objcopy build/interim-arm.elf -O binary build/kernel7.img