1.Download the recovery image form the link below. Use this image in case of  recovering from a disaster. Recovery Image: signed-dream_devphone_userdebug-ota-14721.zip from http://developer.htc.com/adp.html

2. Copy signed-dream_devphone_userdebug-ota-14721.zip to /source/ directory.

3. Go to ‘vendor/htc/dream’  and run ‘./extract-files.sh’, or  ./unzip-files.sh

4. Then, Then apply the following commands

5. source build/envsetup.sh

6. $ lunch aosp_dream_us-eng

7. Compile the modified Android Source Code for the device

8. $ make -j

9. Now the generated files are

10. boot.img,

11. recovery.img,

12. system.img,

13. userdata.img

14.  These files will be located at

15. out/target/product/dream-open/

16.  Put device into FASTBOOT mode

17. reboot

18. power_on the device with BACK key pressed,

19.  It should show the driods on skateboard with fastboot text displayed.

20.  Make sure the cable with the device is connected.

21.  Now apply the following commands

22. sudo su

23. set path to fastboot

24. export PATH=/mydroid/out/host/linux-x86/bin/:$PATH

25.  Stop and start the server

26. adb kill-server

27. adb start-server

28.  Check the fastboot devices

29. #fastboot devices

30.  The above command will show you the fastboot devices.

31. HT94JLZ00002    fastboot

32.  Now apply the following command.

33. #fastboot -p dream-open -w flashall

34.  flashall will apply all the above listed img files one by one. but we can also do that manually by specifying the image file name. After this the flashing will start and our device will be loaded with our own modified source code.