it doesn't have to be meaningless
It has to be. More meaning comes with more intimacy, or meaningful conversations happen between sessions of small-talk. The better you know a person, the more reasonable can the conversations be, unless you are in a professional work-related relationship. As the Wikipedia article says, the topics discussed in small-talk are less relevant than the social function of this type of communication.
The capacity to conduct small-talk is a social skill and it is essential in human bonding, it is the engine that creates interpersonal relationships of the more intimate kind (friendships, romantic relationships). People who are not capable of small-talk are seen as unfriendly, aggressive, rejective / repulsive, aloof, introverted (that's something really bad), or appear to hide something which makes them susceptible to prejudicial categorization (as, in the case of men, that behavior makes people think of them as rapists, murderers, or general sociopaths -- the media exacerbate that by always mentioning that some 'shooter' was a 'loner'.)
Small talk can consist of random topics that interest you
As you said, you need to get to a point of intimacy first where you can realize that you actually share a certain interest with the person you are having the conversation with. You can't just start talking about applicative functors in functional programming languages, or topological auto-routing algorithms. Most people would find that to be a very awkward and unpleasant situation, as they aren't interested in the slightest.
Up until that point, small-talk topics are so meaningless they pain my soul if I only listen to them. You need to talk about emotional rubbish like weekend stories, love stories, recent social activities, blah. I am not personally interested in other people's social lives, their social position, their social status, or whatever they could try to convey during the casual conversation.