So, hello and welcome to my talk about stream processing at the Edge with Apache Kafka My name is Jakub Schultz and I work at Red Hat as engineer and I'm also maintainer of the Project called Strimsy, which is cloud native computing foundation project, which is about running Apache Kafka on on Kubernetes and Yeah, obviously that will be one of the things which I will use later in the demo How many of you know what stream processing is? Right, that's quite a lot of hands For those who don't know you can try to imagine it as that the world around us is full of different streams of events and streams of data For example in the room like it is when someone opens a door It's basically an event someone open the door and someone close them Someone close the doors when someone enters the room or leaves the room that can be another event And you can take these events and kind of Process them as a stream So for example if you take the events that someone entered the room Like now or left the room then if you process the whole stream then you can basically count Okay, one person entered second person entered third person entered then one person left then three person entered So we have in total five people in the room and that's an information you can build from the stream of events and Then you can use this information for some more things So I'm quite sure there is some fire code here which says that there is some maximum number of people in this room So you can for example use this information for some alert thing which would say okay If there's more than 50 people in this room Then let's send some alert message to some fire marshal and he will come and say oh you too You are over the number go out And then of course you can also do things like Install some sensors which would for example monitor the temperature air quality or the noise level And then you can kind of combine this information So how does the noise level depend on the number of people in the room? How does the air quality depend on the number of people in the room? and you can do things such as Improved air conditioning or the audio system depending on the number of the people to for example better Conserve the energy and so on so that's kind of how you can imagine stream processing And now Why does this make sense to do it at the edge? There's a lot of different industries where kind of this pattern fits in it's connected to how the world is changing how we are digitalizing everything and How for example, we are changing the ways how we produce things such as energy So you can imagine in agriculture you can for example use some sensors to monitor the fields Whether they have enough water or enough sun whether there are some animals eating the crops and so on in Pharmaceutical industry or chemical industry you can use it to monitor some processes You can use it to monitor the environment because for example A lot of pharmaceuticals or I don't know the covid vaccines They have very strict limits at which temperature they have to be stored for example or that there has to be no sun Whether they are stored so all these things can be again monitored with stream processing as well And when you breach some of the rules it can automatically somewhere mark some batch as Damaged for example, or you can use it in sports to monitor performance in manufacturing to Monitor for example some robots and some car manufacturing line And when you see that something's going wrong with some robot you can kind of proactively Fix it because stopping the whole line when it breaks will be too expensive and you can continue like this in transportation waste management logistics telecommunications energy Retail and so on so it kind of fits into all these different areas and all these different industries and It's good to process the data at the source because that's where they are produced and it gives you several advantages so one of them is that You get better latency and speed of them like the latency There's one obvious part if you don't have to send the data for example into some cloud and then get them back When they are processed then you save some network latency, right? But it's also if you do it somewhere centrally in the cloud Then you might have many locations sending there the data and you might be queued for processing behind someone else Whereas if you do it directly at the source then yeah, you are not queued behind anyone else You can better control how much processing power you have and you can make sure that they are processed really quickly and in time another advantage is that You are more resilient against things such as outages now in some of the areas You might be doing the things in the middle of the nowhere and there might be bad connectivity Which is unreliable, but even if you have some Retail space some shop for example or supermarket in some shopping mall which has in general good connectivity It might happen that the connectivity goes down because someone Did something wrong right and in that case if you are doing the things Locally at the source at the edge then you might not need to for example close the shop because the connectivity is Not working you can continue to operate as as normally And in some environments, it's kind of not just a question of some some problem with the connectivity But it might be disconnected for a long time by design if it's a cargo ship somewhere in the middle of the notion It might not have the best connectivity possible Similarly, if it's a plane somewhere over a North Pole, I think there's not good satellite connectivity either So there are situations kind of where we are by design not connected and where this fits quite well and last but not least it obviously impacts also the cost because If you ever use some public clouds like AWS, you know, for example at quite often the data transfers are the biggest chunk of Your invoice. It's not the VMs or the storage It's just sending the data here and there and it's a bit similar here as well If you don't send the data if you process them locally then you can save some costs as well So I wanted to also touch a bit on what I mean with the edge here What kind of environment I'm talking here about because there are many different use cases and they don't always talk about the same thing So some for example in some use cases in some situations people would be talking about edge as some IoT devices But as I'm talking about using stream processing in Apache Kafka This would not have really the power to do these things, right? So you might use them in the environment, but that's not what we will be running the stream processing on similarly in some cases Smartphones or tablets might be the thing which might be the edge and in some use cases. It's completely valid and true but Also quite often actually these have enough power to do these things these days It's not really designed for for something like that. So so I'm not really talking about those either but When it comes to things such as single board computer such as Raspberry Pi then that already is something where it can work now Raspberry Pi is not really Professional industry grade device, but you can use it you can easily buy it and Yeah, you can do stream processing on it quite easily and actually I will use those in the demo at the end Then in many cases You might use some consumer PCs or some kind of Old PC or some powerful PC lying under the table in some office and kind of running some Coffee shop or some some supermarket or some fast food chain and so on and that's again, that's completely fine that's completely valid in some cases, it's really used like that and Yeah, it works and then of course in many cases It will be just a regular data center with rex and and real servers It's just maybe won't have hundreds of rex or thousands of rex It will maybe just have to have just few rex, but yeah, even that's something what can be called edge and Yeah, obviously you can use it in this case as well so Why should you use Apache Kafka for these things, right? That's Something I will be focusing on a lot. So so why should you even care and Kind of the most lame argument is that it's kind of leading Even streaming platform, right? It's used for these things for years. It's well proven Is used by many organizations and so on so yeah, why not use it, right? but there are some more practical arguments as well and One of them is that it has all the tools you need to do this So you have the Kafka brokers which kind of always sit in the middle of the architecture And they are the thing which kind of receives the messages From some producers and then pass the messages to some consumers and then you can kind of process them and do whatever you want with them Then you have the streams API which Is the actual streams processing engine now the nice thing about it is that is basically just a library Which you can include in your own Application it's not some huge framework with some worker nodes and some schedulers which is heavy and complicated to run It's really just something what you take as a library include in your application and use its features And so this kind of being lean kind of fits quite well with the edge as well But despite that it actually has quite a lot of features So you can do all the simple stateless things such as Transformations filtering and rich man's but you can also do the more Sophisticated and heavy things you can do time window wings You can do stateful processing with with aggregations and storing the data and all of that can be done While still being scalable so you can just scale it and run it in multiple instances to get better performance Then the next part is the Kafka connect API. So I hope that Everyone after the talk will be convinced to use Kafka at the edge But it's would be quite rare that you would use only Kafka there You would probably have other things as well So the integration part is important because you want to take the data be able to send them somewhere else Integrated with other systems and that's what the Kafka connect API as a Kafka component does and then another part is something called mirror maker which Can be used to mirror data between different clusters and that's useful because you can then basically copy these data between the different environments and share them that way as well and then last but not least Kafka has also quite a lot of Integrations for all kind of different tools which are not part of the Kafka project itself So for example, if you would want to do something with AI or machine learning There's a lot of tools which kind of easily plug into Kafka as well And you can for example pre-train your models somewhere else And then just use them at the edge and plug them into Kafka to kind of read the events and process them so hopefully that gave you some kind of Introduction to the different parts and now let's have a look at How you can do this as a kind of introduction as a pattern how you can which you can use so Typically you would start with some input data So you might have some IOT sensors which are feeling feeding you some some environment data You might have some applications running on Smartphones or running on some point point of sale terminals, which can again feed you the different data you can have Different beacons who monitor how people move through some space You can have cameras and all other monitoring tools and all these things can be kind of plugged into it and Then you will have the Kafka brokers Which is I said kind of sit in the middle of everywhere and they store the data and they kind of distribute them But quite often it would happen that the things such as for example IOT devices will not talk directly With Kafka in the Kafka protocol because that's a bit too heavy for that and too complicated So quite often it will have some kind of bridge sitting in between those can be for example using MQTT Or it can be using HTTP It kind of gets the data in this little bit simpler and easier protocol from from the IOT devices And then it will basically format that as a Kafka connection and pass that to the to the Kafka brokers and then From the Kafka brokers you can kind of connect the different Stream processing applications and do the actual stream processing where you read the data sent by the sensors or by the other input devices and You will basically do whatever you need to process them And of course you can also connect other clients and other applications depending on what exactly you are doing And that's basically our our edge environment But what's kind of important is that the edge environment doesn't live on its own, right? It wouldn't be edge if it wouldn't be on the edge of something So there's typically some some other part of it as well I call it here HQ as headquarters But you can call it central cluster or something like that and it's again quite typical part of it there You have something central running for example in some cloud or really in some headquarters in some on-prem data center And you want to link these two parts? So that's where kind of the mirror maker tool fits in because it can basically mirror the data between the different Kafka clusters And that's quite important because when you do the processing Maybe you aggregate something and then want to push the data into the central Information system of the company or of the organization, but also it can work in the other way around So quite often you for example have some reference data or some master data Which you are managing in the central cloud in the central environment Through some other tools and then you always need to kind of take them and synchronize them to the edge locations So that they can use the latest reference data. So that's what you can do with mirror maker and then what's also important is That usually you don't have just a single edge and the central cloud usually have many of these edge locations, right? So you need to be able to manage them and monitor them in some efficient way because you don't really want to SSH Into all of these and then install something or upgrade something or check if it's still running So you want something about gives you as little work as possible and that's where the things such as Kubernetes or the Kafka operators as trimzy which will help you run all these components Come in because they will do a lot of these things for you and make it much easier for you to manage this whole architecture One of the advantages is that it allows you to run the same software everywhere So you can use kubernetes and you can use trimzy or the other operators if you would use database for example You can use them in the central cloud, but you can use them in the edge locations And even at the edge locations for example, you can use them on different hardware platforms You can may have different situations Everywhere you can use the same tools You don't need to learn new things every single time and you can use them exactly in the same way So you know that when you are fixing something on one environment Then it will be exactly the same environment as the others But thanks to the kubernetes and operators you should not actually need is that much because they kind of help you with Making the environment resilient and self-sustaining right so the kubernetes They will take care of Restarting the processes the operators will basically make sure that the applications are running that they are upgraded properly That they are maintained that they are monitored that they are Certificates are renewed and all these things for you and they kind of Do this all job for you and you don't need to take care of it that much And then finally there's a lot of tooling around automation which is available for kubernetes such as the different github's tools Argo flux and so on and you can use those to kind of manage these Configuration so with operators you have it all in declarative manner where we have some yamlas You can kind of store them in your in your gith environment And then you can use these tools to kind of roll it out to all the different locations in In various patterns so that makes your life much easier as well so let's have a look at a demo and At the end I have there a link which gives you The github repo with all the source codes and so on so that you can look into that in a bit more detail But basically what I have it's running at home in my homelab and there's some ESP 32 based sensor Bored with some sensors for temperature and humidity and air pressure and so on and that's then connected over Wi-Fi to the kubernetes cluster which is running There and it's actually using an HTTP bridge to kind of communicate with the Kafka cluster So it the board sends HTTP request and the bridge converts it to the Kafka broker and then it does the stream processing using the Kafka streams API application which basically just to demonstrate something simple it does kind of one minute windows and over the windows it calculates the average Values and then sends them into another Kafka topic and these are then mirrored by the mirror maker into the kind of central cloud where There is a simple application which basically takes these data and visualize them them centrally so It's not Really industry grade equipment, but it's really running on the on real hardware. It's not just some software emulated things So it's using this ESP 32 board with the sensors and it's and it's using it in micro Python and Then I actually have a Raspberry Pi cluster, which actually has three nodes not four nodes when I when I did the demo And that's running the k3s Kubernetes distribution across it and it's using the streams operated to run the Apache Kafka Components for us So I hope you will forgive me for using recording but actually running in Resilient and self-sustaining matter at my home behind the nut. So it's not that easy to do this life But let's first have a look at how the IOT board looks like so as I said, it's using Micro Python that's kind of a cut-down version of Python if you don't like Python don't worry. I'm not biggest fan either, but it's actually quite easy to use and and Even with a little knowledge, you can easily write some things and what you see here are the basic files for it the BME 280 is the library for working with the sensors and then the boot Dot Pi script. That's kind of what's called when the when the board starts and it's just some initialization work like connecting to the Wi-Fi So it can send the data and and things like that and Then in the second file in the main dot dot pi file That's what's actually running there All the time and doing the actual work and it basically first loads the library for working with the sensor then it initialized some Some led led lights to kind of use as a to signal some problems So it will be kind of switched on if something stops working and then It kind of configures the the different data like the location of the sensor and the URL of the HTTP bridge Where it kind of sends the request and then it's basically running in a in a while loop Every second and it reads the data from the sensors. It formats a JSON message From it which it then sends using HTTP post to the to the Kafka broker as As a message and when that succeeds then great. Let's do another loop and when it fails and it kind of just Switch on the led light to kind of indicate that Yeah, something's wrong so That's basically how the How the IoT board looks like and now let's have a look at the at the edge location So as I said, it's kind of Kubernetes cluster It actually has three notes when I recorded them all because I had one of them switched off But it's running the k3s distribution and when I check the the ports which are running there You can see the stream the operator which is kind of running all the Kafka components And then you can see the Kafka cluster with Kafka pot and zookeeper pot and you can see also the entity operator which is used to manage users for security and Topics for where data are sent and then we have the mirror maker which is doing the mirroring and Then finally we have the bridge which is doing the the bridging between the HTTP world where the IoT device sends the data and the The Kafka broker and now what we can do because it's running We can start a Kafka consumer and connect it to the topic in the Kafka broker where The data are being sent from From the device It's actually using this Wi-Fi people Which is actually running in in a pot the whole Wi-Fi setup I find that quite neat, but I don't take any credit for it I think I copied it from some colleagues who may be copied it somewhere else But yeah, now let's run the let's run the consumer and that should show the Kind of raw data as they are being sent by the sensor So we should see roughly every second a message in the JSON format with the readings from the sensor So it takes a few seconds to start the consumer pot now you can see the see the messages as they are kind of coming in through the bridge from the IoT device and Once we have them in the In the Kafka broker we can move on to the to the stream processing So there's one other pot running in this namespace and that's the aggregator pot Which is running the Kafka streams API application Which is actually running inside this Quarkus Framework or tool kit which kind of makes it easier to just run it and it does some special tricks for in The build time to kind of optimize it But what it's basically doing is it's reading the data from the Kafka broker every second And it's creating one minute windows window after window over them and then calculating the average for Given minute and then when the minute window ends it will basically take the average value and send it to another topic in the Kafka cluster now obviously this is more for demonstration purposes It's not the most sophisticated processing possible, but it should kind of give you idea about How this can work and now when I open a consumer against this topic with aggregated data We should see again basically the same message, but now it should be Send just every minute because it's basically result of the of the aggregation And that's kind of the the average value which kind of softens out the numbers we are getting from the from the sensor So that's kind of the the edge location and then the last part is the Center location where we kind of get the data from the edge location like I have at home right now only one but in Reality you would have many of them feeding the data there And what we can see here is again the familiar thing the stream see operator on the Kubernetes cluster Running the whole Kafka cluster this time. It's a bit bigger So it can handle more data and more things. It is also some more components But then there is this front-end application Which basically reads the mirror data from the edge and then it shows them on a on a map Or it also kind of keeps them for the history and shows them in in Prometheus so that you can kind of look how the how the values were evolving and And Yeah, what we can check also is how the data are being mirrored from from edge location So I will again run the consumer is the same as the last time but this time it connects to the central cluster and not to the Kafka cluster at the edge and We should again see basically the same messages, but this time these are the mirrored messages mirrored using the mirror maker and Yeah, so here's one And if we will wait another minute, we will get next one and so on But let's switch to the to the browser and just ignore this for development purposes That's when you use Google Maps without entering the production API key but what you can see is it just shows the map and It shows the pin with the location of the of the sensor and then it gives you the details and when you When you click on it, you can kind of get to the to the Prometheus chart Which gives you the the history and shows you how? how it was evolving so That's kind of the the demo part. It's it's not simple. Sorry. It doesn't have too many things Which are kind of not focusing on the on the pattern, but should demonstrate. Well, how? How Kafka helps in this area, hopefully And that's it for the talk. This is the URL there you can find the demo it will redirect you to the to the github repository and Yeah, thanks for thanks for listening thanks for watching and if you have any questions We should have some some time for that so in It's quite complicated because you would need to create different listeners in just to repeat the question the question was if someone runs the Kafka in the containerized Kubernetes environment how to get access to it kind of from the outside and It's not easy because of how kind of Kafka has its own discovery mechanism, which makes this quite complicated, but basically you would need to To configure the listeners in the way that you have for example multiple listeners one of them will be kind of for the internal applications running inside the Kubernetes cluster and Other one will be for the applications running outside and you have to use in the other one the for example Addresses of some note port or some load balancer address in there to kind of advertise it to the clients And then use this listener for it So if you would use the streams it running on Kubernetes then kind of it has four different types of listeners like using load balancer Using ingress using open shift throughout and you can kind of just configure them And it kind of does all these things in the background for you and then just gives you the address Where to configure the client on but yeah, you would basically need to play with the advertised Hosts configuration in the in the Kafka config if you would kind of do it yourself Any other questions? Yeah, so the question is if you would have multiple edge locations with basically multiple mirror makers synchronizing their own data if it would be synchronized into the same topic or Into a different topic for each location just to repeat the question And I think it depends a bit like with a with a project like this where we are just sending some sensor data The same topic makes most sense because then it's much easier to consume it But there definitely might be some cases where different topics Might make more sense where for example, I don't know you work for some organization We just some other kind of divisions and so on So the the question is about the HTTP bridge if this is a standard component or if that's different projects and so on It's actually what I'm using here is directly from the Strimsy project We just its own HTTP bridge and you can basically deploy it with the operator Just by specifying a custom resource. So that's kind of easiest and that's what I use there. There are some other Bridge components out there as well. There's the confluent rest proxy, which does HTTP proxying as well Confluent as an MQTT bridge as well, which you can use if you want MQTT for example and There are others as well So you can kind of use what I used as a Strimsy maintainer was obviously a Strimsy bridge But you can if you would want you can use others as well. But yeah, I use yeah Sorry, what? Yes. So so the question was how do I configure the aggregation part? So it's using the Kafka streams API. I Should have prepared it so I should have showed the source code But the source codes for it are actually in the github repository as well but it basically in the streams API you just say start from this topic and Specify this the service for kind of decoding deserializing and serializing the messages Into Java basically and then you just get the messages as object and you can work with them in the streams API DSL So you just start with this from and that basically in this case that gives you kind of the data And then you just use the DSL to say okay with window ink with one minute windows and then The most complicated part of it is actually writing the custom aggregation to kind of do the averages But otherwise, it's it's quite simply if you check the github repo. There's a it's like free Java files all together or something like that so I I'm not sure exactly How easy I don't think it would be that easy to use it to distribute commands, which would be to specific edge locations Right because you would for example need to have different topics For kind of each location to be able to say okay location with this ID Do this or you would need to mirror the commands for everyone to every edge location and then let the edge location For example filter it out whether it's for it But it's like super useful if you have some reference data like if you I don't know use it In some supermarket to update all these digital price tags Then if someone changes it in the in the central change the prices you can kind of roll out the updates to all the edge locations this way for example or other kind of reference data where basically the same data can be sent everywhere and applied to all Locations I think that's where it fits a bit better than some kind of command Pattern anything else in that case thanks for thanks for joining me and thanks for your time


The scripture teaches that God has given you a spiritual gift. This is a special ability empowered by the Holy Spirit. Now God has given us the spiritual gifts for several reasons, to expand His kingdom here upon the earth, to evangelize the lost, and especially to build one another in Christ. I'm going to be beginning a brand new Spirit Church teaching series. This one is entitled, The Gifts of the Holy Spirit. And I pray that as we go through this series, that you would grow in your understanding of the spiritual gifts and discover the gifts that God has given to you. So we're starting this first part here on this edition of Spirit Church on Encounter TV. Before we begin, Stephen Moctezuma is here with me as usual. He's going to lead you in worship, and then we're going to get right into this lesson. This is Stephen Moctezuma. So what are the spiritual gifts? The spiritual gifts are special abilities that the Holy Spirit has given to each and every believer. God has deposited a gift inside of you. Now I've broken down these spiritual gifts into three primary categories. Now the first category is what I call the service gifts. And here I need to mention that I do believe that all of the gifts are used for service, the service of our fellow brothers and sisters in Christ to service as the body of Christ, the world in evangelizing it and various other ways. So the spiritual gifts, all of them are service gifts. But just for the sake of categorization, I've given this first category, the name service gifts. So what are these service gifts? Number one, there is the gift of exhortation, which is found in Romans chapter 12 verse 8. Now this is the gift of encouragement. There is the gift of giving, which is found in Romans chapter 12 verse 8 also. There is the gift of leadership, also found in Romans chapter 12 verse 8 and first Corinthians chapter 12 verse 28. There is the gift of service, which is Romans chapter 12 verse 7. There is the gift of administration, which is found in first Corinthians chapter 12 verse 28. Now these are, as I said, under the category, at least how I've placed them, of the service gifts. Now the service gifts are basically abilities that are empowered by the Holy Spirit that would otherwise not be as effective. So you may look at some of these gifts and saying, well, encouragement doesn't seem to be supernatural or giving or leadership or service or administration. That doesn't seem to have a supernatural touch to it. Well, the truth is that the Holy Spirit empowers us in both the supernatural and the practical. So these service gifts, though they are practical in the way they are carried out, are sourced in the spirit and therefore are supernatural in nature. In other words, you can encourage and give and lead and serve and administrate at a level that you would not have been able to do otherwise without the aid of the Holy Spirit. And we'll talk more about these in the coming sermons in this series. Number two, the category of power gifts. Now these are gifts that have that supernatural touch in the way they are applied or in the way they are used. And number one, there's the gift of the Sermon, 1 Corinthians 12, 10. There's the gift of faith, 1 Corinthians 12, 9. There is the gift of healing, 1 Corinthians 12, 10. There is the word of knowledge, 1 Corinthians 12, 8. There is the word of wisdom, 1 Corinthians 12, 8. There is the gift of miracles, 1 Corinthians 12, 10. Also in 1 Corinthians 12, 10 are the gift of tongues and the gift of tongues interpretation. And in Romans chapter 12, verse 6 and 1 Corinthians chapter 12, verse 10, there is found the gift of prophecy. Now these are the power gifts. And again, I'm going to also go over these in coming sermons. I just want to give you a quick overview of what the gifts are before we get into the primary teaching that I'm going to be giving you today. And then number three, the category of leadership gifts. These are primarily found in Ephesians chapter 4, verse 11. But you'll see one, namely the teaching gift found also in Romans chapter 12, verse 7. So there is the gift of the evangelist, the gift of the pastor, the gift of the teacher, the gift of the apostle and the gift of the profit. Now we're going to elaborate on all of these gifts all throughout this series. But I want to talk to you about some truths that I think are fundamental to your understanding of the spiritual gifts. These are things that you need to know about the spiritual gifts before you begin to operate in them. And we're going to be in 1 Corinthians chapter 12, and this is going to be somewhat of an expository teaching. I'm basically going to go verse by verse and we're going to pull the truth from the scripture here concerning the spiritual gifts. So go now to 1 Corinthians chapter 12. We're going to read verses one through three first. So 1 Corinthians chapter 12, verses one through three say, Now, dear brothers and sisters, regarding your question about the special abilities the Spirit gives us, I don't want you to misunderstand this. You know that when you were still pagans, you were led astray and swept along in worshiping speechless idols. So I want you to know that no one speaking by the Spirit of God will curse Jesus and no one can say Jesus is Lord except by the Holy Spirit. So the first thing that Paul mentions when writing about the gifts of the Holy Spirit is that he does not want the Corinthians to be captured or recaptured by paganism. The Corinthians were into witchcraft and sorcery and paganism. And so they operated to some extent in power. They operated in demonic power. And Paul the apostle is telling them that he does not want them to misunderstand the gifts. He does not want them to be ignorant concerning the spiritual gifts. He says, I know some of you, many of you were worshipers of idols and you were idolatrous and you were into paganism and witchcraft and sorcery. So he's saying, I want you to know that these gifts are different. These gifts are not like the demonic power that you used to have. So he tells us in verse two, you know that when you were still pagans, you were led astray and swept, swept along in worshiping speechless idols. Verse three, we'll read it again. So I want you to know that no one speaking by the spirit of God will curse Jesus. So he's trying to differentiate the spiritual gifts from pagan power. The Corinthians worship Poseidon. They worship Aphrodite. They worship Asclepius. Now, Asclepius was actually the God of healing or also the God of truth and also the God of prophecy. So the Corinthians worshiped these idols that had these special abilities and likely gave them special abilities through demonic power. So I'm not saying that we believe in these false deities or even that they existed. If they did, they were demonic beings. And that is a whole different lesson for another time.   And so this life of idolatry, this life of immorality, this life of paganism and sorcery and witchcraft is what Paul is trying to pull them from and make sure that they do not revisit. So Paul did not want the Corinthians to confuse God's power for their former pagan power. So what's the difference here? How can we discern between demonic power, pagan power and the power of the Holy Spirit? Well, Paul gives us the answer. We'll read it again. Inversely, and I want you to really get this. So I want you to know that no one speaking by the spirit of God will curse Jesus and no one can say Jesus is Lord except by the Holy Spirit. So what's interesting here is that he doesn't mention methodology. He doesn't mention style. He doesn't mention the abilities that they operate in. He instead mentions the message that they are proclaiming. So if the church understood this, if the modern church understood what Paul was teaching here, there would be greater levels of unity among the brethren. So this is why you cannot judge someone based upon their methodology or based upon the fact that they move in the power of the Holy Spirit. I see people all the time. They'll actually quote this verse. Let's read it and then we'll go over Matthew chapter seven versus twenty one through twenty three. Not everyone who calls out to me, Lord, Lord, will enter the kingdom of heaven, only those who actually do the will of my father in heaven will enter on judgment day. Many will say to me, Lord, Lord, we prophesied in your name and cast out demons in your name and perform many miracles in your name. But I will reply. I never knew you get away from me. You who break God's laws. Now, those who are skeptics, those who are against the spiritual gifts or who we call cessation is in other words, there are people who believe that God does not move through the gifts anymore. He does not have profits. He does not empower people to heal the sick. And it's sad that some people actually believe that when if they were reading the scripture, they wouldn't come to that conclusion. But they'll point to scriptures like this, Matthew chapter seven. They'll say, see those people prophesied and look at where they end up. But it's not that they prophesied. That was the reason that they ended up being separated from the Lord. That was an that was something else entirely. God does not judge us based upon the gifts that we use. God judges us based upon what we do with the Lordship of Jesus Christ, how we respond to the gospel, how we respond to his offer of salvation, how we repent or don't repent. That's the judgments that God uses. So I'm looking at this verse and I see that these are people who operated in the gifts without knowing Jesus. This just goes to show you that you cannot judge anyone based upon their gifts. So not everyone who demonstrates power is demonic and not everyone who demonstrates power is godly. So the gifts or the gifts in operation in someone's life, that is not the standard by which we judge one another. Jesus said, you will know them by their fruits, not by their gifts. So it's neither here nor there, whether or not someone is operating in the gifts.  And it's not the lack of the use of the gifts that send someone to hell. What we need to look at here is the message being proclaimed by those who demonstrate the power. So he is saying that the difference between the pagan power, obviously other than the source of that power and the power of the Holy Spirit is the message being proclaimed by the one who demonstrates such power. In other words, the one who is using their gifts, their spiritual God-given gifts to point to Jesus as Lord, to point to Jesus as Savior is the one that God is blessing, is the one that God is truly using. Now someone can go and use their spiritual gift for something else and that is sorcery. And sadly, there are some around today who use spiritual gifts that they've acquired from God and they go and they use it for financial gain. They go and they use it to promote themselves. They go and they use it without ever mentioning Jesus once. In fact, I've been in church services where the gifts were in full operation, but there was not one mention of Jesus. And there was a lack of substance. There was a lack of the glory. There was a lack of the presence. And there was even a lack of peace. When you use the gifts of the Holy Spirit without purposing in your heart to use those gifts to lead people to Jesus, when you use the gifts of the Holy Spirit without preaching Jesus, be careful. That's borderline sorcery. That's borderline paganism. That's charismatic witchcraft. When you focus primarily upon the gifts, I don't need to follow signs. If I follow Jesus, signs will follow me. I simply preach the gospel and use the gifts as an aid to the gospel message, not as a replacement for the gospel message. So if you go to a ministry and all they ever talk about is the gifts, all I'm not saying they can't teach on them or mention them or use them or even emphasize them from time to time. But if all they ever preach is prophecy, all they ever preach is giving, all they ever preach is healing, then there's something wrong there. And this is what Paul is telling us to avoid, to avoid that idolatry, to avoid that empty power, to avoid that paganism, that sorcery, that witchcraft. He's saying that you will know by the ones who proclaim Jesus as Lord. Look at that verse again, knowing what I just told you. So I want you to know that no one speaking by the Spirit of God will curse Jesus. And no one can say Jesus is Lord except by the Holy Spirit. He's not saying that no one can use that phrase without the Holy Spirit. He's saying that no one who truly is filled with the Holy Spirit will not preach the salvation message, will not preach the Lordship of Christ. So look at the message, not the methodology, not the style, not whether or not they're similar enough to you. Look at what they're proclaiming. Look at who they're preaching. Are they preaching self? Are they preaching money? Are they just preaching miracles? Or are they preaching salvation? Are they preaching the Lordship of Christ? Are they preaching Jesus? That is how you can discern between the true gifts of the Holy Spirit and gifts that are being used out of order. So we avoid paganism through using the gifts to emphasize the gospel message of Jesus Christ, not the gifts themselves. Let's continue to read verses four through six. There are different kinds of spiritual gifts, but the same spirit is the source of them all. There are different kinds of service, but we serve the same Lord. God works in different ways, but it is the same God who does the work in all of us. Did you see that? Watch this again.  Look at this. There are different kinds of spiritual gifts, but the same spirit is the source of them all. There are different kinds of service, but we serve the same Lord. God works in different ways, but it is the same God who does the work in all of us. Did you see that? Father, Son, Holy Spirit. There's a reference to the Trinity right here when he's talking about the distribution of the gifts of the Holy Spirit. Then in verse seven, the scripture says a spiritual gift is given to each of us so we can help each other. So you cannot say to yourself, I don't have a spiritual gift. God has given you a spiritual gift. How do I know? The Bible says it right here. It says a spiritual gift is given to each of us, the brethren, the sisters in Christ. So the Father, the Son, and the Holy Spirit. I want you to hear this. This is going to bless you. The Father, the Son, and the Holy Spirit, all three got together, took a vote, made a decision, and distributed to you your spiritual gift. In other words, the spiritual gift that you have, it was decided upon by the Father, the Son, and the Holy Spirit, all in unity. And they chose your gift. I want you to really think about that. This means that this is something that was done intentionally. The mind of the Father, the mind of the Son, the mind of the Spirit, all working together to decide what gift you would get. They don't make mistakes. And in fact, what the Trinity does in unity can never be undone. This is why the Bible says in Romans chapter 11 verse 29, for God's gifts and his call can never be withdrawn.  So if you believe that you have lost a spiritual gift, you're being lied to by the devil. If you believe you've lost the gift of prophecy or lost the call of God or lost the anointing on your life and that it can never come back to you, that is a lie from the enemy. For the Bible says, let's read it again. I want you to get this in your spirit. For God's gifts and his call can never, I want you to say it, can never be withdrawn. They are with you forever. God has placed them in you. The Trinity decided upon it. The Trinity in unity caused it to be so and it cannot be undone. For again, what the Trinity does in unity cannot be undone. They are the source of the gift. God has given to you a gift. So that first point we're gleaning from 1 Corinthians 12, we want to avoid paganism or avoid sorcery. So we want to make sure that the gifts have their place in the proper place so that we're not causing them to be the primary thing, but they are something that points to the primary thing, which is the gospel or Christ himself. Number two, I want you to understand the source of the gift. Now let's continue to read or again, read verse seven, a spiritual gift is given to each of us so we can help each other. The spiritual gifts are not a reward. They are a responsibility. The spiritual gifts are not given to you for status. They are given to you for service. They are not given to you so that you can put on a show. They are given to you so that you can make an impact. They are not given to you so that you can lift up your own name. They are given to you so that you can lift your brothers and your sisters in Christ. And when we use our gifts, we are serving not just the body, but the world. Think about this, the evangelist found in Ephesians chapter four verse 11 is certainly a gift to the church, but the evangelist in essence is also a gift to the world because the evangelist is the one who takes the gospel message to the world. Some of the gifts of the spirit work externally. Some of them work internally. Some of the gifts of the Holy Spirit are used to touch the church within and some of the gifts of the Holy Spirit are used to touch the world without, but all of the spiritual gifts are of the church. Some work outside, some work inside, but all of them are of the church. And when I say they work outside of the church, I don't mean that they are disconnected from the church. I simply mean that they are used with an emphasis on reaching those who are outside of the church while remaining connected to the church itself. So let's continue to read now. So that was the point I wanted you to get there. The gifts are for service, not for status. Let's continue to read now verses 8 through 11 where the scripture says, to one person, the spirit gives the ability to give wise advice. To another, the same spirit gives a message of special knowledge or the word of knowledge. The same spirit gives great faith to another and to someone else, the one spirit gives the gift of healing. He gives one person the power to perform miracles and another the ability to prophesy. He gives someone else the ability to discern whether a message is from the spirit of God or from another spirit. Still, another person is given the ability to speak in unknown languages. While another is given the ability to interpret what is being said. It is the one and only spirit who distributes all these gifts. He alone decides which gift each person should have. Now, we're going to touch on all of these in the coming weeks, but let's continue to read for now. I want to emphasize somewhere else here. We're going to read verses, begin reading at verse number 12. The human body has many parts, but the many parts make up one whole body. So it is with the body of Christ. Some of us are Jews. Some of us are Gentiles. Some are slaves and some are free. But we have all been baptized into one body by one spirit and we all share the same spirit. Yes, the body has many different parts, not just one part. If the foot says, I am not a part of the body because I am not a hand, that does not make it any less a part of the body. And if the ear says, I am not part of the body because I am not an eye, would that make it any less a part of the body? If the whole body were an eye, how would you hear?  But our bodies have many parts and God has put each part just where he wants it. How strange a body would be if it had only one part? Yes, there are many parts, but only one body. The eye can never say to the hand, I don't need you. The head can't say to the feet, I don't need you. In fact, some parts of the body that seem weakest and least important are actually the most necessary. And the parts we regard as less honorable are those we clothe with the greatest care. So we carefully protect those parts that should not be seen, while the more honorable parts do not require this special care. And I want you to really listen to this, how the scripture says, so God has put the body together such that extra honor and care are given to those parts that have less dignity. This makes for harmony among the members so that all the members care for each other. If one part suffers, all the parts suffer with it. And if one part is honored, all the parts are glad. All of you together are Christ's body, and each of you is a part of it. Here are some of the parts God has appointed for the church.  Are we all prophets? Are we all teachers? Do we all have the power to do miracles? Do we all have the gift of healing? Do we all have the ability to speak in tongues or in unknown languages? Do we all have the ability to interpret unknown languages or interpret tongues? Of course not. So you should earnestly desire the most helpful gifts. But now let me show you a way of life that is best of all. Now, verses 29 through 31, where it goes on asking the rhetorical questions, do all have gifts of this and all have gifts of that? We're going to address in part four of this series. But I want to just emphasize, and this will be my last point, that the gifts work most powerfully in unity. It's not a mistake that Paul mentions the trinity while also talking about the gifts of the Holy Spirit. In fact, he mentions the trinity in passing while introducing this teaching on the gifts of the Holy Spirit. And introducing this concept of unity in the body of Christ. The trinity is the greatest example of unity. Trinity, tri-unity, three united as one. So we all serve a function. And like the trinity, who each member serves a function, we also all honor one another. God honors his son, Jesus honors the father, the Holy Spirit honors them both, and they both honor the Holy Spirit. In fact, I found it interesting that Paul the Apostle writes that those that we may deem as less important, God has placed the greatest honor upon. And I find it interesting that many people consider the Holy Spirit. I don't consider. I think they're all equal, but some people think that the Holy Spirit is a lesser in the trinity.  He honors the Holy Spirit, he protects the Holy Spirit and vice versa. And as it goes with all three of them, we are to be the same way. We are to be united with our brothers and sisters in the same way that the father, the son and the Holy Spirit are united with one another. This is where our gifts will thrive in their greatest capacity. This is where our gifts will have the greatest power is when we are all united. We need everyone doing what they do. We can't say to anybody, we don't need you because you're not enough like me. Or I don't really agree with how you do that with your methodology. We need all the members of the body of Christ. It's interesting then that Paul the apostle goes on after this to talk about love. If you read 1 Corinthians chapter 13, you know that that's one of the greatest pieces of writing ever on the topic of love. But he wrote about that right after he talked about the spiritual gifts. He talks about the spiritual gifts. Then he talks about unity. Then he talks about love. Why? Because those are all what are necessary to give the spiritual gifts their greatest level of power. So as we read the first Corinthians 12, let me just recap with you. We found how to avoid paganism and that is declaring the message of the gospel and not using the gifts to emphasize the gifts themselves or the person who uses the gifts. We looked at the source of the gifts so then that the gift cannot be taken away. We looked at the fact that the gifts are for service, not for status. Remember, God has given you the gift not so that you can elevate self but so that you can edify one another or help one another spiritually. And again, spiritual gifts are simply abilities that God has given to each of us and we're going to go over what those are in the coming weeks. And finally, the gifts work most powerfully in unity. Well, I want to pray with you now and let's pray that as we begin this series together that God would help you to not only discover your spiritual gifts but understand your place in the body of Christ. You know, there are people who say I don't want to go to church because I am the church and nothing is hardly a thing I've heard is more arrogant or foolish. And I don't care.  I'm telling you the truth. You need to get into a church and you need to get plugged into a people. Why? Because we're to be united. You may say, well, a church is not a building. I understand that all I'm saying is you need to be plugged in with fellow brothers and sisters in Christ. If the scripture tells us that we're to use our spiritual gifts as a command, then how are we supposed to use our spiritual gifts to edify one another, not just the world, but edify one another? How are we supposed to do that without relationship and connection? We need to be united. So I pray that the Lord would give you a greater understanding of unity and he would give you a greater understanding of love and he would give you a greater understanding of how we work together to build the kingdom of God and to win the lost to Christ. I want to pray with you now for those things. Father in Jesus' name, I pray for that one receiving this prayer now, who desires in their heart to be used by you, who desires in their heart to know their spiritual gifts. I pray, Father, that you would anoint that one, guide that one and speak to that one. Reveal to them, Father, their spiritual gifts. Father, help us to dwell in unity. Help us to love one another. Help us to use what you have given us to bring glory to your Son Jesus and not to ourselves, not to us, to your name be the glory. In Jesus' name we pray. I want you to say if you agree, say amen. Well, I want to welcome now the new members of Spirit Church. There you are up on the screen. We love you. We are praying for you. I always say that because I always mean it. If you would like to join the Spirit Family or join Spirit Church, then go ahead and use the information at the bottom of the screen to become a member today. As a member of Spirit Church you'll get an email from me every single Sunday. I'm going to send you the latest teachings and you'll get those and you'll also be able to reply for prayer support. You'll be joining a group over 2,000 of us from all around the world. So join the Spirit Family today. I'm going to read now your comments from last week's teaching and then I want you to stick around. I want to talk to you for a second. So here are the comments from the lesson, the healing presence of Jesus. Here's what you wrote. Thank you so much, Brother David, for the powerful message. You have just revealed who I get my healing from. It's only from Jesus. May the Heavenly Father bless you. Hardy Grace writes, I've been bedridden for almost 7 days now and I've been asking God to heal me. When you were praying, I felt something inside me with peace and I'm continuing to fill it. I praise God for you, Leslie from the Philippines. God bless your ministry. Well, God bless you too and we pray that the Lord would continue to work his healing power in your life. Shamar writes, Amen, Brother David, we are just vessels for the Master. The emphasis here is that Jesus is the only healer. There is no other healer. There is no one else who can perform the miraculous. It's only Jesus. Lovely Grace writes, Thank you, Pastor David. I sense the presence of Jesus now in my room and I received healing. I pray that God will bless you more and use you more for his glory. God bless you brother in Christ.  Yet writes, Brother David, thanks for the amazing preaching. There's really a misconception in healing sometimes that they are looking to the person rather than the presence of God. I have learned many things. God bless your ministry. Well, thank you. We love you. We appreciate those comments. And if God has spoken to you on this lesson, then go ahead and leave your comment on this video also. Now I want to talk to you about something so don't turn off the video yet. Many of you know we've been raising finances or monthly support for a brand new production facility here in Southern California. And here's the update. I told you I'd update you every week. Here's where we are in the campaign. You can see the progress that we are making. We are almost there. And I anticipate that we're going to be wrapping this up in just a few months as long as we keep up the pace of adding on that monthly support. Now, what do we need the monthly support for? It's very simple. We want to win more souls. And the facilities that we're looking at are going to require a greater amount of monthly support. This means that we need to pay for the rent or the lease of the mortgage or whatever deal we're able to work out. We need to pay the electric bill. We need to pay the maintenance, the cleaning, the security, the insurance. We need to hire on for extra hours the staff that's going to be working some of the new ministries that we're operating. From this facility, we're going to launch a brand new television network, the Encounter TV Network. And this network is going to focus on the top box television sets and new media technology. In addition, we're going to be having a 24 seven prayer room. I know many of you love that. That's going to be so important to sustaining what God is doing. We're going to have a brand new production facility from which we can do live broadcasting and in which we can hold weekly meetings. The bottom line is this, this new production facility will enable us to reach more people than ever before, put out more content than ever before, and also with your monthly support, we'll begin to do more events than ever before, more miracle services than ever before. So become a partner with me today. For those of you who sign up to become a $30 a month partner or more, I'll send you a signed copy of either Carriers of the Glory or 25 truths about demons and spiritual warfare. It's your choice. You can choose whichever one you want. Sign up today. We're almost there. We need the monthly support to come in so that we can take this next step of faith and do as the Lord has led us. Bottom line again, I must emphasize, new production facility, more events basically means we're winning more souls. You're helping us to expand the ministry and walk the more open doors than ever before. You just watch. God is doing something with this ministry and we are going to see a tremendous move of God. I believe it's time that the world sees the power of the Holy Spirit and I believe it's time our generation sees the power of the Holy Spirit and I need your help to take it to them. We need to take the gospel of Jesus Christ to the nations demonstrated by the power of the Holy Spirit. You watch. You're going to see a day when stadiums are filled with people giving their lives to Jesus. You're going to see the crowds coming by the thousands and repenting before the Lord and receiving their miracle and you're going to be able to say I was a part of that from the beginning stages. I was a part of the first time they began to really grow. I want you to be a part of it. Be a part of what God is doing. There are big, big, big things coming our way and we are going to win the world for Jesus. I'm so excited about it. So sign up today to become a monthly partner. If you're watching this on YouTube, a link is going to appear at the end of this video. It's going to be a red link and it's going to say donate slash partner. Go ahead and click that link and sign up today to become a $30 a month supporter or more. We also appreciate one time gifts or any other type of monthly support. Well, that is it for this edition of Spirit Church. Until next time, remember, nothing is impossible with God.


My name is Anand. I work for an Arab. I am an Android coding engineer, as you can see from my touchy. So I will be covering Android coding basics. I will be covering coding into mobile phones like what sandwich and what do. I will be covering how you code Android on development boards. Development boards means with a board or any kind of development board which you are aware of. But these are not just limited to any particular board. These are very well applicable for mobile phones also. So let me get started. I will just go through the interview for this session. I will be covering the Android software stack. I will be covering what all different layers Android software stack consist of. Next important topic is Android open source project. I will tell you how to get the code, what the code consists of and what is the code structure for AOSP and how to build the configurations. How to configure the builds and how to configure the end end options. Then I will be covering Android boot process and lastly I will be covering Android debugging and troubleshooting. So we will start with Android software stack. So take some time to go through the layers. At the lowest level you have an experimental. The next level is the same. It says that it goes like if you are capable of running Linux on a device then you can very well learn Android on it. But it's just the same. It doesn't work most of the time. Because it has some memory requirements. The next you can run starting from 32 MB of RAM to it goes up to 1 GB and more. But actually anyone has attended yesterday's talk regarding memory optimization. So in that talk Mr. Satish talks about what is the minimum memory your system should be having just to run and run smoothly. But yes Linux kernel is something which is the building block of Android. Then second layer is Android hardware section layer. Android hardware section layer is that part of code. That part of software stack which talks in between which talks between which helps your Android framework to talk to Linux kernel and eventually the hardware. Then we have got libraries and entire libraries. Your media framework, your whole library is Dalvik VM. Then starts the Android application framework. There you can see all the system services, your media servers, your network payments, solution managers, everything is part of the application framework. On top of it you will find Android applications. It could be anything like this, it could be realistic term, few of them home, dialer, camera. So how it works is that once you start your application it has to go through the Android frameworks. It has to go through a couple of services or more services. Then it will talk to your Linux kernel, hardware, to your hardware section layer and this middleware libraries. I have also put a small firmware binary section here which is essentially it is not a part of your kernel, it is not a part of your hardware section layer. This is something which you load or which you have put loads on to the hardware directly. Now I am talking about Android open source project. First thing is how to set up your dynamic machines or how to set up your host and dynamic machines. If you people are aware of Android mailing list and all these Android official channels, communication channels. There is an Android engineer called JBQ. He recently shifted a mail on Android building list where he mentioned that what is the requirement for ICS. If you are planning to put ICS or if you are planning to use ICS and build it for your systems then what is the requirement it is going to be. So I have just done this section of that mail which says that it is going to be about 6GB of download, 25GB of disk space if you do a single build. Now what he meant by single build is that USB comes with a couple of tablets or a couple of bills, default bills and other ones. Plus you can add your own bills. So here 25GB is only for a single build. Now it is in your disk space to do all the bills, default bills which comes with a part of USB, 16GB RAM. And then he mentioned that how much time it took for him to build ICS on his dual core machine. This is mainly from the host machine point of view. Host okay. When I am talking about a host machine I am talking about your development machine. And when I am talking about a target machine then I am talking about your development boards or your machines on which you are planning to run and run. So the second point is initializing and load build environment. 64-bit Ubuntu 10.04 machine. It is just officially Google says that it has to be 64-bit Ubuntu machine to build a USB. But there are a couple of workouts available through which you can build and run on 32-bit machines as well. The other dependent packages are Sanjama. Sanjama is a core of Android. That is the way you have to run it. So this is a dependency. It is a huge list. If you go to this link, actually this is a link. This is a hyperlink. So if you go to this link you will find all the dependencies. Plus the commands which you have to run on your host machine to met all these dependencies. If you are using Ubuntu or a Debian-based machine then these are going to be apt-get installed for your Fedora and USB-based machine. You have to find corresponding targets. Now the point is AOSP code access. So here I will be covering what AOSP consists of. How to download AOSP code. And what is this rapport tool. Now AOSP consists of multiple independent projects maintained by Git. Now what does this mean? Git is a code versioning system which is vastly used in Linux world. So AOSP is not a single project. You should see AOSP code if you have downloaded any of these AOSP codes. You will find that it is a set of hundreds of independent projects. Git projects. So what Android does is Android releases a tool called repo. So repo is essentially a shell script. It is a wrapper over git. So what it does is it downloads each individual project from that repository. So that you don't have to do it manually or one by one. Because as I have told you those are independent projects. You can download them individually as well. Initially Android AOSP was hosted at kernel.org. But due to some recent events they have to move to the new location. It's android.googlesource.com. Currently you cannot do web preview. That means that you cannot go through the code or web. So you have to download it and then you can do it. And since web preview is not available you cannot get it. It is also not available. Get it is a tool through which Android AOSP maintains its patches. So if you are planning to contribute something. If you have a feature or a patch or a bug fix in mind. So what you have to do is you have to set up this get it at your local machine. And then you have to push it to direct channels. And how it essentially works is how it works is that you specify the number of reviewers you want to approve. One reviewer or two reviewer won't tell you this. I'm not going into that much detail because of them. The last thing is manifest file. Of all the application developers here AOSP or Android project manifest file is different from application manifest file. Application manifest file is something that you specify. You have resources, permissions and other things. In this AOSP manifest file we specify the location of projects from where I'm going to download. I'm going to specify the branch from where I'm going to check out or the commit ID which I'm going to check out. I can just show you how it looks like. You can see this is the get location. Let's take a project. This is revision means your branch or it could be your commit ID. So this is a typical line. It says that the project is going to be Dawek. This is the project name. It's going to check out the revision 235. This is it. Revision is something which is either a branch name or it could be a commit ID. So we'll move on to next slide. How to download the code? How to actually use repo tool? This is the list of command to actually download the code. You will see that this repo init is something where you specify your project manager or your main host server where your projects are listed. B is for which branch you want to check out. It could be a possibility that you started with 235. Now then you move to 237 and now with ICS you have moved to 4.0. You have maintained your code as a separate branch. You can check out 235. So you specify hyphen b your branch name. Hyphen m is manifest file as I've shown you earlier. It will tell you what projects to check out and what commit IDs to check out. This first command rubbo init doesn't download. It just initializes your download. It will check for the existence of this project if it is there or not. It will ask for your name, email address and anything else. And this repo sync is the command which actually will start download. In this example I am checking out ICS code, Ice Cream Sandwich code from Enright's official channel. Now the code structure. How it looks like is, once you have downloaded the code, this is how the directory structure looks like. You will find a couple of these, a few of these directories. Bionic, bootable, build. The cscope.out and tags is not a part of your speed. This is something to do with me having these files. So in this section I will be briefly covering what all these directories are there for. First we will start with Bionic. Bionic is Android's C library. It is different from a GCC library. They have their own modifications. Essentially they wanted to move out of GCC because of licensing things. Plus a couple of features which they have added. Second directory is bootable. This is a legacy directory. No one uses it anymore. People use it only for reference. Only for reference because it contains fast boot code which has to go in your boot order if you are planning to have fast boot. So this is only for reference. Third directory build is an important directory. This is the directory which comes into picture when you actually do a build. So when you do a make and specify your target platform, then how your Android build takes those parameters. This is how the whole thing is configured in this directory. I will be covering this directory later. CTS is Android's competitive test suite. There is something which has nothing to do with booting. But it is important if you are planning to have Android market in your device. This is a test suite which you have to pass if you are planning to have your device certified. That you can say, OK, how it goes is that you say, my device is 99% CTS competitive or 100% CTS competitive. Then you go to Google and you say, OK, my device is Android competitive. I need an Android stamp on it. That OK, OK. It is capable of running Android market and other competitive things. Licensing things actually. Now it contains a virtual machine code, development container, test cases, mainly tutorials, multi-code. Device is again an important directory from a booting point of view. Because all the vendor specific, all the target specific directories, all the target specific files will go into device. External is, external directory is again an important directory. External directory holds all the projects which are directly or indirectly or not at all developed by Google. So you will find the Bluetooth, the WPS applicant, SCIA, everything which is not directly related to Google in this directory. Framework is your base, your Android core application framework, your service managers, your, all commitments, all the services which you learn is essentially a part of this framework directory. Hardware is your hardware specific, you will find all the hardware specific libraries modules here. Kernel is Linux kernel, Libcore contains Apache Harmony code which is kind of a complement code to Senjava. NDK is the key development kit, packages, AOSP stock applications which comes as a part of AOSP. Pribil contains of Pribil binaries, mainly two chains. SDKs, Android software development kit, you are most likely aware of this, what SDK is. System is something very important, some system contains your Android core system libraries or binaries. And Android system puts up it, what initially few binaries which run, which we run or which Android runs is a part of system library. So this is something which may be of interest for you. I wanted to check, I wanted to have a quick look into Android kernel because if you find all these development boards are any other board or any board if you get a hands on, they release only a stock kernel, they release Linux kernel, they don't release Android kernel. For example if your device is on 2638 kernel, but upstream your device can support 3.1 kernel. Now 3.1 kernel is a vanilla kernel, it doesn't have your Android patches. So what is the process to get those Android patches, put it in your latest kernel and then just run it. So how it works is, this is that history I'm talking about, Android or Google, it maintains an Android commentary. This commentary is hosted by Google in their GitHub repository. So what they do is, they put all their Android patches on top of Linux's base tree. For example if this Android comment is on 3.1, so what it essentially means is that he has taken Linux's 3.1 kernel and then applied its 470 patches on top of it and it has released it as a commentary. So once this is done, all you have to do is just extract the patches. If you are not aware of how to do it, there are a couple of git commands through which you can specify that okay, give me your patches starting from this commit ID and that commit ID is going to be Linux's commit ID. So it will extract all the patches on top of that patch and it will give you a list. Then you have to apply all those patches on your devices kernel. I'll quickly go through the Android kernel features. Binder is Android's IPC mechanism, it is mainly used for IPC mechanism. So how the services talk to each other, how the transaction flows. Azure memory is an anonymous shared memory also, sometimes known as Android shared memory. When we have logger, logger is an important thing because it is the driver which maintains your system logs. And now when I'm talking about system log, I'm essentially talking about 4 types of logs. Android driver, this logger driver maintains 4 buffers. One buffer is for your system logs, another buffer is for your radio logs, one is for your event logs, and one is you must finish your kernel logs. There's something which is very handy when I'm going to cover the debugging session because that is where you've done those logs. That is where you specify okay, I want to see my radio is not working fine, I want to see what is going wrong there. So instead of just dumping all the 4 buffers, you can specifically dump logger, you'll just dump radio logs. Wake logs is some, it's an invite feature which prevents the system to end up suspending or low power sales. How it works is that from your application or from your native service, you request for a wake log, and once you have a wake log acquired, that means that system is not going to sleep and it's not going to sleep. So you can do whatever you want to do and then you have to just release it. Once you have released the wake log, you can go to system log. Out of memory handler, this is something which application developers are getting very, very well aware of what it does, that if it finds your system is going out of memory. So it starts scaling process based on their priority level. Now this priority is something which you set in your init.rc file. I'll be covering what that init.rc file is. Aram is Android's Aram timer. Ram console is again something which is helpful in debugging. Paranoid network is Android's term where, you know, you can only lay around your network settings if you have a particular user ID or a group ID, namely which is a root ID. Okay, so here we are. As I told you, hardware abstraction layers are that part of code which sits in between your framework and kernel. So your framework can talk to your hardware abstraction layer and then it can talk to your kernel and your hardware. Now here what I have covered is I have covered that part of code where your hardware abstraction layer is hooked to your Android framework. So how it works is that you can see the star hardware interface. Now what does the star hardware interface means is that your interfaces, your C++ class has exposed interface class which could be camera hardware interface. It could be audio hardware interface. So once you have this hardware interface implemented, you have to implement your hardware abstraction layer and then your application framework will call this hardware get module or this DL open dynamic linking. So how it works is in that hardware get module is specified that my module name is this. If you see the usage of this function, it requires a tag and then some other parameters. So based on that tag, it will load the module, it will search for your hardware abstraction layer in the runtime space. Second thing is how hardware abstraction layers are linked to framework is one thing is this runtime binding where you just open the directory or you use hardware get module function or you use dynamic linking. Second option is to do a build time linking. At build time you specify I am linking to this module so at runtime it will load these modules. Third is the standard direct C++ or slash def node entries where you just open the C++ entries right into it and then let the driver take care of everything. So in this case there will not be any specific library in between. Your framework can directly talk to your driver. This is what happens in case of Wi-Fi. If you guys are well done with Wi-Fi or something like this, there is no firmware in between. Now firmware is there, there is no hardware abstraction layer in between. So what it does is it just writes to some sentence C++ entries and it just let the driver take care of everything. Firmware here are different from hardware abstraction layers. I just use firmware but don't get confused. Firmwares are not hardware abstraction layers. Okay, so I will be covering and I build process. These are the generic commands where you just run and you expect them to work straight away. First of all, set up your build environment if you okay. With this... This should... So this is the build entry I was talking about. What it consists of is... This is the top layer of main client. It does nothing. It can do anything. It is just a make file. So it can configure your targets here. By default, there are no targets defined here. It will just include build code, main.mk. Which is... Here you will find different targets defined. I'm assuming that people are aware of make files. So what are targets and how make file works. So this drive, if you see... Drive is a default target. If you are not specifying any specific target, it's going to assume drive. Okay, I'm going to build drive. What drive means is that it's going to build your system images, your user data images, but not kernel. Because kernel is not part of drive. Okay, so... This is something that she can check it out later. This is the one which we run... This is the script which initializes your build. So if you see, it exports certain binaries, like mm, mm, mm. It exports your target products. It exports your configurations which is present here. Build code, config.mk. See, this file contains your build configurations, which are the default build configurations. Okay, so this is it. Mostly, they are specified the 2-chain path. What is that default 2-chain you want to use? For example, you don't want to go with this 2-chain. We have our own 2-chain. This is what we do in our app. We are always on top of the latest GCC 2-chain. We use GCC 2-chain to build. So we just modify this path. We specify, okay, we are going to use 4.6 2-chain. Now, after running the first command, it will export certain variables. This is lunch. What lunch does is lunch helps you choose what target product you want to build for. Tablet product is something which you specify for your product. I'll be coming to this later. Then, while building, you can use Ccache. This is mainly used to cache object files because ASP building is a huge process. On normal machine, it takes around 4 to 6 hours. If you are sharing that machine with someone else, and if you are using this variable, that means those object files are already cached. So for the next person who is going to do a build, it's not going to take that much time because it has already cached certain object files. But the limitation here is that it only caches C and C++ object files. So all the dev files is something which you have to build again later. Then you have got MakeCommand, which will just start your build. MM or MM commands are mainly make commands, but they are mainly used to build independent projects. Because Android has only one top-level make file. It doesn't have separate make files for independent projects. Independent projects come with a make file called android.mk, which is not a standard make file, it is android's make file. So you can find the androidization there. So you use these commands, MM, when you specify target product. So these M or MM, they know what does, I mean, what android.mk is. I have a question here. Yeah? You see, without use make, I couldn't do an extra specific way. I know that in one of the forums that the extra view can be the number of threads single code. Yes. Single code. So you can give make minus a 2. Sometimes they say it's two threads and single code, possibly minus a 4. And here we have written plus 1. Yes. So it's all a little confusing. See, ideally you should not give plus 4 for a single code. Okay, yes. Then you can do, yes. You can give up to minus 8. You can give whatever you want to do, but it's not going to use it. So there's a limit, there's a limit on the number of threads it can spawn. So basically, if I give the number of threads, it should be good enough. Number of threads plus 1. This is what people recommend. Would you know why it has plus 1? No idea. Yes. But you know, instead of giving just any number, what people recommend is just give number of threads to your CPU server plus 1. I need one more question. Yes. This is going to be the standard architecture. Okay. You mentioned about the explainer for the standard in the CE or normal language, but it's not standard. Suppose I want to have new service or new applications there. Okay. What I'm supposed to do is combine the common machine if you're planning to do it as a service. Yeah. Right? So it has to go in framework. Yeah, but I think of the standard inside or if you take the next one. You have to make the entry in the next one of the entry file for building handle. Okay. So if you take the next one. No, you have to make the entry in your port configuration file. There's a HTML called product underscore packages. Okay. So in your device configuration files, you specify that apart from the default packages I want to build these many packages. Okay. Okay. So I will talk about this thing in the next session. Right? So how to add your own project. But as far as the service thing is goes, service or specific part is a, you know, Java jrx part. So it should go to framework. It should not be in standard. I mean it should not be. So it is a configuration files. It will go main contract product that mk product that is called mk. These are just for reference if you want to be to, you know, show it. I am already showing to you. Okay. So I will just go through my slides. Somebody here is that you have to export these three variables product device, product and target device. Now these variables are something which you have to define in your both configuration files and direct them to both configuration files because both are something which is very important. But these are the ones. First thing, because the first line you say that the build time configuration files are invite products both config and invite both dot mk. And write dot product, products dot mk is the file which you specify all your board specific files. So for example I am really talking about going to Google under both dot mk. Can you specify my product device and other things. Now comes your board configuration file. Okay. So this is going to specify your build options specific to your target. For example, for a new device, if I have a new device, what I do is I will build it with all the stuffs. I will try to make sure that you know the basic, the core of invite comes up. Audio is not working. I am not worried about. Camera is not working. I will just use stuffs. So what I do is instead of using these also audio and stuffs I will use this. Board uses general audio. Similarly I will use board has a camera stuff. So this is something which you can can, these are build time configurations for your target. Which you can specify there. After these build configuration files there are 10 configuration files like init.rc and other things. init.rc is just a script. It's like an android own small scripting language where it specifies certain triggers. Triggers are like early boot. What should android do in early boot phases? What should it do after it boots up? What should it do in the initialization phase? So this is what I am talking about. On init, on boot. These are not triggers. So what it does is these are just commands. Change the ownership, change the permissions. And the end is the fun part. This is where android initialization starts. So this is it. We specify the number of services which we want to run. So services this, service that, service this. We can see WBS a pick and native demo and everything else. So that is our init.rc. Similarly you have certain runtime configuration files. This is the optional product.mg. Packages package which I am talking about. If you are planning to add no extra package then this is where we have to add it. Now the android boot process I will just go through it quickly. Android kernel will start the init process. It will go through the init.rc script and then it will start all the services and all the commands which I will stick there. It will start zygote. Zygote is your first process. Not the first process but the process which will initialize your line and spawn other processes. Then it will go all the services I have mentioned in the init.rc. Zygote will start the system server. System server will start all the services. Now all the services I don't have time to show you the code but it is in framework based services, Java and system server.java. So you will find that there it is starting all these services. Once these services are out essentially your system is out. Now how other applications get spawned? Applications are spawned by Zygote Dalvik which is larger. Android application talks to other services. Now how these services talk to each other is that the service manager I have mentioned specifically because the service manager is the context manager. Context manager means it is the one who is going to do the IPC who is going to initiate the IPC. So you know we talk to service manager service manager to talk to binary. You know it will reply back and it will talk to your application. So I am going to be talking about troubleshooting. These are commonly used tools. Most important thing is to better logs as much as possible. So in init.rc I have shown you that there is something called log level which you can increase. So more you increase the log level more dumps you will get. DMSS is your kernel log, log cat and dumps your system logs. Four types of logs. It is almost empty. KDP DMS you might be in love with it. This is an interesting thing. The last KDP DMS is what it does is it stores your last KDP message in this file. So which you can retrieve in the next boot. TraceView is something a lot to do with Android applications. And for help you have all these Android communities you have ILC channels Robots forums where you can ask a question and you will get back to you. So any questions? We can take one question here. Any other questions? Basically I am trying to get TraceView in the next one. I don't know if it will come in stock. I just want to know. For example, I have got an EPK file. I have another EPK shell open. It will be in the same emulator. And I do a log cat. Can I see what is happening in terms of that app thing? Yes you can. But I couldn't. So I don't know what is the problem of an EPK file. No, because I have checked things like this with logs. You will get complaints like just download it to your system and restarting the EPK. So this kind of work is something that I have seen. Okay, but I have not done anything to increase the log level. It should come either ways. It should come either ways. Because log levels are mainly for in-it level log levels. And for if you are doing a log cat and if you are using any level which is about debug level then it should come. I mean debug or warnings, alerts, they should come. So it depends on your EPK or your application. By starting how many messages it is happening. If it is not happening anything you will not get anything.