KernelDriverProgrammingCourse2015/OutlineDay1: Difference between revisions
Jump to navigation
Jump to search
Line 26: | Line 26: | ||
### Start screen on the ttyUSB# in question, e.g.:<br/> screen /dev/ttyUSB0 115200 | ### Start screen on the ttyUSB# in question, e.g.:<br/> screen /dev/ttyUSB0 115200 | ||
### Power up the board, and check that it boots properly in the screen session | ### Power up the board, and check that it boots properly in the screen session | ||
## Build your own dts file:<br/> cd linux<br/> | ## Build and install your own dts file: | ||
### Edit the dts file for your board:<br/> cd linux<br/> $editor arch/arm/boot/dts/sun?i-a??-$board.dts | |||
### At the top of the file you will see e.g. "model = "PineRiver Mini X-Plus"; This is a free format string, change the model string to something else, e.g. "Hans' test board" and then save the file | |||
### Now build a dtb file from the dts file:<br/> make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnu- dtbs | |||
### Then install the dtb file, insert the sdcard into your laptop, mount the first partition of it, and copy arch/arm/boot/dts/sun?i-a*-*.dtb to the dtb directory, e.g.: <br/> sudo cp -pr arch/arm/boot/dts/sun?i-*.dtb /run/media/hans/__boot/dtb/ | |||
### Boot the board again, login and do:<br/> cat /sys/firmware/devicetree/base/model<br/> to verify that your modified dtb file is being used | |||
# Adding support for the musb otg controller to a sunxi dts file | # Adding support for the musb otg controller to a sunxi dts file | ||
## See [https://git.kernel.org/cgit/linux/kernel/git/mripard/linux.git/commit/?h=sunxi/for-next&id=d7a99f6bb625e7d0a256bc6e3d4538669ea22f27 the commit] enabling it on the A20 OLinuxino Lime as an example of the necessary changes | ## See [https://git.kernel.org/cgit/linux/kernel/git/mripard/linux.git/commit/?h=sunxi/for-next&id=d7a99f6bb625e7d0a256bc6e3d4538669ea22f27 the commit] enabling it on the A20 OLinuxino Lime as an example of the necessary changes |
Revision as of 15:27, 25 July 2015
Kernel Driver Programming Course Day 1
- Intro
- Welcome
- I'm going to dump a lot of information on you, don't worry you do not need to remember it all :)
- Quickly explain of different Axx models
- A10 Datasheet Block diagram (page 12), give a quick overview of the A10
- A10 SoC dtsi file (example)
- sun4i-a10.dtsi
- For a list of addresses see the A10 user manual, section 3.2 "Memory mapping", and 11.2 "Interrupt Source"
- For clock tree info see: A10 Datasheet Clock tree diagram (pages 51 - 54)
- dts file example for a simple board
- Hands on 1: Build and install u-boot and a dts file and boot the board
- Everyone gets a board, a usb to serial convertor and a sdcard
- Build and install u-boot:
- Figure out the config to use for your board, do:
cd u-boot
grep -l SUNXI configs/*_defconfig - Build u-boot for your board, do:
make -j4 CROSS_COMPILE=arm-linux-gnu- $foo_defconfig
make -j4 CROSS_COMPILE=arm-linux-gnu- - Insert the provided sdcard into your laptop
- Figure out which blockdev it has been given, do:
dmesg | tail - Install u-boot by dd-ing it to the whole device (not a partition) blockdev, e.g.:
sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdc bs=1024 seek=8
- Figure out the config to use for your board, do:
- Boot the board:
- Plug a usb to serial convertor into your laptop
- Figure out which ttyUSB# it has been given, do:
dmesg | tail - Start screen on the ttyUSB# in question, e.g.:
screen /dev/ttyUSB0 115200 - Power up the board, and check that it boots properly in the screen session
- Build and install your own dts file:
- Edit the dts file for your board:
cd linux
$editor arch/arm/boot/dts/sun?i-a??-$board.dts - At the top of the file you will see e.g. "model = "PineRiver Mini X-Plus"; This is a free format string, change the model string to something else, e.g. "Hans' test board" and then save the file
- Now build a dtb file from the dts file:
make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnu- dtbs - Then install the dtb file, insert the sdcard into your laptop, mount the first partition of it, and copy arch/arm/boot/dts/sun?i-a*-*.dtb to the dtb directory, e.g.:
sudo cp -pr arch/arm/boot/dts/sun?i-*.dtb /run/media/hans/__boot/dtb/ - Boot the board again, login and do:
cat /sys/firmware/devicetree/base/model
to verify that your modified dtb file is being used
- Edit the dts file for your board:
- Adding support for the musb otg controller to a sunxi dts file
- See the commit enabling it on the A20 OLinuxino Lime as an example of the necessary changes
- See the A20 OLinuxino Lime schematic as an example how to figure out which gpios to use for vbus_det / id_det. Or alternatively look at the usbc0 section of the fex file for the board.
- Some boards are special and use the pmic instead of a gpio for vbus-det, see e.g. the bananapi fex file. For an example of how to deal with this in the dts file see the commit enabling the otg controller on the bananapi.
- Quick demo of how to test otg on a sunxi board
- Hands on 2: Enable the otg controller on the board you've
- Modify the dts file for your board in the same way as done in the provided examples
- Build and install the dts file as before
- Test the otg controller as demoed